Skip to content

Commit 060a8b6

Browse files
committed
Merge pull request #801 from Microsoft/absolutePathRef
Handle /// references with absolute path
2 parents 29e770b + 93e5a94 commit 060a8b6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/compiler/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4019,7 +4019,8 @@ module ts {
40194019

40204020
function processReferencedFiles(file: SourceFile, basePath: string) {
40214021
forEach(file.referencedFiles, ref => {
4022-
processSourceFile(normalizePath(combinePaths(basePath, ref.filename)), /* isDefaultLib */ false, file, ref.pos, ref.end);
4022+
var referencedFilename = isRootedDiskPath(ref.filename) ? ref.filename : combinePaths(basePath, ref.filename);
4023+
processSourceFile(normalizePath(referencedFilename), /* isDefaultLib */ false, file, ref.pos, ref.end);
40234024
});
40244025
}
40254026

src/services/services.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,8 @@ module ts {
25732573
/// Triple slash reference comments
25742574
var comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined);
25752575
if (comment) {
2576-
var targetFilename = normalizePath(combinePaths(getDirectoryPath(filename), comment.filename));
2576+
var targetFilename = isRootedDiskPath(comment.filename) ? comment.filename : combinePaths(getDirectoryPath(filename), comment.filename);
2577+
targetFilename = normalizePath(targetFilename);
25772578
if (program.getSourceFile(targetFilename)) {
25782579
return [{
25792580
fileName: targetFilename,

0 commit comments

Comments
 (0)