File tree Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -1000,6 +1000,7 @@ namespace ts.Completions {
1000
1000
let completionKind = CompletionKind . None ;
1001
1001
let isNewIdentifierLocation = false ;
1002
1002
let keywordFilters = KeywordCompletionFilters . None ;
1003
+ // This also gets mutated in nested-functions after the return
1003
1004
let symbols : Symbol [ ] = [ ] ;
1004
1005
const symbolToOriginInfoMap : SymbolOriginInfoMap = [ ] ;
1005
1006
const symbolToSortTextMap : SymbolSortTextMap = [ ] ;
@@ -1342,9 +1343,12 @@ namespace ts.Completions {
1342
1343
}
1343
1344
1344
1345
const symbolId = getSymbolId ( symbol ) ;
1345
- symbols . push ( symbol ) ;
1346
- symbolToOriginInfoMap [ symbolId ] = origin ;
1347
- symbolToSortTextMap [ symbolId ] = SortText . AutoImportSuggestions ;
1346
+ const existingSymbol = findLast ( symbols , symbol => symbol . id === symbolId ) ;
1347
+ if ( ! existingSymbol ) {
1348
+ symbols . push ( symbol ) ;
1349
+ symbolToOriginInfoMap [ symbolId ] = origin ;
1350
+ symbolToSortTextMap [ symbolId ] = SortText . AutoImportSuggestions ;
1351
+ }
1348
1352
} ) ;
1349
1353
}
1350
1354
filterGlobalCompletion ( symbols ) ;
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ // @esModuleInterop : true,
4
+ // @target : esnext
5
+
6
+ // @Filename : /myAssert.d.ts
7
+ ////declare function assert(value:any, message?:string):void;
8
+ ////export = assert;
9
+ ////export as namespace assert;
10
+
11
+ // @Filename : /ambient.d.ts
12
+ ////import assert from './myAssert';
13
+ ////
14
+ ////type Assert = typeof assert;
15
+ ////
16
+ ////declare global {
17
+ //// const assert: Assert;
18
+ //// }
19
+
20
+ // @Filename : /index.ts
21
+ /////// <reference path="./ambient.d.ts" />
22
+ ////asser/**/;
23
+
24
+ verify . completions ( {
25
+ marker : "" ,
26
+ includes : [
27
+ {
28
+ name : "assert" ,
29
+ sortText : completion . SortText . GlobalsOrKeywords
30
+ }
31
+ ] ,
32
+ preferences : { includeCompletionsForModuleExports : true , includeInsertTextCompletions : true }
33
+ } ) ;
You can’t perform that action at this time.
0 commit comments