Skip to content

Commit 310bce4

Browse files
committed
Removing resolvePath from language service host
1 parent 2f4a855 commit 310bce4

File tree

4 files changed

+9
-34
lines changed

4 files changed

+9
-34
lines changed

src/harness/harnessLanguageService.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,6 @@ namespace Harness.LanguageService {
218218
const snapshot = this.getScriptSnapshot(path);
219219
return snapshot.getText(0, snapshot.getLength());
220220
}
221-
resolvePath(path: string): string {
222-
if (!ts.isRootedDiskPath(path)) {
223-
path = ts.combinePaths(this.getCurrentDirectory(), path);
224-
}
225-
return ts.normalizePath(path);
226-
}
227221

228222

229223
log(s: string): void { }
@@ -329,9 +323,6 @@ namespace Harness.LanguageService {
329323
const snapshot = this.nativeHost.getScriptSnapshot(fileName);
330324
return snapshot && snapshot.getText(0, snapshot.getLength());
331325
}
332-
resolvePath(path: string): string {
333-
return this.nativeHost.resolvePath(path);
334-
}
335326
log(s: string): void { this.nativeHost.log(s); }
336327
trace(s: string): void { this.nativeHost.trace(s); }
337328
error(s: string): void { this.nativeHost.error(s); }

src/server/editorServices.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,6 @@ namespace ts.server {
306306
throw new Error("No script with name '" + filename + "'");
307307
}
308308

309-
resolvePath(path: string): string {
310-
const result = this.host.resolvePath(path);
311-
return result;
312-
}
313-
314309
fileExists(path: string): boolean {
315310
const result = this.host.fileExists(path);
316311
return result;

src/services/services.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,6 @@ namespace ts {
11591159
useCaseSensitiveFileNames?(): boolean;
11601160

11611161
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
1162-
resolvePath(path: string): string;
11631162
readFile(path: string, encoding?: string): string;
11641163
fileExists(path: string): boolean;
11651164

@@ -4589,7 +4588,7 @@ namespace ts {
45894588
}
45904589

45914590
const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment));
4592-
const baseDirectory = host.resolvePath(getDirectoryPath(absolutePath));
4591+
const baseDirectory = getDirectoryPath(absolutePath);
45934592
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
45944593

45954594
if (directoryProbablyExists(baseDirectory, host)) {
@@ -4827,7 +4826,14 @@ namespace ts {
48274826
});
48284827
}
48294828
else if (host.getDirectories && options.typeRoots) {
4830-
const absoluteRoots = map(options.typeRoots, rootDirectory => getAbsoluteProjectPath(rootDirectory, host, options.project));
4829+
const absoluteRoots = map(options.typeRoots, rootDirectory => {
4830+
if (isRootedDiskPath(rootDirectory)) {
4831+
return normalizePath(rootDirectory);
4832+
}
4833+
4834+
const basePath = options.project || host.getCurrentDirectory();
4835+
return normalizePath(combinePaths(basePath, rootDirectory));
4836+
});
48314837
forEach(absoluteRoots, absoluteRoot => getCompletionEntriesFromDirectories(host, options, absoluteRoot, result));
48324838
}
48334839

@@ -4842,18 +4848,6 @@ namespace ts {
48424848
return result;
48434849
}
48444850

4845-
function getAbsoluteProjectPath(path: string, host: LanguageServiceHost, projectDir?: string) {
4846-
if (isRootedDiskPath(path)) {
4847-
return normalizePath(path);
4848-
}
4849-
4850-
if (projectDir) {
4851-
return normalizePath(combinePaths(projectDir, path));
4852-
}
4853-
4854-
return normalizePath(host.resolvePath(path));
4855-
}
4856-
48574851
function getCompletionEntriesFromDirectories(host: LanguageServiceHost, options: CompilerOptions, directory: string, result: ImportCompletionEntry[]) {
48584852
if (host.getDirectories && directoryProbablyExists(directory, host)) {
48594853
forEach(host.getDirectories(directory), typeDirectory => {

src/services/shims.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ namespace ts {
6969

7070
readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string;
7171
readFile(path: string, encoding?: string): string;
72-
resolvePath(path: string): string;
7372
fileExists(path: string): boolean;
7473

7574
getModuleResolutionsForFile?(fileName: string): string;
@@ -446,10 +445,6 @@ namespace ts {
446445
return this.shimHost.readFile(path, encoding);
447446
}
448447

449-
public resolvePath(path: string): string {
450-
return this.shimHost.resolvePath(path);
451-
}
452-
453448
public fileExists(path: string): boolean {
454449
return this.shimHost.fileExists(path);
455450
}

0 commit comments

Comments
 (0)