-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
Automatic Package Acquisition and Full Project Loads for TypeScript on Web #182791
Comments
Not sure if this is the best place to report the bug but I'm going to post here since this is a work-in-progress. I'm trying to setup vscode on the web with typescript support using https://github.com/CodinGame/monaco-vscode-api. My app has private npm packages (node_modules) that are already mounted in the vscode filesystem tree. I found that typescript server ignores my node_modules directory and always tries to download the package from npm. I was able to fix the issue by disabling this behavior by commenting this line. You can find more details about this issue here. Do you think it makes sense for |
For microsoft#182791 With this change, we now make a single call to the package manager per root instead of per package. This simplifies the code and should be better for perf Still seeing a bunch of errors in the console but TS typing is working ok. Needs more exploration for ATA
Try to fix ata perf issues on web For #182791 With this change, we now make a single call to the package manager per root instead of per package. This simplifies the code and should be better for perf Still seeing a bunch of errors in the console but TS typing is working ok. Needs more exploration for ATA
For microsoft#182791 Enabling for further testing
Should be working. Have run into a few edge cases but overall seems to be working well |
Marking as verified because we actually went through testing last iteration: #226653 |
TypeScript in VS Code has already been able to support workloads across TypeScript and JavaScript projects in web scenarios, such as on https://vscode.dev and https://github.dev. Unfortunately, it suffers from two problems:
Over the past months, @sandersn, @zkat, and others have experimented with enabling these experiences on the web through a few separate efforts, and we think VS Code in the browser should be able to adopt them in a near-term iteration.
Full Project Loads
Editing or exploring TypeScript and JavaScript projects is decent today; however, cross-file navigation, auto-completion, and more are extremely limited from not having the full project graph available. Without files from the same program or configuration files, we can't give anything close to the experience we provide outside of the browser.
Currently, there are means to experimentally enable a full project load by using a custom server host in the browser. This is powered by
@vscode/sync-api-client
. In https://vscode.dev, the TypeScript extension should be able to leverage this custom host when it creates a custom tsserver instance.Automatic Package Acquisition
Even when we load the full program graph in TypeScript, we'll still be missing the declaration files from external libraries, which are a huge part of the editing experience. This is a familiar problem - when TypeScript started supporting JavaScript projects, managing declaration files was a process specific to TypeScript projects. That's why TypeScript supports a process called "automatic type acquisition". When TSServer is started, it can be given the path to a "typings installer" process, and in certain cases, when TypeScript's project system encounters an unresolved import, it will send a message to that typings installer process. For files that should appear in an unresolved package like
foo
, declaration files from@types/foo
are downloaded to a cache and projects then have the option to use these declaration files when a path fails to resolve.This is close to what a user needs for a TypeScript-in-the-web experience, except that
@types
packagesWhat we want is something closer to what one might call "automatic package acquisition" that can fetch the actual package in the most accurate way.
We've made some more of our APIs public in the TSServer library. Over at zkat#1, we have a proof-of-concept doing exactly this using
typingsInstaller.js
that can be run on the webThis combo works pretty well in our cursory experimentation! Still, there's some more polish that will need to go into this.
Current Next Steps
As you can see from the checklist over at zkat#1, there's still a bit of work to be done.
localStorage
)package.json
File Watching issuesThe text was updated successfully, but these errors were encountered: