From fd1cec60013fdb639d38582b95d3ac0e872e186b Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Thu, 13 Jul 2023 20:39:20 +0300 Subject: [PATCH 1/3] fix: should not disable `disableMethodSnippets.functionArguments` by default --- src/configurationType.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/configurationType.ts b/src/configurationType.ts index 1354c93e..5811a84d 100644 --- a/src/configurationType.ts +++ b/src/configurationType.ts @@ -441,8 +441,8 @@ export type Configuration = { */ 'disableMethodSnippets.jsxAttributes': boolean /** - * disable method snippets at function arguments - * @default true + * Wether to disable method snippets in function arguments + * @default false */ 'disableMethodSnippets.functionArguments': boolean /** From 5c9ff75d3a8556122610e728d536a44daaf2496f Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Thu, 13 Jul 2023 20:50:30 +0300 Subject: [PATCH 2/3] fix(locality-bonus): plugins completions don't display when TS returned no completions --- typescript/src/completionsAtPosition.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/typescript/src/completionsAtPosition.ts b/typescript/src/completionsAtPosition.ts index 7b47c3e0..da69554e 100644 --- a/typescript/src/completionsAtPosition.ts +++ b/typescript/src/completionsAtPosition.ts @@ -91,8 +91,12 @@ export const getCompletionsAtPosition = ( } } let prior = getPrior() + // todo rethink its usage and maybe always prefill instead const ensurePrior = () => { - if (!prior) prior = { entries: [], isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false } + if (!prior) { + prior = { entries: [], isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false } + ;(sharedCompletionContext.prior as typeof prior) = prior + } return true } const hasSuggestions = prior?.entries.some(({ kind }) => kind !== ts.ScriptElementKind.warning) From 8410ab3b21f1064210242c82ec2ce49722ceb756 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Thu, 13 Jul 2023 20:52:39 +0300 Subject: [PATCH 3/3] feat: Enable `suggestions.displayImportedInfo` to `short-format` by default --- src/configurationType.ts | 5 ++--- typescript/src/completions/displayImportedInfo.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/configurationType.ts b/src/configurationType.ts index 5811a84d..d281fba1 100644 --- a/src/configurationType.ts +++ b/src/configurationType.ts @@ -115,10 +115,9 @@ export type Configuration = { */ 'suggestions.keywordsInsertText': 'none' | 'space' /** - * Will be `format-short` by default in future as super useful! - * Requires TypeScript 5.0+ + * Wether to show module name from which completion comes (inserted at start of completion detail) * @recommended - * @default disable + * @default short-format */ 'suggestions.displayImportedInfo': 'disable' | 'short-format' | 'long-format' /** diff --git a/typescript/src/completions/displayImportedInfo.ts b/typescript/src/completions/displayImportedInfo.ts index 6a74c4b2..b370067b 100644 --- a/typescript/src/completions/displayImportedInfo.ts +++ b/typescript/src/completions/displayImportedInfo.ts @@ -9,7 +9,7 @@ export default (entries: ts.CompletionEntry[]) => { for (const entry of entries) { const { symbol } = entry if (!symbol) continue - const [node] = symbol.getDeclarations() ?? [] + const [node] = symbol.declarations ?? [] if (!node) continue let importDeclaration: ts.ImportDeclaration | undefined if (ts.isImportSpecifier(node) && ts.isNamedImports(node.parent) && ts.isImportDeclaration(node.parent.parent.parent)) {