Skip to content

Lookup files by resolved Path and not by fileName in sourcemapDecoder when querying program - #25908

Merged
Wesley Wigham (weswigham) merged 2 commits into
microsoft:masterfrom
weswigham:same-name-files-multiple-projects
Jul 24, 2018
Merged

Wesley Wigham (weswigham) merged 2 commits into
microsoft:masterfrom
weswigham:same-name-files-multiple-projects

Conversation

@weswigham

@weswigham Wesley Wigham (weswigham) commented Jul 24, 2018 •

Copy link
Copy Markdown
Member

Since each project has a different program, we were looking for a Source.ts which just so happened to also exist in the current program (different file, same name - ah, the folly of using a relative path as an identifier). Now we lookup using the full path instead of the shorthand fileName.

Fixes #25792 and I believe #25662

@weswigham Wesley Wigham (weswigham) changed the title Check if the file returned by the program actually refers to the same file as we intend Lookup files by resolved Path and not by fileName in sourcemapDecoder when querying program Jul 24, 2018
Comment thread src/harness/fourslash.ts
ts.zipWith(endMarkers, definitions, (endMarker, definition, i) => {
const marker = this.getMarkerByName(endMarker);
if (marker.fileName !== definition.fileName || marker.position !== definition.textSpan.start) {
if (ts.comparePaths(marker.fileName, definition.fileName, /*ignoreCase*/ true) !== ts.Comparison.EqualTo || marker.position !== definition.textSpan.start) {

@weswigham Wesley Wigham (weswigham) Jul 24, 2018 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to fix the fourslash harness to do case-appropriate comparisons of the paths returned in definition requests, since the fallback cache'd mapped locations are always canonicalized paths and not input-case-like strings (and the fourslash harness assumes case insensitivity).

@mhegazy

Copy link
Copy Markdown
Contributor

Please port to release-3.0 as well.

@weswigham
Wesley Wigham (weswigham) merged commit 23eb591 into microsoft:master Jul 24, 2018
@weswigham
Wesley Wigham (weswigham) deleted the same-name-files-multiple-projects branch July 24, 2018 22:44
Wesley Wigham (weswigham) added a commit to weswigham/TypeScript that referenced this pull request Jul 24, 2018
…oder when querying program (microsoft#25908)

* Check if the file returned by the program actually refers to the same file as we intend

* Simplify
Mohamed Hegazy (mhegazy) added a commit that referenced this pull request Jul 24, 2018
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants