For #175972
Here's what believe is happening:
- Workspace opens. We download the archive for the current commit
- User makes a commit
- The commit has now changed, which invalidates the archive. However TS doesn't know this (all the uris seem to stay the same). This means that we silently start going to the network again on file system operations
To fix this, we're going to try re-requesting the archive when a file system change event is fired for the workspace root. This should happen when a commit is made
- Don't compute `semanticSupportedSchemes` early, as this may be incorrect if the script is loaded before there are workspace folders
- Handle exceptions when watching files by logging them but not crashing the server
Fixes#170920
Enables this feature by default but also disables semantic errors. This is needed to avoid lots of annoying false positive errors for external modules. We plan to remove this limitation once type downloading support is enabled
Fixes#182526
The chat panel changes the language of a document. This revealed a bug in JS/TS about language changes.
Normally changing a language should close and reopen a text document. However we added an optimization to not do this full flow if the open then close happens quickly
However this causes issues if the file changes languages as TS gets into a state where its doc language id does not match VS Code's language id. To fix this, I've limited the optimization to only apply when the expected script kinds match
* Add preference for replacing Go to Definition with Go to Source Definition
* Support replacing Go to Definition with Go to Source Definition by preference
* Predicate call on TS version
Fixes#177823
For document hightlights, it seems TS returns windows paths that use forward slashes. This seems wrong, but we also likely don't need the extra check for the file on our side either since we already pass in `filesToSearch`
For #177083
We've had code to normalize the file path for a long time but I don't think it's needed. In the case of samba paths, it also appears to break things
Let's try dropping it and passing along the original `fsPath` instead
Even though the diagnostics on the ext host side may be equal, the displayed diagnostic may be at a different spot. We need to make sure the UI is also updated in these cases by setting the diagnostics again
Fixes#173707
We previously converted the TS Server log from a simple string to an object. However there were a few cases where this object was incorrectly being converted into a UI string, resulting in `[Object object]`
There's a bug on the TS Server side that causes it to traverse out of the project root when checking for directories like `node_modules`. On web this ends up being super slow because it goes to the network
This fix blocks those reads
When opening a file, we pass TS Server a project root to prevent it from scanning too many files. On web, we need to pass the transformed project root, not the original uri
This PR also removes some confusingly duplicated methods and renames them to make their behavior more clear
- Fix loading of `/lib.dom.d.ts` files
- Remove file content copies being made on read
- Extract encoder/decoder constants
- Small formatting cleanup
- Remove platform setting since it's not relevant
* recreate logging from other machine
* comment out openSystemBrowser
Because I dont have the default browser set up correctnly on any of my
machiens
* Add vscode-wasm-typescript dep
And some logging as I figure out how to use it
* remove unused reference to module
* use require reference that linter allows
* Add vscode-wasm-typescript to tsserver.web.js
Use webpack's CopyPlugin transform pattern to do this manually. This is
probably a bad idea! It's just for prototyping purposes.
* Update vscode-wasm-typescript dependency
* Fix minor syntax in webpack hack
Nonetheless required for it to work!
* Fix another typo in webpack hack!
* Fix provided typescript path
Another typo. Guess my local test wasn't running the contents really
* Try to improve module.exports handling in webpack hac
* tsserver.web.js comes from local builds
Also:
- tsserver.js is no longer minified
- log crossOriginIsolated
* First attempt to set up server-side support
* Remove auto-imported identifier
* Move sync-api setup code to serverProcess.browser.ts
Because it's browser-specific
* Reorder webpack hack and clean up unused logging
* Update vscode-wasm/vscode-wasm-typescript dependencies
* Add file watching
* Extract webpack hack
Build only the ts parts of tsserver.web.js, don't rebuild the vscode
extension. This is a lot faster.
* Remove manual verbose logging
Sheetal showed me the correct way to create a verbose logger instead.
* Add vscode-test-web to semantic-supported schemes
And make isWeb support semantic mode.
* Also update the webpack-hack-only build
* Switch to tsserverlibrary
Also paste in some example code for cancellation, which is not finished
at all.
* Remove bogus auto-import and unneeded (?) dep
* remove webpack-like hack
* move code from vscode-wasm-typescript
* Initial prototype of cancellation
It compiles and looks kind of plausible. But I haven't tested it yet.
* Switch tsserver to separate MessageChannel
* Move watches to a separate MessagePort
Further simplifies the message dispatch code by shifting complexity to
setup. And the setup is straight-line code.
* switch vscode-web from in-memory to real filesystem
goto-def is currently broken because some part of main vscode still
needs treat the files as in-memory, though.
* Make toResource translate / -> vscode-test-web
* Encode scheme and authority in TS filenames
Like the previous host did, but without the leading ^ that TS hard-codes
as "in-memory".
The tsserver host needs to know about the encoding, but the translation
is in a single function. This also means that displayed file paths are
prefixed with /scheme/authority (/vscode-test-web/mount in my testing), but I think that's fine.
* Lift parseUri outside createServerHost
I'm not using it to set the schema/authority for getCurrentDirectory
right now, so there's no shared state to mutate.
* Special-case URI of lib*d.ts in webServer.toResource
Similar to the special-casing in typescriptServiceClient.toResource.
Also requires passing in the extensionUri. This feels like it's breaking
through at least one abstraction layer, which might be a problem.
* Improve cancellation
1. Simplify cancellation checking in web tsserver host to match the
checking in typescript's node host.
2. Move cancellation of request in the extension to tryCancelRequest
from sendNextRequests.
3. Only send cancellation via node or web cancellation, not both.
* Pass in current request instead of waiting for a fresh one.
* Address initial PR comments
Also add some TODO comments for the revision to watches.
* Add cancellation bit to each (cancellable) request, locally fix an issue with retrieving the cancellation bit
* Switch to per-file/directory watches
Watching the entire filesystem recursively is supposed to be
inefficient.
Not done yet: there is an error when watching directories, but it works.
And I can't tell whether watching files works yet.
* Parse --serverMode partialSemantic in webServer
Now the syntax server actually runs as a syntax server.
* Simplify logging code
* Cleanup in webServer
1. Remove a little logging.
2. Correct failure return value for getFileSize
3. Reorder some methods and parameters.
* Switch to markdown extension's FileWatcherManager
I'm not sure if it's OK to depend on a module from another extension;
it's probably better to include the files from a central place instead.
* Clean up host methods
1. Copy and adapt implementations from node host where possible.
2. Note questions for the PR elsewhere.
3. Remove logging except for caught exceptions.
* More logging/TODO cleanup
* Remove duplicate dependency
* Add setting to enable/disable semantic mode on web
Also gate it behind a check to `crossOriginIsolated`
* Re-order and re-arrange code to minimise PR diff
It won't minimise it *much*, but I also consolidated some
unnecessarily-spread-out code that will be easier to read in the long
term, and possibly easier to read in diff form as well.
* Copy fileWatchingManager to typescript extension
Copy from markdown extension to typescript extension. I used the
existing dependencies in the typescript extension, but verified that
they would work the same.
* Fix linting of webServer
* Align formatting of catch / else
* Extract isProjectWideIntellisenseOnWebEnabled and keep using in-memory prefix when project wide intellisense is disabled
* Make sure we still work if SharedArrayBuffers aren't supported
* Remove symlink support and fix typo
Symlinks are implicitly supported by the filesystem right now.
* Fix compile errors
Co-authored-by: Johannes <johannes.rieken@gmail.com>
Co-authored-by: Matt Bierner <matb@microsoft.com>
Fixes#171091
This setting controls TS Server's behavior and should not be exposed directly. Instead you can use the `includeCompletionsForImportStatements` and `suggest.classMemberSnippets.enabled` settings to enable/disable individual types of completions
This removes extra code we had to support TS versions that are 4+ years old. We do not test these versions and a very small number of users are actually using them