Skip to content
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
4 changes: 2 additions & 2 deletions src/compiler/sourcemapDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ namespace ts.sourcemaps {

function getSourceFileLike(fileName: string, location: string): SourceFileLike | undefined {
// Lookup file in program, if provided
const file = program && program.getSourceFile(fileName);
const path = toPath(fileName, location, host.getCanonicalFileName);
const file = program && program.getSourceFile(path);
if (!file) {
// Otherwise check the cache (which may hit disk)
const path = toPath(fileName, location, host.getCanonicalFileName);
return fallbackCache.get(path);
}
return file;
Expand Down
2 changes: 1 addition & 1 deletion src/harness/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ namespace FourSlash {

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).

this.raiseError(`${testName} failed for definition ${endMarker} (${i}): expected ${marker.fileName} at ${marker.position}, got ${definition.fileName} at ${definition.textSpan.start}`);
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/// <reference path="../fourslash.ts" />
// @Filename: BaseClass/Source.d.ts
////declare class Control {
//// constructor();
//// /** this is a super var */
//// myVar: boolean | 'yeah';
////}
//////# sourceMappingURL=Source.d.ts.map
// @Filename: BaseClass/Source.d.ts.map
////{"version":3,"file":"Source.d.ts","sourceRoot":"","sources":["Source.ts"],"names":[],"mappings":"AAAA,cAAM,OAAO;;IAIT,0BAA0B;IACnB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAQ;CACzC"}
// @Filename: BaseClass/Source.ts
////class /*2*/Control{
//// constructor(){
//// return;
//// }
//// /** this is a super var */
//// public /*4*/myVar: boolean | 'yeah' = true;
////}
// @Filename: tsbase.json
////{
//// "$schema": "http://json.schemastore.org/tsconfig",
//// "compileOnSave": true,
//// "compilerOptions": {
//// "sourceMap": true,
//// "declaration": true,
//// "declarationMap": true
//// }
//// }
// @Filename: buttonClass/tsconfig.json
////{
//// "extends": "../tsbase.json",
//// "compilerOptions": {
//// "outFile": "Source.js"
//// },
//// "files": [
//// "Source.ts"
//// ],
//// "include": [
//// "../BaseClass/Source.d.ts"
//// ]
//// }
// @Filename: buttonClass/Source.ts
////// I cannot F12 navigate to Control
////// vvvvvvv
////class Button extends [|/*1*/Control|] {
//// public myFunction() {
//// // I cannot F12 navigate to myVar
//// // vvvvv
//// if (typeof this.[|/*3*/myVar|] === 'boolean') {
//// this.myVar;
//// } else {
//// this.myVar.toLocaleUpperCase();
//// }
//// }
////}

verify.goToDefinition("1", "2");
verify.goToDefinition("3", "4");