-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Call toPath on sourceRoot to ensure it is always absolute #25838
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/// <reference path="../fourslash.ts" /> | ||
// @Filename: index.ts | ||
////export class Foo { | ||
//// member: string; | ||
//// /*2*/methodName(propName: SomeType): void {} | ||
//// otherMethod() { | ||
//// if (Math.random() > 0.5) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you try to cut the repro down to size? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, I didn't want to since it is just a copy of the other test with a relative sourceroot patched in. :3 |
||
//// return {x: 42}; | ||
//// } | ||
//// return {y: "yes"}; | ||
//// } | ||
////} | ||
//// | ||
////export interface SomeType { | ||
//// member: number; | ||
////} | ||
// @Filename: out/indexdef.d.ts.map | ||
////{"version":3,"file":"indexdef.d.ts","sourceRoot":"../","sources":["index.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IACpC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} | ||
// @Filename: out/indexdef.d.ts | ||
////export declare class Foo { | ||
//// member: string; | ||
//// methodName(propName: SomeType): void; | ||
//// otherMethod(): { | ||
//// x: number; | ||
//// y?: undefined; | ||
//// } | { | ||
//// y: string; | ||
//// x?: undefined; | ||
//// }; | ||
////} | ||
////export interface SomeType { | ||
//// member: number; | ||
////} | ||
//////# sourceMappingURL=out/indexdef.d.ts.map | ||
// @Filename: mymodule.ts | ||
////import * as mod from "./out/indexdef"; | ||
////const instance = new mod.Foo(); | ||
////instance.[|/*1*/methodName|]({member: 12}); | ||
|
||
verify.goToDefinition("1", "2"); |
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.
Do you need to handle if the sourceRoot specified is URL ?
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.
getNormalizedAbsolutePath
already passes along URLs just fine (it preserves the input root if it is rooted), as will the rest of the path handling in the sourcemap code. The language service will likely summarily reject the mapped location, however, sincehttps://github.com/Microsoft/TypeScript/tree/master/src/compiler/checker.ts
(for example) won't exist on disk (though I imagine a host implementation could exist that returns results for such paths). UNC paths might in theory work fine, though.... those return normal results viafileExists
and similar APIs on windows, right?In any case: No, I don't think so - all the path normalizing/building stuff already is.