diff --git a/package.json b/package.json index 6e450086d..438c5c68b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "lint": "prettier --check ." }, "dependencies": { - "typescript": "^5.5.2" + "typescript": "^5.6.3" }, "devDependencies": { "cross-env": "^7.0.2", diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 756faa539..8206c67d0 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -62,8 +62,8 @@ "prettier-plugin-svelte": "^3.2.6", "svelte": "^4.2.19", "svelte2tsx": "workspace:~", - "typescript": "^5.5.2", - "typescript-auto-import-cache": "^0.3.3", + "typescript": "^5.6.3", + "typescript-auto-import-cache": "^0.3.5", "vscode-css-languageservice": "~6.3.0", "vscode-html-languageservice": "~5.3.0", "vscode-languageserver": "9.0.1", diff --git a/packages/language-server/src/ls-config.ts b/packages/language-server/src/ls-config.ts index 63389e7bb..3f5469940 100644 --- a/packages/language-server/src/ls-config.ts +++ b/packages/language-server/src/ls-config.ts @@ -221,6 +221,20 @@ export interface TsUserPreferencesConfig { includePackageJsonAutoImports?: ts.UserPreferences['includePackageJsonAutoImports']; preferTypeOnlyAutoImports?: ts.UserPreferences['preferTypeOnlyAutoImports']; + + autoImportSpecifierExcludeRegexes?: string[]; + + organizeImports?: TsOrganizeImportPreferencesConfig; +} + +interface TsOrganizeImportPreferencesConfig { + accentCollation: ts.UserPreferences['organizeImportsAccentCollation']; + caseFirst: ts.UserPreferences['organizeImportsCaseFirst'] | 'default'; + caseSensitivity: ts.UserPreferences['organizeImportsIgnoreCase']; + collation: ts.UserPreferences['organizeImportsCollation']; + locale: ts.UserPreferences['organizeImportsLocale']; + numericCollation: ts.UserPreferences['organizeImportsNumericCollation']; + typeOrder: ts.UserPreferences['organizeImportsTypeOrder'] | 'auto'; } /** @@ -473,11 +487,34 @@ export class LSConfigManager { includeInlayPropertyDeclarationTypeHints: inlayHints?.propertyDeclarationTypes?.enabled, includeInlayVariableTypeHintsWhenTypeMatchesName: inlayHints?.variableTypes?.suppressWhenTypeMatchesName === false, - - interactiveInlayHints: true + interactiveInlayHints: true, + + autoImportSpecifierExcludeRegexes: + config.preferences?.autoImportSpecifierExcludeRegexes, + + organizeImportsAccentCollation: config.preferences?.organizeImports?.accentCollation, + organizeImportsCollation: config.preferences?.organizeImports?.collation, + organizeImportsCaseFirst: this.withDefaultAsUndefined( + config.preferences?.organizeImports?.caseFirst, + 'default' + ), + organizeImportsIgnoreCase: this.withDefaultAsUndefined( + config.preferences?.organizeImports?.caseSensitivity, + 'auto' + ), + organizeImportsLocale: config.preferences?.organizeImports?.locale, + organizeImportsNumericCollation: config.preferences?.organizeImports?.numericCollation, + organizeImportsTypeOrder: this.withDefaultAsUndefined( + config.preferences?.organizeImports?.typeOrder, + 'auto' + ) }; } + private withDefaultAsUndefined<T, O extends T>(value: T, def: O): Exclude<T, O> | undefined { + return value === def ? undefined : (value as Exclude<T, O>); + } + getTsUserPreferences( lang: TsUserConfigLang, normalizedWorkspacePath: string | null diff --git a/packages/language-server/src/plugins/PluginHost.ts b/packages/language-server/src/plugins/PluginHost.ts index a4783a6a1..bbb3eac46 100644 --- a/packages/language-server/src/plugins/PluginHost.ts +++ b/packages/language-server/src/plugins/PluginHost.ts @@ -171,6 +171,22 @@ export class PluginHost implements LSProvider, OnWatchFileChanges { }); } + let itemDefaults: CompletionList['itemDefaults']; + if (completions.length === 1) { + itemDefaults = completions[0]?.result.itemDefaults; + } else { + // don't apply items default to the result of other plugins + for (const completion of completions) { + const itemDefaults = completion.result.itemDefaults; + if (!itemDefaults) { + continue; + } + completion.result.items.forEach((item) => { + item.commitCharacters ??= itemDefaults.commitCharacters; + }); + } + } + let flattenedCompletions = flatten( completions.map((completion) => completion.result.items) ); @@ -194,7 +210,10 @@ export class PluginHost implements LSProvider, OnWatchFileChanges { ); } - return CompletionList.create(flattenedCompletions, isIncomplete); + const result = CompletionList.create(flattenedCompletions, isIncomplete); + result.itemDefaults = itemDefaults; + + return result; } async resolveCompletion( diff --git a/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts b/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts index e7b5bec75..f620db97e 100644 --- a/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts +++ b/packages/language-server/src/plugins/typescript/features/CompletionProvider.ts @@ -66,6 +66,12 @@ type LastCompletion = { completionList: AppCompletionList<CompletionResolveInfo> | null; }; +interface CommitCharactersOptions { + checkCommitCharacters: boolean; + defaultCommitCharacters?: string[]; + isNewIdentifierLocation?: boolean; +} + export class CompletionsProviderImpl implements CompletionsProvider<CompletionResolveInfo> { constructor( private readonly lsAndTsDocResolver: LSAndTSDocResolver, @@ -237,10 +243,8 @@ export class CompletionsProviderImpl implements CompletionsProvider<CompletionRe }, formatSettings ); - const addCommitCharacters = - // replicating VS Code behavior https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/completions.ts - response?.isNewIdentifierLocation !== true && - (!tsDoc.parserError || isInScript(position, tsDoc)); + + const commitCharactersOptions = this.getCommitCharactersOptions(response, tsDoc, position); let completions = response?.entries || []; const customCompletions = eventAndSlotLetCompletions.concat(tagCompletions ?? []); @@ -289,7 +293,7 @@ export class CompletionsProviderImpl implements CompletionsProvider<CompletionRe fileUrl, position, isCompletionInTag, - addCommitCharacters, + commitCharactersOptions, asStore, existingImports ); @@ -376,6 +380,27 @@ export class CompletionsProviderImpl implements CompletionsProvider<CompletionRe } const completionList = CompletionList.create(completionItems, !!tsDoc.parserError); + if ( + commitCharactersOptions.checkCommitCharacters && + commitCharactersOptions.defaultCommitCharacters?.length + ) { + const clientSupportsItemsDefault = this.configManager + .getClientCapabilities() + ?.textDocument?.completion?.completionList?.itemDefaults?.includes( + 'commitCharacters' + ); + + if (clientSupportsItemsDefault) { + completionList.itemDefaults = { + commitCharacters: commitCharactersOptions.defaultCommitCharacters + }; + } else { + completionList.items.forEach((item) => { + item.commitCharacters ??= commitCharactersOptions.defaultCommitCharacters; + }); + } + } + this.lastCompletion = { key: document.getFilePath() || '', position, completionList }; return completionList; @@ -578,6 +603,7 @@ export class CompletionsProviderImpl implements CompletionsProvider<CompletionRe sortText: '-1', detail: info.name + ': ' + info.type, documentation: info.doc && { kind: MarkupKind.Markdown, value: info.doc }, + commitCharacters: [], textEdit: defaultTextEditRange ? TextEdit.replace(this.cloneRange(defaultTextEditRange), name) : undefined @@ -623,7 +649,7 @@ export class CompletionsProviderImpl implements CompletionsProvider<CompletionRe uri: string, position: Position, isCompletionInTag: boolean, - addCommitCharacters: boolean, + commitCharactersOptions: CommitCharactersOptions, asStore: boolean, existingImports: Set<string> ): AppCompletionItem<CompletionResolveInfo> | null { @@ -669,7 +695,7 @@ export class CompletionsProviderImpl implements CompletionsProvider<CompletionRe label, insertText, kind: scriptElementKindToCompletionItemKind(comp.kind), - commitCharacters: addCommitCharacters ? this.commitCharacters : undefined, + commitCharacters: this.getCommitCharacters(comp, commitCharactersOptions), // Make sure svelte component and runes take precedence sortText: isRunesCompletion || isSvelteComp ? '-1' : comp.sortText, preselect: isRunesCompletion || isSvelteComp ? true : comp.isRecommended, @@ -734,6 +760,60 @@ export class CompletionsProviderImpl implements CompletionsProvider<CompletionRe }; } + private getCommitCharactersOptions( + response: ts.CompletionInfo | undefined, + tsDoc: SvelteDocumentSnapshot, + position: Position + ): CommitCharactersOptions { + if ((!isInScript(position, tsDoc) && tsDoc.parserError) || !response) { + return { + checkCommitCharacters: false + }; + } + + const isNewIdentifierLocation = response.isNewIdentifierLocation; + let defaultCommitCharacters = response.defaultCommitCharacters; + if (!isNewIdentifierLocation) { + // This actually always exists although it's optional in the type, at least in ts 5.6, + // so our commit characters are mostly fallback for older ts versions + if (defaultCommitCharacters) { + // this is controlled by a vscode setting that isn't available in the ts server so it isn't added to the language service + defaultCommitCharacters?.push('('); + } else { + defaultCommitCharacters = this.commitCharacters; + } + } + + return { + checkCommitCharacters: true, + defaultCommitCharacters, + isNewIdentifierLocation + }; + } + + private getCommitCharacters(entry: ts.CompletionEntry, options: CommitCharactersOptions) { + // https://github.com/microsoft/vscode/blob/d012408e88ffabd6456c367df4d343654da2eb10/extensions/typescript-language-features/src/languageFeatures/completions.ts#L504 + if (!options.checkCommitCharacters) { + return undefined; + } + + const commitCharacters = entry.commitCharacters; + // Ambient JS word based suggestions + const skipCommitCharacters = + entry.kind === ts.ScriptElementKind.warning || + entry.kind === ts.ScriptElementKind.string; + + if (commitCharacters) { + if (!options.isNewIdentifierLocation && !skipCommitCharacters) { + return commitCharacters.concat('('); + } + + return commitCharacters; + } + + return skipCommitCharacters ? [] : undefined; + } + private isExistingSvelteComponentImport( snapshot: SvelteDocumentSnapshot, name: string, diff --git a/packages/language-server/test/plugins/typescript/features/CompletionProvider.test.ts b/packages/language-server/test/plugins/typescript/features/CompletionProvider.test.ts index 78ca8adaa..6523e3bfc 100644 --- a/packages/language-server/test/plugins/typescript/features/CompletionProvider.test.ts +++ b/packages/language-server/test/plugins/typescript/features/CompletionProvider.test.ts @@ -60,7 +60,7 @@ describe('CompletionProviderImpl', function () { uri: pathToUrl(filePath), text: ts.sys.readFile(filePath) || '' }); - return { completionProvider, document, docManager }; + return { completionProvider, document, docManager, lsConfigManager }; } it('provides completions', async () => { @@ -170,6 +170,34 @@ describe('CompletionProviderImpl', function () { }); } + it('provide completion with items default when supported', async () => { + const { completionProvider, document, lsConfigManager } = setup('completions.svelte'); + + lsConfigManager.updateClientCapabilities({ + textDocument: { + completion: { + completionList: { + itemDefaults: ['commitCharacters'] + } + } + } + }); + + const completions = await completionProvider.getCompletions( + document, + Position.create(0, 49), + { + triggerKind: CompletionTriggerKind.TriggerCharacter, + triggerCharacter: '.' + } + ); + + assert.deepStrictEqual(completions?.itemDefaults?.commitCharacters, ['.', ',', ';', '(']); + + const first = completions!.items[0]; + assert.strictEqual(first.commitCharacters, undefined); + }); + it('provides event completions', async () => { const { completionProvider, document } = setup('component-events-completion.svelte'); @@ -191,6 +219,7 @@ describe('CompletionProviderImpl', function () { assert.deepStrictEqual(eventCompletions, <CompletionItem[]>[ { + commitCharacters: [], detail: 'aa: CustomEvent<boolean>', documentation: '', label: 'on:aa', @@ -199,6 +228,7 @@ describe('CompletionProviderImpl', function () { textEdit: undefined }, { + commitCharacters: [], detail: 'ab: MouseEvent', documentation: { kind: 'markdown', @@ -210,6 +240,7 @@ describe('CompletionProviderImpl', function () { textEdit: undefined }, { + commitCharacters: [], detail: 'ac: any', documentation: '', label: 'on:ac', @@ -309,6 +340,7 @@ describe('CompletionProviderImpl', function () { assert.deepStrictEqual(eventCompletions, <CompletionItem[]>[ { + commitCharacters: [], detail: 'aa: CustomEvent<boolean>', documentation: '', label: 'on:aa', @@ -329,6 +361,7 @@ describe('CompletionProviderImpl', function () { } }, { + commitCharacters: [], detail: 'ab: MouseEvent', documentation: { kind: 'markdown', @@ -352,6 +385,7 @@ describe('CompletionProviderImpl', function () { } }, { + commitCharacters: [], detail: 'ac: any', documentation: '', label: 'on:ac', @@ -389,6 +423,7 @@ describe('CompletionProviderImpl', function () { assert.deepStrictEqual(eventCompletions, <CompletionItem[]>[ { + commitCharacters: [], detail: 'c: CustomEvent<boolean>', documentation: { kind: 'markdown', @@ -417,6 +452,7 @@ describe('CompletionProviderImpl', function () { assert.deepStrictEqual(eventCompletions, <CompletionItem[]>[ { + commitCharacters: [], detail: 'event1: CustomEvent<null>', documentation: '', label: 'on:event1', @@ -437,6 +473,7 @@ describe('CompletionProviderImpl', function () { } }, { + commitCharacters: [], detail: 'event2: CustomEvent<string>', documentation: { kind: 'markdown', @@ -477,6 +514,7 @@ describe('CompletionProviderImpl', function () { assert.deepStrictEqual(eventCompletions, <CompletionItem[]>[ { + commitCharacters: [], detail: 'event1: CustomEvent<string> | CustomEvent<number>', label: 'on:event1', sortText: '-1', @@ -1101,6 +1139,7 @@ describe('CompletionProviderImpl', function () { assert.deepStrictEqual(slotLetCompletions, <CompletionItem[]>[ { + commitCharacters: [], detail: 'let1: boolean', documentation: '', label: 'let:let1', @@ -1121,6 +1160,7 @@ describe('CompletionProviderImpl', function () { } }, { + commitCharacters: [], detail: 'let2: string', documentation: { kind: 'markdown', @@ -1290,7 +1330,7 @@ describe('CompletionProviderImpl', function () { insertText: undefined, insertTextFormat: undefined, labelDetails: undefined, - commitCharacters: ['.', ',', ';', '('], + commitCharacters: [], textEdit: { newText: '@hi', range: { diff --git a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_4.json b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_4.json index 8a8f1c669..21042eeb7 100644 --- a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_4.json +++ b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_4.json @@ -69,7 +69,7 @@ }, "severity": 1, "source": "ts", - "message": "Type 'Component' is not assignable to type 'OtherComponent'.", + "message": "Type 'Component' is not assignable to type 'OtherComponent'.\n Type '{ prop: boolean; }' is not assignable to type '{ prop: string; }'.\n Types of property 'prop' are incompatible.\n Type 'boolean' is not assignable to type 'string'.", "code": 2322, "tags": [] }, diff --git a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_5.json b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_5.json index 06c967066..486c1058a 100644 --- a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_5.json +++ b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/bind-this/expected_svelte_5.json @@ -69,7 +69,7 @@ }, "severity": 1, "source": "ts", - "message": "Type 'Component' is not assignable to type 'OtherComponent'.", + "message": "Type 'Component' is not assignable to type 'OtherComponent'.\n Type '{ prop: boolean; }' is not assignable to type '{ prop: string; }'.\n Types of property 'prop' are incompatible.\n Type 'boolean' is not assignable to type 'string'.", "code": 2322, "tags": [] }, diff --git a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expected_svelte_5.json b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expected_svelte_5.json index ba1364156..aaa50c91c 100644 --- a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expected_svelte_5.json +++ b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expected_svelte_5.json @@ -28,7 +28,7 @@ }, "severity": 1, "source": "ts", - "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent | Component<any, any, any> | null | undefined'.\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. ", + "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent | Component<any, any, any> | null | undefined'.\n Type 'typeof DoesntWork' is not assignable to type 'ConstructorOfATypedSvelteComponent'.\n Type 'DoesntWork' is missing the following properties from type 'ATypedSvelteComponent': $$prop_def, $$events_def, $$slot_def, $on\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. ", "code": 2345, "tags": [] }, @@ -39,7 +39,7 @@ }, "severity": 1, "source": "ts", - "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent | Component<any, any, any> | null | undefined'.\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. ", + "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent | Component<any, any, any> | null | undefined'.\n Type 'typeof DoesntWork' is not assignable to type 'ConstructorOfATypedSvelteComponent'.\n Type 'DoesntWork' is missing the following properties from type 'ATypedSvelteComponent': $$prop_def, $$events_def, $$slot_def, $on\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. ", "code": 2345, "tags": [] }, @@ -50,7 +50,7 @@ }, "severity": 1, "source": "ts", - "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent | Component<any, any, any> | null | undefined'.\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. ", + "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent | Component<any, any, any> | null | undefined'.\n Type 'typeof DoesntWork' is not assignable to type 'ConstructorOfATypedSvelteComponent'.\n Type 'DoesntWork' is missing the following properties from type 'ATypedSvelteComponent': $$prop_def, $$events_def, $$slot_def, $on\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. ", "code": 2345, "tags": [] } diff --git a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expectedv2.json b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expectedv2.json index d4983991d..e07ee0dc1 100644 --- a/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expectedv2.json +++ b/packages/language-server/test/plugins/typescript/features/diagnostics/fixtures/component-invalid/expectedv2.json @@ -28,7 +28,7 @@ }, "severity": 1, "source": "ts", - "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:\n import type { SvelteComponentTyped } from \"svelte\";\n class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}", + "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.\n Type 'DoesntWork' is missing the following properties from type 'ATypedSvelteComponent': $$prop_def, $$events_def, $$slot_def, $on\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:\n import type { SvelteComponentTyped } from \"svelte\";\n class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}", "code": 2345, "tags": [] }, @@ -39,7 +39,7 @@ }, "severity": 1, "source": "ts", - "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:\n import type { SvelteComponentTyped } from \"svelte\";\n class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}", + "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.\n Type 'DoesntWork' is missing the following properties from type 'ATypedSvelteComponent': $$prop_def, $$events_def, $$slot_def, $on\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:\n import type { SvelteComponentTyped } from \"svelte\";\n class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}", "code": 2345, "tags": [] }, @@ -50,7 +50,7 @@ }, "severity": 1, "source": "ts", - "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:\n import type { SvelteComponentTyped } from \"svelte\";\n class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}", + "message": "Argument of type 'typeof DoesntWork' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'.\n Type 'DoesntWork' is missing the following properties from type 'ATypedSvelteComponent': $$prop_def, $$events_def, $$slot_def, $on\n\nPossible causes:\n- You use the instance type of a component where you should use the constructor type\n- Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:\n import type { SvelteComponentTyped } from \"svelte\";\n class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}", "code": 2345, "tags": [] } diff --git a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json index 750e37c29..bedfb19dd 100644 --- a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json +++ b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json @@ -12,8 +12,8 @@ "value": "MouseEvent", "location": { "range": { - "start": { "line": 15860, "character": 10 }, - "end": { "line": 15860, "character": 20 } + "start": { "line": 15340, "character": 10 }, + "end": { "line": 15340, "character": 20 } }, "uri": "<node_modules>/typescript/lib/lib.dom.d.ts" } diff --git a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json index 07b3bf5b9..22ffb1aa7 100644 --- a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json +++ b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json @@ -6,8 +6,8 @@ "value": "MouseEvent", "location": { "range": { - "start": { "line": 15860, "character": 10 }, - "end": { "line": 15860, "character": 20 } + "start": { "line": 15340, "character": 10 }, + "end": { "line": 15340, "character": 20 } }, "uri": "<node_modules>/typescript/lib/lib.dom.d.ts" } @@ -21,8 +21,8 @@ "value": "EventTarget", "location": { "range": { - "start": { "line": 8318, "character": 10 }, - "end": { "line": 8318, "character": 21 } + "start": { "line": 8284, "character": 10 }, + "end": { "line": 8284, "character": 21 } }, "uri": "<node_modules>/typescript/lib/lib.dom.d.ts" } @@ -32,8 +32,8 @@ "value": "HTMLButtonElement", "location": { "range": { - "start": { "line": 9810, "character": 10 }, - "end": { "line": 9810, "character": 27 } + "start": { "line": 9721, "character": 10 }, + "end": { "line": 9721, "character": 27 } }, "uri": "<node_modules>/typescript/lib/lib.dom.d.ts" } diff --git a/packages/language-server/test/plugins/typescript/features/preferences.test.ts b/packages/language-server/test/plugins/typescript/features/preferences.test.ts index b4c35f187..c6cac31d9 100644 --- a/packages/language-server/test/plugins/typescript/features/preferences.test.ts +++ b/packages/language-server/test/plugins/typescript/features/preferences.test.ts @@ -80,7 +80,8 @@ describe('ts user preferences', function () { importModuleSpecifier: 'non-relative', importModuleSpecifierEnding: undefined, quoteStyle: 'single', - includePackageJsonAutoImports: undefined + includePackageJsonAutoImports: undefined, + organizeImports: undefined }; } diff --git a/packages/svelte-check/package.json b/packages/svelte-check/package.json index b49d294a2..8cf77806e 100644 --- a/packages/svelte-check/package.json +++ b/packages/svelte-check/package.json @@ -54,7 +54,7 @@ "rollup-plugin-copy": "^3.4.0", "svelte": "^4.2.19", "svelte-language-server": "workspace:*", - "typescript": "^5.5.2", + "typescript": "^5.6.3", "vscode-languageserver": "8.0.2", "vscode-languageserver-protocol": "3.17.2", "vscode-languageserver-types": "3.17.2", diff --git a/packages/svelte-vscode/package.json b/packages/svelte-vscode/package.json index 12260c440..6bfd184c1 100644 --- a/packages/svelte-vscode/package.json +++ b/packages/svelte-vscode/package.json @@ -726,7 +726,7 @@ "@types/vscode": "^1.67", "js-yaml": "^3.14.0", "tslib": "^2.4.0", - "typescript": "^5.5.2", + "typescript": "^5.6.3", "vscode-tmgrammar-test": "^0.0.11" }, "dependencies": { diff --git a/packages/svelte2tsx/package.json b/packages/svelte2tsx/package.json index 258f5397e..7cf2706ef 100644 --- a/packages/svelte2tsx/package.json +++ b/packages/svelte2tsx/package.json @@ -40,7 +40,7 @@ "svelte": "~4.2.19", "tiny-glob": "^0.2.6", "tslib": "^2.4.0", - "typescript": "^5.5.2" + "typescript": "^5.6.3" }, "peerDependencies": { "svelte": "^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0", diff --git a/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts b/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts index 8184da952..225dd9a60 100644 --- a/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts +++ b/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts @@ -550,9 +550,9 @@ export class ExportedNames { * Adds export to map */ private addExport( - name: ts.Identifier, + name: ts.ModuleExportName, isLet: boolean, - target: ts.Identifier = null, + target: ts.ModuleExportName = null, type: ts.TypeNode = null, required = false, isNamedExport = false @@ -601,7 +601,7 @@ export class ExportedNames { }); } - private getDoc(target: ts.BindingName) { + private getDoc(target: ts.BindingName | ts.ModuleExportName) { let doc = undefined; // Traverse `a` one up. If the declaration is part of a declaration list, // the comment is at this point already diff --git a/packages/typescript-plugin/package.json b/packages/typescript-plugin/package.json index ebf00ea10..b3e934521 100644 --- a/packages/typescript-plugin/package.json +++ b/packages/typescript-plugin/package.json @@ -24,7 +24,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^18.0.0", - "typescript": "^5.5.2", + "typescript": "^5.6.3", "svelte": "^4.2.19" }, "dependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e234ca0f5..0852a1bb4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: typescript: - specifier: ^5.5.2 - version: 5.5.2 + specifier: ^5.6.3 + version: 5.6.3 devDependencies: cross-env: specifier: ^7.0.2 @@ -20,7 +20,7 @@ importers: version: 3.3.3 ts-node: specifier: ^10.0.0 - version: 10.9.1(@types/node@18.19.46)(typescript@5.5.2) + version: 10.9.1(@types/node@18.19.46)(typescript@5.6.3) packages/language-server: dependencies: @@ -55,11 +55,11 @@ importers: specifier: workspace:~ version: link:../svelte2tsx typescript: - specifier: ^5.5.2 - version: 5.5.2 + specifier: ^5.6.3 + version: 5.6.3 typescript-auto-import-cache: - specifier: ^0.3.3 - version: 0.3.3 + specifier: ^0.3.5 + version: 0.3.5 vscode-css-languageservice: specifier: ~6.3.0 version: 6.3.0 @@ -111,7 +111,7 @@ importers: version: 11.1.2 ts-node: specifier: ^10.0.0 - version: 10.9.1(@types/node@18.19.46)(typescript@5.5.2) + version: 10.9.1(@types/node@18.19.46)(typescript@5.6.3) packages/svelte-check: dependencies: @@ -145,7 +145,7 @@ importers: version: 5.0.2(rollup@3.7.5) '@rollup/plugin-typescript': specifier: ^10.0.0 - version: 10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.5.2) + version: 10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.6.3) '@types/sade': specifier: ^1.7.2 version: 1.7.4 @@ -168,8 +168,8 @@ importers: specifier: workspace:* version: link:../language-server typescript: - specifier: ^5.5.2 - version: 5.5.2 + specifier: ^5.6.3 + version: 5.6.3 vscode-languageserver: specifier: 8.0.2 version: 8.0.2 @@ -217,8 +217,8 @@ importers: specifier: ^2.4.0 version: 2.5.2 typescript: - specifier: ^5.5.2 - version: 5.5.2 + specifier: ^5.6.3 + version: 5.6.3 vscode-tmgrammar-test: specifier: ^0.0.11 version: 0.0.11 @@ -249,7 +249,7 @@ importers: version: 15.0.2(rollup@3.7.5) '@rollup/plugin-typescript': specifier: ^10.0.0 - version: 10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.5.2) + version: 10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.6.3) '@types/estree': specifier: ^0.0.42 version: 0.0.42 @@ -299,8 +299,8 @@ importers: specifier: ^2.4.0 version: 2.5.2 typescript: - specifier: ^5.5.2 - version: 5.5.2 + specifier: ^5.6.3 + version: 5.6.3 packages/typescript-plugin: dependencies: @@ -318,8 +318,8 @@ importers: specifier: ^4.2.19 version: 4.2.19 typescript: - specifier: ^5.5.2 - version: 5.5.2 + specifier: ^5.6.3 + version: 5.6.3 packages: @@ -1278,11 +1278,11 @@ packages: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} - typescript-auto-import-cache@0.3.3: - resolution: {integrity: sha512-ojEC7+Ci1ij9eE6hp8Jl9VUNnsEKzztktP5gtYNRMrTmfXVwA1PITYYAkpxCvvupdSYa/Re51B6KMcv1CTZEUA==} + typescript-auto-import-cache@0.3.5: + resolution: {integrity: sha512-fAIveQKsoYj55CozUiBoj4b/7WpN0i4o74wiGY5JVUEoD0XiqDk1tJqTEjgzL2/AizKQrXxyRosSebyDzBZKjw==} - typescript@5.5.2: - resolution: {integrity: sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==} + typescript@5.6.3: + resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} engines: {node: '>=14.17'} hasBin: true @@ -1496,11 +1496,11 @@ snapshots: optionalDependencies: rollup: 3.7.5 - '@rollup/plugin-typescript@10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.5.2)': + '@rollup/plugin-typescript@10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.6.3)': dependencies: '@rollup/pluginutils': 5.0.2(rollup@3.7.5) resolve: 1.22.2 - typescript: 5.5.2 + typescript: 5.6.3 optionalDependencies: rollup: 3.7.5 tslib: 2.5.2 @@ -2329,7 +2329,7 @@ snapshots: dependencies: is-number: 7.0.0 - ts-node@10.9.1(@types/node@18.19.46)(typescript@5.5.2): + ts-node@10.9.1(@types/node@18.19.46)(typescript@5.6.3): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.9 @@ -2343,7 +2343,7 @@ snapshots: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.5.2 + typescript: 5.6.3 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 @@ -2351,11 +2351,11 @@ snapshots: type-detect@4.0.8: {} - typescript-auto-import-cache@0.3.3: + typescript-auto-import-cache@0.3.5: dependencies: semver: 7.5.1 - typescript@5.5.2: {} + typescript@5.6.3: {} undici-types@5.26.5: {}