Skip to content

Commit 94f26c5

Browse files
committed
fix: enable insert text method snippets and locality bonus on even more completions
1 parent 62b0822 commit 94f26c5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

typescript/src/completions/functionCompletions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default (entries: ts.CompletionEntry[]) => {
3333
}
3434
if (methodSnippetInsertTextMode === 'only-local' && entry.source) return
3535
if (!symbol) return
36-
const { valueDeclaration } = symbol
36+
const { valueDeclaration = symbol.declarations?.[0] } = symbol
3737
if (!valueDeclaration) return
3838

3939
// const dateNow = Date.now()

typescript/src/completions/localityBonus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default (entries: ts.CompletionEntry[]) => {
99
// eslint-disable-next-line prefer-destructuring
1010
const symbol: ts.Symbol | undefined = entry['symbol']
1111
if (!symbol) return
12-
const { valueDeclaration } = symbol
12+
const { valueDeclaration = symbol.declarations?.[0] } = symbol
1313
if (!valueDeclaration) return
1414
if (valueDeclaration.getSourceFile().fileName !== sourceFile.fileName) return -1
1515
return valueDeclaration.pos

0 commit comments

Comments
 (0)