@@ -26,5 +26,46 @@ namespace ts.projectSystem {
2626 const items2 = session . executeCommand ( localFunctionNavToRequst ) . response as protocol . NavtoItem [ ] ;
2727 assert . isTrue ( containsNavToItem ( items2 , "foo" , "function" ) , `Cannot find function symbol "foo".` ) ;
2828 } ) ;
29+
30+ it ( "should de-duplicate symbols" , ( ) => {
31+ const configFile1 : File = {
32+ path : "/a/tsconfig.json" ,
33+ content : `{
34+ "compilerOptions": {
35+ "composite": true
36+ }
37+ }`
38+ } ;
39+ const file1 : File = {
40+ path : "/a/index.ts" ,
41+ content : "export const abcdef = 1;"
42+ } ;
43+ const configFile2 : File = {
44+ path : "/b/tsconfig.json" ,
45+ content : `{
46+ "compilerOptions": {
47+ "composite": true
48+ },
49+ "references": [
50+ { "path": "../a" }
51+ ]
52+ }`
53+ } ;
54+ const file2 : File = {
55+ path : "/b/index.ts" ,
56+ content : `import a = require("../a");
57+ export const ghijkl = a.abcdef;`
58+ } ;
59+ const host = createServerHost ( [ configFile1 , file1 , configFile2 , file2 ] ) ;
60+ const session = createSession ( host ) ;
61+ openFilesForSession ( [ file1 , file2 ] , session ) ;
62+
63+ const request = makeSessionRequest < protocol . NavtoRequestArgs > ( CommandNames . Navto , { searchValue : "abcdef" , file : file1 . path } ) ;
64+ const items = session . executeCommand ( request ) . response as protocol . NavtoItem [ ] ;
65+ assert . strictEqual ( items . length , 1 ) ;
66+ const item = items [ 0 ] ;
67+ assert . strictEqual ( item . name , "abcdef" ) ;
68+ assert . strictEqual ( item . file , file1 . path ) ;
69+ } ) ;
2970 } ) ;
3071}
0 commit comments