mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Add test
This commit is contained in:
parent
003c0a6743
commit
e9d6f788ca
@ -2910,6 +2910,11 @@ Actual: ${stringify(fullActual)}`);
|
||||
}
|
||||
|
||||
private verifyDocumentHighlights(expectedRanges: Range[], fileNames: ReadonlyArray<string> = [this.activeFile.fileName]) {
|
||||
expectedRanges = ts.map(expectedRanges, r => {
|
||||
r.fileName = ts.normalizePath(r.fileName);
|
||||
return r;
|
||||
});
|
||||
fileNames = ts.map(fileNames, ts.normalizePath);
|
||||
const documentHighlights = this.getDocumentHighlightsAtCurrentPosition(fileNames) || [];
|
||||
|
||||
for (const dh of documentHighlights) {
|
||||
@ -3219,7 +3224,7 @@ Actual: ${stringify(fullActual)}`);
|
||||
}
|
||||
}
|
||||
else if (ts.isString(indexOrName)) {
|
||||
let name = indexOrName;
|
||||
let name = ts.normalizePath(indexOrName);
|
||||
|
||||
// names are stored in the compiler with this relative path, this allows people to use goTo.file on just the fileName
|
||||
name = name.indexOf("/") === -1 ? (this.basePath + "/" + name) : name;
|
||||
|
||||
@ -125,7 +125,7 @@ namespace Utils {
|
||||
|
||||
addFile(path: string, content?: Harness.LanguageService.ScriptInfo) {
|
||||
const absolutePath = ts.normalizePath(ts.getNormalizedAbsolutePath(path, this.currentDirectory));
|
||||
const fileName = ts.getBaseFileName(path);
|
||||
const fileName = ts.getBaseFileName(absolutePath);
|
||||
const directoryPath = ts.getDirectoryPath(absolutePath);
|
||||
const directory = this.addDirectory(directoryPath);
|
||||
return directory ? directory.addFile(fileName, content) : undefined;
|
||||
|
||||
7
tests/cases/fourslash/documentHighlights_windowsPath.ts
Normal file
7
tests/cases/fourslash/documentHighlights_windowsPath.ts
Normal file
@ -0,0 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: C:\a\b\c.ts
|
||||
////var /*1*/[|x|] = 1;
|
||||
|
||||
const range = test.ranges()[0];
|
||||
verify.documentHighlightsOf(range, [range], { filesToSearch: [range.fileName] });
|
||||
Loading…
x
Reference in New Issue
Block a user