-
Notifications
You must be signed in to change notification settings - Fork 13k
Add test for goto-definition with project references #24867
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
Conversation
31baae1
to
a57712c
Compare
a57712c
to
9a6512f
Compare
@weswigham The test is still wrong, could you take a look? |
d7bbbd0
to
b9ed8d6
Compare
b9ed8d6
to
7c17aeb
Compare
|
||
writeDeclarationFiles(aTs, host, session, [ | ||
// Need to mangle the sourceMappingURL part or it breaks the build | ||
{ name: "/a/bin/a.d.ts.map", text: '{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../a.ts"],"names":[],"mappings":"AAAA,kCAAsB"}' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sourcemap maps position 0
in the .d.ts
to 0
in the .ts
and 34
in the .d.ts
to 22
in the .ts
. The start of the declaration is mapped to the start, and the end is mapped to the end, nothing more. We try to map position 24
, which is squarely between those, so return the closest available mapping - 22
, the end mapping. toFileSpan
in the LS then maps that into a 1-based line & column system. The end position is out of bounds, because, ofc, there's no 1-character identifier at the end of the declaration (and we assume that the length
of the declaration span is constant when we map it).
49d656d
to
0dca8f1
Compare
@weswigham @mhegazy Good to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tests. 🐱
const navtoResponse = session.executeCommand(navtoRequest).response as protocol.NavtoResponse["body"]; | ||
|
||
assert.deepEqual(navtoResponse, [ | ||
// TODO: First result should be from a.ts, not a.d.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a reminder because navTo
doesn't apply sourcemaps yet, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, working on it. #25283
Discovered #24866.