Skip to content

Commit a5b846f

Browse files
author
Andy Hanson
committed
Fix bug if previousToken is not an Identifier
1 parent 13351db commit a5b846f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/services/completions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ namespace ts.Completions {
840840
const symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias;
841841

842842
symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);
843-
getSymbolsFromOtherSourceFileExports(symbols, previousToken === undefined ? "" : previousToken.getText());
843+
getSymbolsFromOtherSourceFileExports(symbols, previousToken && isIdentifier(previousToken) ? previousToken.text : "");
844844
filterGlobalCompletion(symbols);
845845

846846
return true;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: /a.ts
4+
////export function foo() {}
5+
6+
// @Filename: /b.ts
7+
////import * as a from 'a';
8+
/////**/
9+
10+
goTo.marker("");
11+
verify.completionListContains("foo", "function foo(): void", "", "function", /*spanIndex*/ undefined, /*hasAction*/ true);

0 commit comments

Comments
 (0)