From b67eb348d45bc77869f4e543928678d44d3786f1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2024 13:44:02 +0800 Subject: [PATCH] fix(deps): update packages/service/vscode digest to 05f13ec (#207) * fix(deps): update packages/service/vscode digest to 05f13ec * build: no timeout on conflict resolve * update --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: yioneko --- .../patches/010-editor-format-options.patch | 65 +++++++------------ .../015-disable-bufsync-tab-resource.patch | 2 +- ...20-trigger-features-registered-event.patch | 6 +- ...110-fix-file-references-command-name.patch | 4 +- .../120-fix-tsserver-error-uncaught.patch | 4 +- .../patches/180-auto-use-workspace-tsdk.patch | 4 +- .../280-move-to-file-refactor-action.patch | 4 +- .../patches/410-handle-yarn-zipfile.patch | 22 +++---- .../service/patches/450-fix-tsc-err.patch | 32 +++++++++ packages/service/scripts/genConfigSchema.js | 5 +- packages/service/scripts/patch.js | 17 +++-- packages/service/src/service/pkgJson.ts | 3 +- packages/service/src/shims/types.ts | 17 +++++ packages/service/tsconfig.json | 1 + packages/service/vscode | 2 +- tsconfig.json | 2 +- 16 files changed, 115 insertions(+), 75 deletions(-) diff --git a/packages/service/patches/010-editor-format-options.patch b/packages/service/patches/010-editor-format-options.patch index 3043dade..b7ef78ad 100644 --- a/packages/service/patches/010-editor-format-options.patch +++ b/packages/service/patches/010-editor-format-options.patch @@ -1,47 +1,29 @@ diff --git a/src/languageFeatures/fileConfigurationManager.ts b/src/languageFeatures/fileConfigurationManager.ts -index 0b5a4c6..6b0b762 100644 +index 9b0c10a..f5578f2 100644 --- a/src/languageFeatures/fileConfigurationManager.ts +++ b/src/languageFeatures/fileConfigurationManager.ts -@@ -46,26 +46,27 @@ export default class FileConfigurationManager extends Disposable { +@@ -52,10 +52,7 @@ export default class FileConfigurationManager extends Disposable { + document: vscode.TextDocument, token: vscode.CancellationToken ): Promise { - const formattingOptions = this.getFormattingOptions(document); +- const formattingOptions = this.getFormattingOptions(document); - if (formattingOptions) { -+ // if (formattingOptions) { - return this.ensureConfigurationOptions(document, formattingOptions, token); +- return this.ensureConfigurationOptions(document, formattingOptions, token); - } -+ // } ++ return this.ensureConfigurationOptions(document, undefined, token); } - private getFormattingOptions( - document: vscode.TextDocument -- ): vscode.FormattingOptions | undefined { -- const editor = vscode.window.visibleTextEditors.find(editor => editor.document.fileName === document.fileName); -- return editor -- ? { -- tabSize: editor.options.tabSize, -- insertSpaces: editor.options.insertSpaces -- } as vscode.FormattingOptions -- : undefined; -+ ): undefined { -+ // const editor = vscode.window.visibleTextEditors.find(editor => editor.document.fileName === document.fileName); -+ // return editor -+ // ? { -+ // tabSize: editor.options.tabSize, -+ // insertSpaces: editor.options.insertSpaces -+ // } as vscode.FormattingOptions -+ // : undefined; -+ return; - } + private getFormattingOptions(document: vscode.TextDocument): FormattingOptions | undefined { +@@ -72,7 +69,7 @@ export default class FileConfigurationManager extends Disposable { public async ensureConfigurationOptions( document: vscode.TextDocument, -- options: vscode.FormattingOptions, -+ options: vscode.FormattingOptions | undefined, +- options: FormattingOptions, ++ options: FormattingOptions | undefined, token: vscode.CancellationToken ): Promise { const file = this.client.toOpenTsFilePath(document); -@@ -104,14 +105,14 @@ export default class FileConfigurationManager extends Disposable { +@@ -111,14 +108,9 @@ export default class FileConfigurationManager extends Disposable { document: vscode.TextDocument, token: vscode.CancellationToken, ): Promise { @@ -49,11 +31,7 @@ index 0b5a4c6..6b0b762 100644 - if (!formattingOptions) { - return; - } -+ // const formattingOptions = this.getFormattingOptions(document); -+ // if (!formattingOptions) { -+ // return; -+ // } - +- const args: Proto.ConfigureRequestArguments = { file: undefined /*global*/, - ...this.getFileOptions(document, formattingOptions), @@ -61,28 +39,29 @@ index 0b5a4c6..6b0b762 100644 }; await this.client.execute('configure', args, token); } -@@ -122,7 +123,7 @@ export default class FileConfigurationManager extends Disposable { +@@ -129,7 +121,7 @@ export default class FileConfigurationManager extends Disposable { private getFileOptions( document: vscode.TextDocument, -- options: vscode.FormattingOptions -+ options?: vscode.FormattingOptions, +- options: FormattingOptions ++ options?: FormattingOptions ): FileConfiguration { return { formatOptions: this.getFormatOptions(document, options), -@@ -132,18 +133,24 @@ export default class FileConfigurationManager extends Disposable { +@@ -139,18 +131,25 @@ export default class FileConfigurationManager extends Disposable { private getFormatOptions( document: vscode.TextDocument, -- options: vscode.FormattingOptions -+ options: vscode.FormattingOptions | undefined +- options: FormattingOptions ++ options?: FormattingOptions ): Proto.FormatCodeSettings { const config = vscode.workspace.getConfiguration( isTypeScriptDocument(document) ? 'typescript.format' : 'javascript.format', document.uri); + const tsEditorConfig = vscode.workspace.getConfiguration( -+ isTypeScriptDocument(document) ? 'vtsls.typescript.format' : 'vtsls.javascript.format', -+ document.uri); ++ isTypeScriptDocument(document) ? "vtsls.typescript.format" : "vtsls.javascript.format", ++ document.uri ++ ); return { - tabSize: options.tabSize, @@ -96,7 +75,7 @@ index 0b5a4c6..6b0b762 100644 + convertTabsToSpaces: options?.insertSpaces ?? tsEditorConfig.get("convertTabsToSpaces"), // We can use \n here since the editor normalizes later on to its line endings. - newLineCharacter: '\n', -+ newLineCharacter: tsEditorConfig.get("newLineCharacter") ?? '\n', ++ newLineCharacter: tsEditorConfig.get("newLineCharacter") ?? '\n', insertSpaceAfterCommaDelimiter: config.get('insertSpaceAfterCommaDelimiter'), insertSpaceAfterConstructor: config.get('insertSpaceAfterConstructor'), insertSpaceAfterSemicolonInForStatements: config.get('insertSpaceAfterSemicolonInForStatements'), diff --git a/packages/service/patches/015-disable-bufsync-tab-resource.patch b/packages/service/patches/015-disable-bufsync-tab-resource.patch index 83ef8e18..e0306c8c 100644 --- a/packages/service/patches/015-disable-bufsync-tab-resource.patch +++ b/packages/service/patches/015-disable-bufsync-tab-resource.patch @@ -1,5 +1,5 @@ diff --git a/src/tsServer/bufferSyncSupport.ts b/src/tsServer/bufferSyncSupport.ts -index 356c170..20db569 100644 +index 56d2896..73aa59f 100644 --- a/src/tsServer/bufferSyncSupport.ts +++ b/src/tsServer/bufferSyncSupport.ts @@ -756,10 +756,6 @@ export default class BufferSyncSupport extends Disposable { diff --git a/packages/service/patches/020-trigger-features-registered-event.patch b/packages/service/patches/020-trigger-features-registered-event.patch index aada5f65..7ca3b67d 100644 --- a/packages/service/patches/020-trigger-features-registered-event.patch +++ b/packages/service/patches/020-trigger-features-registered-event.patch @@ -1,10 +1,10 @@ diff --git a/src/languageProvider.ts b/src/languageProvider.ts -index 7b95591..eb8fe90 100644 +index 09a4fe3..3c9d29b 100644 --- a/src/languageProvider.ts +++ b/src/languageProvider.ts -@@ -92,6 +92,7 @@ export default class LanguageProvider extends Disposable { - import('./languageFeatures/tagClosing').then(provider => this._register(provider.register(selector, this.description, this.client))), +@@ -93,6 +93,7 @@ export default class LanguageProvider extends Disposable { import('./languageFeatures/typeDefinitions').then(provider => this._register(provider.register(selector, this.client))), + import('./languageFeatures/copilotRelated').then(provider => this._register(provider.register(selector, this.client))), ]); + (vscode.languages as any).$triggerStaticFeaturesRegistered(); } diff --git a/packages/service/patches/110-fix-file-references-command-name.patch b/packages/service/patches/110-fix-file-references-command-name.patch index 1e31d18f..f9c0f1c8 100644 --- a/packages/service/patches/110-fix-file-references-command-name.patch +++ b/packages/service/patches/110-fix-file-references-command-name.patch @@ -1,8 +1,8 @@ diff --git a/package.json b/package.json -index 92a36e5..5278491 100644 +index c6363df..634a567 100644 --- a/package.json +++ b/package.json -@@ -67,7 +67,7 @@ +@@ -68,7 +68,7 @@ "onCommand:typescript.tsserverRequest", "onCommand:_typescript.configurePlugin", "onCommand:_typescript.learnMoreAboutRefactorings", diff --git a/packages/service/patches/120-fix-tsserver-error-uncaught.patch b/packages/service/patches/120-fix-tsserver-error-uncaught.patch index db77b8bb..14fbe06f 100644 --- a/packages/service/patches/120-fix-tsserver-error-uncaught.patch +++ b/packages/service/patches/120-fix-tsserver-error-uncaught.patch @@ -1,8 +1,8 @@ diff --git a/src/typescriptServiceClient.ts b/src/typescriptServiceClient.ts -index a1f06a3..41d3419 100644 +index b5fdb18..d196d68 100644 --- a/src/typescriptServiceClient.ts +++ b/src/typescriptServiceClient.ts -@@ -881,7 +881,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType +@@ -877,7 +877,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType expectsResult: true, ...config, }); diff --git a/packages/service/patches/180-auto-use-workspace-tsdk.patch b/packages/service/patches/180-auto-use-workspace-tsdk.patch index 3f02fe7e..2a7cbbcd 100644 --- a/packages/service/patches/180-auto-use-workspace-tsdk.patch +++ b/packages/service/patches/180-auto-use-workspace-tsdk.patch @@ -1,5 +1,5 @@ diff --git a/src/configuration/configuration.ts b/src/configuration/configuration.ts -index d70b8f7..7cf087f 100644 +index 693e7ad..2d969a6 100644 --- a/src/configuration/configuration.ts +++ b/src/configuration/configuration.ts @@ -101,6 +101,7 @@ export class ImplicitProjectConfiguration { @@ -10,7 +10,7 @@ index d70b8f7..7cf087f 100644 readonly locale: string | null; readonly globalTsdk: string | null; readonly localTsdk: string | null; -@@ -140,6 +141,7 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu +@@ -144,6 +145,7 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu public loadFromWorkspace(): TypeScriptServiceConfiguration { const configuration = vscode.workspace.getConfiguration(); return { diff --git a/packages/service/patches/280-move-to-file-refactor-action.patch b/packages/service/patches/280-move-to-file-refactor-action.patch index e7963b7a..6138127c 100644 --- a/packages/service/patches/280-move-to-file-refactor-action.patch +++ b/packages/service/patches/280-move-to-file-refactor-action.patch @@ -1,5 +1,5 @@ diff --git a/src/commands/tsserverRequests.ts b/src/commands/tsserverRequests.ts -index ba545df..b5c020d 100644 +index 50aeedf..96ab233 100644 --- a/src/commands/tsserverRequests.ts +++ b/src/commands/tsserverRequests.ts @@ -33,7 +33,8 @@ export class TSServerRequestCommand implements Command { @@ -11,7 +11,7 @@ index ba545df..b5c020d 100644 + 'getMoveToRefactoringFileSuggestions' ]; - if (!allowList.includes(requestID)) { return; } + if (allowList.includes(command) || command.startsWith('_')) { diff --git a/src/languageFeatures/refactor.ts b/src/languageFeatures/refactor.ts index 1317cda..3e28248 100644 --- a/src/languageFeatures/refactor.ts diff --git a/packages/service/patches/410-handle-yarn-zipfile.patch b/packages/service/patches/410-handle-yarn-zipfile.patch index 4ede1915..03ef3eb8 100644 --- a/packages/service/patches/410-handle-yarn-zipfile.patch +++ b/packages/service/patches/410-handle-yarn-zipfile.patch @@ -1,25 +1,25 @@ diff --git a/src/configuration/fileSchemes.ts b/src/configuration/fileSchemes.ts -index ca268e2..96c9f0b 100644 +index 9d54f0b..c77603c 100644 --- a/src/configuration/fileSchemes.ts +++ b/src/configuration/fileSchemes.ts -@@ -23,6 +23,7 @@ export const chatCodeBlock = 'vscode-chat-code-block'; +@@ -20,6 +20,7 @@ export const officeScript = 'office-script'; - /** Used for code blocks in chat by copilot. */ - export const chatBackingCodeBlock = 'vscode-copilot-chat-code-block'; + /** Used for code blocks in chat by vs code core */ + export const chatCodeBlock = 'vscode-chat-code-block'; +export const zipfile = 'zipfile'; export function getSemanticSupportedSchemes() { - if (isWeb() && vscode.workspace.workspaceFolders) { -@@ -36,6 +37,7 @@ export function getSemanticSupportedSchemes() { + const alwaysSupportedSchemes = [ +@@ -27,6 +28,7 @@ export function getSemanticSupportedSchemes() { + walkThroughSnippet, vscodeNotebookCell, chatCodeBlock, - chatBackingCodeBlock, + zipfile ]; - } + if (isWeb()) { diff --git a/src/typescriptServiceClient.ts b/src/typescriptServiceClient.ts -index 41d3419..6378806 100644 +index d196d68..40a1269 100644 --- a/src/typescriptServiceClient.ts +++ b/src/typescriptServiceClient.ts @@ -596,7 +596,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType @@ -31,7 +31,7 @@ index 41d3419..6378806 100644 preferences: { providePrefixAndSuffixTextForRename: true, allowRenameOfImportPath: true, -@@ -772,6 +772,10 @@ export default class TypeScriptServiceClient extends Disposable implements IType +@@ -768,6 +768,10 @@ export default class TypeScriptServiceClient extends Disposable implements IType return resource.fsPath; } @@ -42,7 +42,7 @@ index 41d3419..6378806 100644 return (this.isProjectWideIntellisenseOnWebEnabled() ? '' : inMemoryResourcePrefix) + '/' + resource.scheme + '/' + (resource.authority || emptyAuthority) -@@ -820,6 +824,17 @@ export default class TypeScriptServiceClient extends Disposable implements IType +@@ -816,6 +820,17 @@ export default class TypeScriptServiceClient extends Disposable implements IType return this.bufferSyncSupport.toVsCodeResource(resource); } } diff --git a/packages/service/patches/450-fix-tsc-err.patch b/packages/service/patches/450-fix-tsc-err.patch index 67d04489..bd2ef467 100644 --- a/packages/service/patches/450-fix-tsc-err.patch +++ b/packages/service/patches/450-fix-tsc-err.patch @@ -11,3 +11,35 @@ index 8fd7ce4..b1d24bc 100644 import VsCodeTelemetryReporter from '@vscode/extension-telemetry'; import * as vscode from 'vscode'; import * as tas from 'vscode-tas-client'; +diff --git a/src/languageFeatures/copilotRelated.ts b/src/languageFeatures/copilotRelated.ts +index 632b047..009d112 100644 +--- a/src/languageFeatures/copilotRelated.ts ++++ b/src/languageFeatures/copilotRelated.ts +@@ -70,10 +70,12 @@ export function register( + if (!file) { + return { entries: [] }; + } ++ // @ts-expect-error until ts 5.7 + const response = await client.execute('copilotRelated', { file, }, token) as Proto.CopilotRelatedResponse; + if (response.type !== 'response' || !response.body) { + return { entries: [] }; + } ++ // @ts-expect-error until ts 5.7 + return { entries: response.body.relatedFiles.map(f => client.toResource(f)), traits: [] }; + })); + } +diff --git a/src/typescriptService.ts b/src/typescriptService.ts +index 306769f..d432b63 100644 +--- a/src/typescriptService.ts ++++ b/src/typescriptService.ts +@@ -77,8 +77,10 @@ interface StandardTsServerRequests { + 'getMoveToRefactoringFileSuggestions': [Proto.GetMoveToRefactoringFileSuggestionsRequestArgs, Proto.GetMoveToRefactoringFileSuggestions]; + 'linkedEditingRange': [Proto.FileLocationRequestArgs, Proto.LinkedEditingRangeResponse]; + 'mapCode': [Proto.MapCodeRequestArgs, Proto.MapCodeResponse]; ++ // @ts-expect-error until ts 5.7 + 'copilotRelated': [Proto.FileRequestArgs, Proto.CopilotRelatedResponse]; + 'getPasteEdits': [Proto.GetPasteEditsRequestArgs, Proto.GetPasteEditsResponse]; ++ // @ts-expect-error until ts 5.7 + 'preparePasteEdits': [Proto.PreparePasteEditsRequestArgs, Proto.PreparePasteEditsResponse]; + } + diff --git a/packages/service/scripts/genConfigSchema.js b/packages/service/scripts/genConfigSchema.js index 6f0bd4c0..71abdb68 100644 --- a/packages/service/scripts/genConfigSchema.js +++ b/packages/service/scripts/genConfigSchema.js @@ -65,8 +65,9 @@ async function genSchema() { "typescript.surveys.enabled", "typescript.tsserver.enableRegionDiagnostics", "typescript.tsserver.experimental.useVsCodeWatcher", - "javascript.experimental.updateImportsOnPaste", - "typescript.experimental.updateImportsOnPaste", + "javascript.updateImportsOnPaste.enabled", + "typescript.updateImportsOnPaste.enabled", + "typescript.experimental.expandableHover", ]; for (const p of unavailableOptions) { diff --git a/packages/service/scripts/patch.js b/packages/service/scripts/patch.js index 2d01f3a6..382e4902 100644 --- a/packages/service/scripts/patch.js +++ b/packages/service/scripts/patch.js @@ -103,16 +103,25 @@ async function copyTsExtTo(targetDir) { await writePatchMark(targetDir, { sha, patched: false }); } -async function pressAnyKey() { +/** + * @param {number} timeout + */ +async function pressAnyKey(timeout) { stdin.setRawMode(true); /** * @type {Buffer} */ const buffer = await new Promise((resolve) => { - const timeout = setTimeout(() => resolve, 60 * 1000); // 60s + let timer; + if (timeout != 0) { + timer = setTimeout(() => resolve, timeout ?? 60 * 1000); // 60s + } + stdin.resume(); stdin.once("data", (buffer) => process.nextTick(() => { - clearTimeout(timeout); + if (timer) { + clearTimeout(timer); + } return resolve(buffer); }) ); @@ -215,7 +224,7 @@ async function applyPatches(refresh) { stdout.write( `Patch file ${p} failed, press any key when the conflict has been resolved...` ); - await pressAnyKey(); + await pressAnyKey(0); } const { stdout: newPatchContent } = await exec("git", ["diff", "-U"], { cwd: tsExtPath, diff --git a/packages/service/src/service/pkgJson.ts b/packages/service/src/service/pkgJson.ts index 05cc4e1e..8ebd2f00 100644 --- a/packages/service/src/service/pkgJson.ts +++ b/packages/service/src/service/pkgJson.ts @@ -22,6 +22,7 @@ function getDefaultConfig() { const overrideDefaults = { "typescript.tsserver.enableRegionDiagnostics": false, "typescript.tsserver.experimental.useVsCodeWatcher": false, + "typescript.tsserver.watchOptions": {}, }; const res: TSLanguageServiceConfig = {}; @@ -42,7 +43,7 @@ function getDefaultConfig() { for (const [key, val] of Object.entries(contributed)) { let defaultVal = "default" in val ? val.default : undefined; - if (!defaultVal) { + if (!defaultVal && "type" in val) { if (val.type === "string") { defaultVal = ""; } else if (val.type === "array") { diff --git a/packages/service/src/shims/types.ts b/packages/service/src/shims/types.ts index c58f9acd..f1a367df 100644 --- a/packages/service/src/shims/types.ts +++ b/packages/service/src/shims/types.ts @@ -1008,6 +1008,23 @@ export class Hover { } } +export class VerboseHover extends Hover { + + public canIncreaseVerbosity: boolean | undefined; + public canDecreaseVerbosity: boolean | undefined; + + constructor( + contents: vscode.MarkdownString | vscode.MarkedString | (vscode.MarkdownString | vscode.MarkedString)[], + range?: Range, + canIncreaseVerbosity?: boolean, + canDecreaseVerbosity?: boolean, + ) { + super(contents, range); + this.canIncreaseVerbosity = canIncreaseVerbosity; + this.canDecreaseVerbosity = canDecreaseVerbosity; + } +} + export enum DocumentHighlightKind { Text = 0, Read = 1, diff --git a/packages/service/tsconfig.json b/packages/service/tsconfig.json index 8015b0c5..4a7a1a85 100644 --- a/packages/service/tsconfig.json +++ b/packages/service/tsconfig.json @@ -12,6 +12,7 @@ "vscode/src/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts", "vscode/src/vscode-dts/vscode.proposed.codeActionAI.d.ts", "vscode/src/vscode-dts/vscode.proposed.codeActionRanges.d.ts", + "vscode/src/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts", "vscode/src/vscode-dts/vscode.proposed.documentPaste.d.ts", "vscode/src/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts", "vscode/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts", diff --git a/packages/service/vscode b/packages/service/vscode index 65d85f4c..05f13ecf 160000 --- a/packages/service/vscode +++ b/packages/service/vscode @@ -1 +1 @@ -Subproject commit 65d85f4cd0b4220fe8bb494898e001c7ad20e59b +Subproject commit 05f13ecf8a88f6d9b51b519ea602c3f6b20bb255 diff --git a/tsconfig.json b/tsconfig.json index 67b1ae42..c52708ac 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "ES6", "module": "ESNext", - "lib": ["ES2020"], + "lib": ["ES2020", "ES2021.Promise"], "moduleResolution": "node", "experimentalDecorators": true, "noImplicitAny": true,