Skip to content

Fix copy-paste error in navigateToItemIsEqualTo #36912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/server/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
41 changes: 41 additions & 0 deletions src/testRunner/unittests/tsserver/navTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}