-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
feat: support typescript 5.6 #2545
Conversation
@@ -191,6 +219,7 @@ describe('CompletionProviderImpl', function () { | |||
|
|||
assert.deepStrictEqual(eventCompletions, <CompletionItem[]>[ | |||
{ | |||
commitCharacters: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty array and undefined should behave the same but won't be overridden by itemDefaults
@@ -1290,7 +1330,7 @@ describe('CompletionProviderImpl', function () { | |||
insertText: undefined, | |||
insertTextFormat: undefined, | |||
labelDetails: undefined, | |||
commitCharacters: ['.', ',', ';', '('], | |||
commitCharacters: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is returned by the TypeScript. The TypeScript PR mentioned it is to prevent something like this from triggering accepting completion suggestions. It was added to VSCode first and then migrated to TypeScript.
someFunction(`somting.`)
function someFunction(str: 'something.a', 'something.b') {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
Because Svelte components take precedence, we leave out commit characters to not auto complete in weird places (e.g. when you have `foo.filter(a => a)`) and get autocomplete for component A, then a commit character of `.` would auto import the component which is not what we want Found after merging #2545 and playing around with it a bit
) Because Svelte components take precedence, we leave out commit characters to not auto complete in weird places (e.g. when you have `foo.filter(a => a)`) and get autocomplete for component A, then a commit character of `.` would auto import the component which is not what we want Found after merging #2545 and playing around with it a bit
I bumped typescript-auto-import-cache for #2541, but there is no test for it. I am not really sure what the exact condition triggering this is, but the problem is that the caching implementation of typescript-auto-import-cache is out of sync with TypeScript 5.6. TypeScript added another parameter for some functions.
This adds support for Exclude Patterns for Auto-Imports and Granular Commit Characters. The commit characters should use the result from TypeScript when supported, The old one is slightly tweaked and serve as a fallback for older typescript version. This also utilizes the new itemDefaults in LSP 3.17 to reduce some serialization costs when supported. The idea is to reduce the duplicated stuff in completion-items so that communication between the client and server can save some serialization/parsing work.