Skip to content

Commit a306b1a

Browse files
authored
deprecate changeKindToFunction
feat: deprecate `changeKindToFunction` in favor of `methodSnippetsInsertText` (#149)
1 parent eee4699 commit a306b1a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/configurationType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ export type Configuration = {
562562
'experiments.excludeNonJsxCompletions': boolean
563563
/**
564564
* Wether to change function completions to function kind
565+
* @deprecated Use `methodSnippetsInsertText` instead
565566
* @default false
566567
*/
567568
'experiments.changeKindToFunction': boolean

typescript/src/completions/functionCompletions.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export default (entries: ts.CompletionEntry[]) => {
88

99
const methodSnippetInsertTextMode = c('methodSnippetsInsertText')
1010
const nextChar = sourceFile.getFullText().slice(position, position + 1)
11-
const enableResolvingInsertText = !['(', '.', '`'].includes(nextChar) && c('enableMethodSnippets') && methodSnippetInsertTextMode !== 'disable'
11+
const isMethodSnippetInsertTextModeEnabled = methodSnippetInsertTextMode !== 'disable'
12+
13+
const enableResolvingInsertText = !['(', '.', '`'].includes(nextChar) && c('enableMethodSnippets') && isMethodSnippetInsertTextModeEnabled
14+
1215
const changeKindToFunction = c('experiments.changeKindToFunction')
1316

1417
if (!enableResolvingInsertText && !changeKindToFunction) return
@@ -49,7 +52,7 @@ export default (entries: ts.CompletionEntry[]) => {
4952
detail: `(${methodSnippet.join(', ')})`,
5053
description: ts.displayPartsToString(entry.sourceDisplay),
5154
},
52-
kind: changeKindToFunction ? ts.ScriptElementKind.functionElement : entry.kind,
55+
kind: ts.ScriptElementKind.functionElement,
5356
isSnippet: true,
5457
}
5558
}

0 commit comments

Comments
 (0)