mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-23 07:07:09 -05:00
fix(54013): bug: Incorrect Typescript completion with computed property name (#54067)
This commit is contained in:
@@ -3585,7 +3585,8 @@ function getCompletionData(
|
||||
const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName);
|
||||
// If this is nested like for `namespace N { export const sym = Symbol(); }`, we'll add the completion for `N`.
|
||||
const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker);
|
||||
if (firstAccessibleSymbol && addToSeen(seenPropertySymbols, getSymbolId(firstAccessibleSymbol))) {
|
||||
const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol);
|
||||
if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) {
|
||||
const index = symbols.length;
|
||||
symbols.push(firstAccessibleSymbol);
|
||||
const moduleSymbol = firstAccessibleSymbol.parent;
|
||||
@@ -3621,6 +3622,9 @@ function getCompletionData(
|
||||
}
|
||||
}
|
||||
else if (preferences.includeCompletionsWithInsertText) {
|
||||
if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) {
|
||||
return;
|
||||
}
|
||||
addSymbolOriginInfo(symbol);
|
||||
addSymbolSortInfo(symbol);
|
||||
symbols.push(symbol);
|
||||
|
||||
Reference in New Issue
Block a user