Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically detect packageManager #1646

Merged

Conversation

wilkinson4
Copy link
Contributor

Deprecate the packageManager setting, and automatically detect it with the vscode command.

@wilkinson4
Copy link
Contributor Author

@microsoft-github-policy-service agree

@microsoft-github-policy-service agree

@wilkinson4
Copy link
Contributor Author

First time making a PR to a language server so please let me know if I missed something.

Copy link
Member

@dbaeumer dbaeumer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment about resolvedGlobalPackageManagerPath

server/src/eslint.ts Outdated Show resolved Hide resolved
@wilkinson4 wilkinson4 force-pushed the ww/automatically-detect-package-manager branch from 3b34940 to 35e2a76 Compare May 2, 2023 14:28
@wilkinson4 wilkinson4 requested a review from dbaeumer May 2, 2023 14:28
@wilkinson4 wilkinson4 force-pushed the ww/automatically-detect-package-manager branch from 35e2a76 to 28910c7 Compare May 2, 2023 14:31
}
const realpath = fs.realpathSync.native(result);
// Only use the real path if only the casing has changed.
if (realpath.toLowerCase() === result.toLowerCase()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like your PR made some unintended whitespace changes. I suggest removing them for a cleaner git history.

Copy link
Contributor Author

@wilkinson4 wilkinson4 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes came from the npm run lint script that I ran with the --fix option. I can undo them if we don't want the changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, in that case yeah we should leave them to make sure the codebase is properly linted. Kind of inconvenient they're not in their original PRs though. Maybe we should have a lint PR check @dbaeumer?

client/src/client.ts Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@wilkinson4 wilkinson4 force-pushed the ww/automatically-detect-package-manager branch from 28910c7 to 5db8956 Compare May 5, 2023 21:28
@wilkinson4 wilkinson4 requested a review from MariaSolOs May 5, 2023 21:28
MariaSolOs
MariaSolOs previously approved these changes May 5, 2023
@wilkinson4
Copy link
Contributor Author

@dbaeumer anything else that needs to be addressed in this PR?

@dbaeumer
Copy link
Member

dbaeumer commented May 18, 2023

@wilkinson4

IMO the change can be breaking for users that had different values set for ESLint and the package manager extension. IMO we should deprecated the value and code wise do the following:

  • read ESLint's value AND the value through the command and consider their default values.

If both values are the same pint a message to the channel that the eslint value is deprecated and will be removed in the future. Use either of them

If the values are different print a message to the channel that the value is deprecated and that we will not honor it in the future and that we moved to npm.packagemanager. I would still use the eslint value for a while.

Breaking changes usually cause swirl especially since we will receive issue reports for it. This is why I try to avoid this.

Sorry for detecting this so late.

client/src/client.ts Outdated Show resolved Hide resolved
@wilkinson4 wilkinson4 force-pushed the ww/automatically-detect-package-manager branch from 600bc0a to 9c4004b Compare May 18, 2023 22:20
@wilkinson4 wilkinson4 requested a review from MariaSolOs May 18, 2023 22:21
@wilkinson4 wilkinson4 force-pushed the ww/automatically-detect-package-manager branch from 9c4004b to 5c3a156 Compare May 18, 2023 22:21
MariaSolOs
MariaSolOs previously approved these changes May 18, 2023
Copy link
Member

@dbaeumer dbaeumer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other commants.

client.warn('Detected package manager matches the one in the deprecated packageManager setting. This setting will be removed in the future, so you can remove it from your configuration.', {}, true);
return detectedPackageMananger;
}
client.warn('Detected package manager differs from the one in the deprecated packageManager setting. We will honor this setting until it is removed.', {}, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include the two values in the message so that the user already knows about them and can make a decision how to prceed.

client/src/client.ts Outdated Show resolved Hide resolved
@dbaeumer
Copy link
Member

@wilkinson4 Forgot to say thanks for working on this.

@wilkinson4 wilkinson4 force-pushed the ww/automatically-detect-package-manager branch from 5c3a156 to 26a6862 Compare May 19, 2023 14:08
@wilkinson4 wilkinson4 requested a review from dbaeumer May 19, 2023 14:08
@wilkinson4
Copy link
Contributor Author

@wilkinson4 Forgot to say thanks for working on this.

No problem!

@wilkinson4
Copy link
Contributor Author

See other commants.

@dbaeumer Following up on this one. Made the recommended changes.

@dbaeumer dbaeumer requested a review from aeschli May 24, 2023 07:57
@dbaeumer dbaeumer enabled auto-merge (squash) May 24, 2023 07:58
@dbaeumer dbaeumer merged commit 3b427a0 into microsoft:main May 24, 2023
mochaaP added a commit to mcha-forks/nvim-lspconfig that referenced this pull request Sep 29, 2023
mochaaP added a commit to mcha-forks/nvim-lspconfig that referenced this pull request Sep 29, 2023
glepnir pushed a commit to neovim/nvim-lspconfig that referenced this pull request Sep 30, 2023
@wilkinson4 wilkinson4 deleted the ww/automatically-detect-package-manager branch November 6, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants