* 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
* Initial draft.
Not working.
Also not correctly formatted, I'll do that later.
* Various fixes
It works now
* A bit of cleanup
* Move webServer to its own directory
And prepare for getting rid of dynamicImportCompat.js hack
* Remove dynamicImportCompat.js hack
* Revert unrelated change
* Webpac tsserver.web.js with webServer.ts as entrypoint
Instead of using CopyPlugin.
1. Shipping multiple entrypoints in a single file required fixes to
build code.
2. There are a couple of warnings from `require` calls in
tsserverlibrary.js. Those are not relevant since they're in non-web
code, but I haven't figured how to turn them off; they are fully dynamic
so `externals` didn't work.
* Ignore warnings from dynamic import in tsserver
* Add to .vscodeignore files
* Add `removeUnusedImports` command
* Continue to send `skipDestructiveCodeActions` for older TS versions
* Expose Sort Imports and Remove Unused Imports commands
* Update localization keys
* Update for 4.9 protocol
* Proto must be type only import?
* Associate experiment info with existing telemetry.
* Move the ExperimentTelemetryReporter to its own file.
* Roughly copied the 'getPackageInfo' function from other extensions.
* Addressed code review feedback.
* add `WorkspaceEditMetadata` and use it for `applyEdit`,
https://github.com/microsoft/vscode/issues/112109
* fix compilo in tests
* workspace edits from updating paths are marked as refactoring fyi @mjbvz
* Initial contents for JavaScript walkthrough.
* Just suggest a `.js` file.
* Switch the walkthrough to be a Node.js walkthrough.
* Remove leftover file from HTML walkthrough.
* Add basic detection mechanism for node.
* Don't check for a Node install until the user runs debug.
* Add "learn more" link.
* Some assets.
* Remove "run" section.
* Add a "try debugging anyway" option just in case.
* Remove "view terminal" command in run & debug.
* More copy.
* Remove unused command.
* Update icon and themed walkthrough SVGs
* Default to not showing the extension.
* Replace icon
* Delete TODO.md
* jsWelcome -> nodejsWelcome
Co-authored-by: David Dossett <ddossett@microsoft.com>
Co-authored-by: Matt Bierner <matb@microsoft.com>
* Add patch for enabling new TS plugins on web approach
https://github.com/microsoft/TypeScript/pull/47377
To run plugins on web, we need to shim out `dynamicImport`. This is done in a file call `tsserverWeb.js`, which is added by the linked PR
* Update for new files names
We're seeing a lot of crashes caused by TS Server plugins (usually those that come from extension). This will be easier to track down if we also include the enabled plugins when reporting issues
We've been seeing a fair number of reported issues about TS Server crashes that are caused by plugins contributed by extension. This change adds info to the error message about enabled global plugins so users can try disabling them
Other changes:
- Use `JS/TS` instead of Typescript since the server is used for javascript too (a common source of confusion)
- Fix some missing checks to `_isPromptingAfterCrash` and some extra guards that were causing some crashes to now show this message
- Use `crashed` instead of `died unexpectedly`
From https://github.com/microsoft/TypeScript/pull/48529
Let users control is variable type inlay hints are suppresed if the variable name matches the type name, such as:
```ts
const range = new Range();
```
Fixes#14912310c8c1c2cc made sure we sync over the authority of in-memory resources over to TS Server. However if a resource does not have an authority, this resulted in a url with `scheme//path` instead of `scheme/authority/path`
TS would then normalize the uri to `scheme/path`, resulting in us considering this a new resource
This fix adds an explicit empty authority that we use in this case instead
For #146853
Make sure we include the uri authority when serializing and then restoring the file paths we send to TSServer (similarly to how we already handle the uri scheme)
Currently if the server crashes too many times, the user has to restart VS Code. It's possible the user could fix something (such as a bad plugin) and then run this command to just restart the server without needing to restart the entire editor
Fixes#143032
This change removes a call that would automatically restart the TS server when invoking a command. Instead we now return a `NoServer` response
When this happens, the server still should be restarted. This change stops us from logging a large number of errors when we get into this state where the server has crashed too many times and we no longer want to automatically restart it
Fixes#143648
The nameSpan property has existed for something like years or so, so it should be safe to use. There's currently not a good way to request the reference count of an anon function and I don't think this is actually useful to show since the ref count should always be 1 for these
* fix(ts-features-extension): resolve correct path for `extends` of tsconfig
fixes#131643
* always provide link. add command to resolve the link path on click
* cleanup
just make the code cleaner
* revert `yarn.lock` changes
* pretending eslint
* use `vscode.open`
* don't add `.json` to path if it's already here
this change better conforms the TS resolving algorithm (see the reference)
* style: move `resolveNodeModulesPath` to top level
* don't show falsy errors on absolute paths
* improve resolveNodeModulesPath impl
- fixed a bug with infinite loop
- check for module existence once per level
* API: Allow to use the file watcher for aribitrary folders (#3025)
* fix tests
* update `createFileSystemWatcher` docs
* refuse to watch resources that are watched in workspace already
* properly check proposed API
* make it work via `createFileSystemWacher` (first cut)
* more docs
* cleanup
* enable recursive watching based on pattern
* add tests
* drop out-of-workspace events when using simple patterns
* do not apply excludes when watchig files
* log extension watch requests
* also log unwatch
* improved exclude handling
* more docs
* drop proposed api needs
* remove `suite.only`
* cannot watch inside workspace more than once
* do not send extension decriptor over
* adopt latest changes
* add `baseUri` to relative pattern
* backwards compat
* Allow extensions to be able to make requests to the typescript extension's tsserver via the command system
* Adds allowlisting the commands
Co-authored-by: Matt Bierner <matb@microsoft.com>
To handle JS/TS diagnostics, we currently use the language mode of an open text document. This should always be correct, but also causes us to open text documents that we don't need to
This change instead tries using the file extension first before falling back to use the text document. Using the file extension is not strictly correct since users can setup weird file associations, but should be ok for the vast majority of use cases
Investigated as part of #101885
Fixes#132121
We don't track project loading state properly when project wide diagnostics are enable. Just disable it for now since this is an experimental feature
If we're on a host that supports semantic checking, but in a file that doesn't support semantic errors, we currently don't want to report semantic errors since these will likely complain about imports and other undefined symols
Fixes#129134
The document may change between the request and when `ensureConfigurationForDocument` completes
I think this should fix the shifting around
* Add ts server for inline hints
* Add some feature related configure
* Add more config
* Rename all options
* Support range
* use new interface
* Fix cr issues
* Update inlay hints for ts plugin
* Avoid call chain hints
* Avoid more option
* Update protos
* Update extensions/typescript-language-features/package.nls.json
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Use suppress for some option
* Update CR issues
* Fix missing typedef
* Avoid changes
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* add notification if tsserver logs are left on for more than 7 days fix#123493
* extended tsserver logging notification updates
* cleanup excess new lines
* typescript loglevelmonitor cleanup
* remove todo