mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-01 21:00:17 -06:00
Fix copy-paste error in navigateToItemIsEqualTo (#36912)
* Fix copy-paste error in navigateToItemIsEqualTo It was preventing de-duping of items found in multiple projects. * Add de-duping test
This commit is contained in:
parent
d0c961e544
commit
cf24c4fdc0
@ -1892,7 +1892,7 @@ namespace ts.server {
|
||||
a.fileName === b.fileName &&
|
||||
a.isCaseSensitive === b.isCaseSensitive &&
|
||||
a.kind === b.kind &&
|
||||
a.kindModifiers === b.containerName &&
|
||||
a.kindModifiers === b.kindModifiers &&
|
||||
a.matchKind === b.matchKind &&
|
||||
a.name === b.name &&
|
||||
a.textSpan.start === b.textSpan.start &&
|
||||
|
||||
@ -26,5 +26,46 @@ namespace ts.projectSystem {
|
||||
const items2 = session.executeCommand(localFunctionNavToRequst).response as protocol.NavtoItem[];
|
||||
assert.isTrue(containsNavToItem(items2, "foo", "function"), `Cannot find function symbol "foo".`);
|
||||
});
|
||||
|
||||
it("should de-duplicate symbols", () => {
|
||||
const configFile1: File = {
|
||||
path: "/a/tsconfig.json",
|
||||
content: `{
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
}
|
||||
}`
|
||||
};
|
||||
const file1: File = {
|
||||
path: "/a/index.ts",
|
||||
content: "export const abcdef = 1;"
|
||||
};
|
||||
const configFile2: File = {
|
||||
path: "/b/tsconfig.json",
|
||||
content: `{
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../a" }
|
||||
]
|
||||
}`
|
||||
};
|
||||
const file2: File = {
|
||||
path: "/b/index.ts",
|
||||
content: `import a = require("../a");
|
||||
export const ghijkl = a.abcdef;`
|
||||
};
|
||||
const host = createServerHost([configFile1, file1, configFile2, file2]);
|
||||
const session = createSession(host);
|
||||
openFilesForSession([file1, file2], session);
|
||||
|
||||
const request = makeSessionRequest<protocol.NavtoRequestArgs>(CommandNames.Navto, { searchValue: "abcdef", file: file1.path });
|
||||
const items = session.executeCommand(request).response as protocol.NavtoItem[];
|
||||
assert.strictEqual(items.length, 1);
|
||||
const item = items[0];
|
||||
assert.strictEqual(item.name, "abcdef");
|
||||
assert.strictEqual(item.file, file1.path);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user