Skip to content

Port #48978 forward to the revised FAR code #49267

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
May 27, 2022
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
5 changes: 2 additions & 3 deletions src/server/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ namespace ts.server {
// have started the other project searches from related symbols. Propagate the
// correct results to all other projects.

const defaultProjectResults = perProjectResults.get(defaultProject)!;
if (defaultProjectResults[0].references[0].isDefinition === undefined) {
const defaultProjectResults = perProjectResults.get(defaultProject);
if (defaultProjectResults?.[0].references[0]?.isDefinition === undefined) {
// Clear all isDefinition properties
perProjectResults.forEach(projectResults => {
for (const referencedSymbol of projectResults) {
Expand Down Expand Up @@ -580,7 +580,6 @@ namespace ts.server {

return resultsMap;

// May enqueue to otherPositionQueue
function searchPosition(project: Project, location: DocumentPosition): readonly TResult[] | undefined {
const projectResults = getResultsForPosition(project, location);
if (!projectResults) return undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[]

[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/a/a.ts",
"kind": "var",
"name": "hello",
"textSpan": {
"start": 56,
"length": 5
},
"displayParts": [
{
"text": "\"hello\"",
"kind": "stringLiteral"
}
]
},
"references": []
}
]

[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="../fourslash.ts"/>

// @Filename: /a/tsconfig.json
////{ "files": ["a.ts"] }

// @Filename: /a/a.ts
/////// <reference path="../b/b.ts" />
/////*1*/;

// @Filename: /b/tsconfig.json
////{ "files": ["b.ts"] }

// @Filename: /b/b.ts
/////*2*/;

verify.baselineFindAllReferences('1', '2')
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="../fourslash.ts"/>

// @Filename: /a/tsconfig.json
////{ "files": ["a.ts"] }

// @Filename: /a/a.ts
/////// <reference path="../b/b.ts" />
////const str: string = "hello/*1*/";

// @Filename: /b/tsconfig.json
////{ "files": ["b.ts"] }

// @Filename: /b/b.ts
////const str2: string = "hello/*2*/";

verify.baselineFindAllReferences('1', '2')