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

Use TS InferredProject, ConfiguredProject instead of language service API #808

Closed
johnsoncodehk opened this issue Dec 21, 2021 · 5 comments

Comments

@johnsoncodehk
Copy link
Member

If project depend on some large packages (lot of .d.ts files), language service API spend lot of time to resolve auto import from node_modules packages.

TS implement cache logic in InferredProject, ConfiguredProject over language service API to avoid performance issue. Not sure is possible to use InferredProject, ConfiguredProject instead of language service API in volar. If can, should be able to fully achieve vanilla TS level performance.

https://github.com/microsoft/TypeScript/blob/009dd487a6543d16c8e403ea055ac0683c6bc5d3/src/server/project.ts#L258

@johnsoncodehk
Copy link
Member Author

In 0.30.0, you can config "typescript.suggest.autoImports": false to skip calculate auto import for now.

@jahnli
Copy link

jahnli commented Dec 24, 2021

@johnsoncodehk In the Settings. The json?

@johnsoncodehk
Copy link
Member Author

@jahnli in VSCode settings / .vscode/settings.json.

@jahnli
Copy link

jahnli commented Dec 24, 2021

image

Is that right ?

@johnsoncodehk
Copy link
Member Author

johnsoncodehk commented Feb 13, 2022

Just tried reference TS internal code to implement auto-import cache logic for language service API, but it may invalid at any time with TS version update, has happened once in the past (15e744f).

And please note that I haven't implemented file watcher for this, when node_modules / package.json updated, you need to restart volar server to refresh auto-import cache for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants