-
-
Notifications
You must be signed in to change notification settings - Fork 473
chore(language-service): improve global types error message for JS projects #5574
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
chore(language-service): improve global types error message for JS projects #5574
Conversation
…ojects - Include jsconfig.json alongside tsconfig.json in error message - Add performance warning about excluding node_modules - Better guidance for JavaScript projects using Vue language tools
vue-component-meta
vue-component-type-helpers
@vue/language-core
@vue/language-plugin-pug
@vue/language-server
@vue/language-service
vue-tsc
@vue/typescript-plugin
commit: |
I think how to configure jsconfig falls outside the scope of this project. Simply adding jsconfig is sufficient. If the user is not in an npm like environment, there is no need to exclude |
Thank you for the feedback! I understand the scope concern, but when we guide users to create jsconfig.json, we inadvertently break VS Code's default node_modules exclusion behavior. Users often start in non-npm environments but later install dev tools, causing performance issues when VS Code scans the newly created node_modules. Since our error message changes this default behavior, maintaining good performance for users is our intention. |
"non-npm like environment" does not refer to a state where |
Here's a real scenario: when I create a UniApp project, it doesn't include these files by default, but later I need utility libraries like xe-utils, which creates node_modules in the root directory, and as the project progresses, node_modules grows larger. |
Had not considered that 😄. I will make some changes for merging. |
Thank you for your reply. It's my great honor to be of help! |
Description
Improved the global types error message to be more inclusive and helpful for both JavaScript and TypeScript projects.
Changes
"exclude": ["node_modules"]
when creating new config files to maintain VS Code performanceMotivation
Problem Background
When users are in a non-npm like environment, they may be missing both the node_modules directory and TypeScript/JavaScript configuration files. The previous error message only mentioned
tsconfig.json
, which could confuse JavaScript developers who usejsconfig.json
.Performance Risk
More importantly, according to VS Code official documentation, VS Code will by default exclude the node_modules folder to optimize performance when there is no jsconfig.json in the workspace. When users create a new jsconfig.json to configure
vueCompilerOptions.globalTypesPath
following the error prompt, this changes VS Code's default behavior.Potential Issues
If JavaScript project users don't explicitly add
"exclude": ["node_modules"]
when creating jsconfig.json, then when they subsequently install npm dependencies, the TypeScript/JavaScript language service will scan the entire node_modules directory, which may cause performance issues.Solution
This improvement ensures that the prompt message is preventive and comprehensive, specifically targeting the performance risks of jsconfig.json, while maintaining unified recommendations for both types of configuration files, allowing users to solve the current problem without accidentally breaking VS Code's default performance optimization mechanism due to our suggestions.
Testing
References