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

feat: support typescript 5.6 #2545

Merged
merged 9 commits into from
Nov 5, 2024
Merged

Conversation

jasonlyu123
Copy link
Member

@jasonlyu123 jasonlyu123 commented Oct 25, 2024

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.

@jasonlyu123 jasonlyu123 marked this pull request as ready for review October 27, 2024 01:33
@@ -191,6 +219,7 @@ describe('CompletionProviderImpl', function () {

assert.deepStrictEqual(eventCompletions, <CompletionItem[]>[
{
commitCharacters: [],
Copy link
Member Author

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: [],
Copy link
Member Author

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') {}

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@dummdidumm dummdidumm merged commit 98f7229 into sveltejs:master Nov 5, 2024
3 checks passed
dummdidumm added a commit that referenced this pull request Nov 5, 2024
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
dummdidumm added a commit that referenced this pull request Nov 5, 2024
)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants