diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 89997aeeab5..9a6f9ef77ca 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -218,12 +218,6 @@ namespace Harness.LanguageService { const snapshot = this.getScriptSnapshot(path); return snapshot.getText(0, snapshot.getLength()); } - resolvePath(path: string): string { - if (!ts.isRootedDiskPath(path)) { - path = ts.combinePaths(this.getCurrentDirectory(), path); - } - return ts.normalizePath(path); - } log(s: string): void { } @@ -329,9 +323,6 @@ namespace Harness.LanguageService { const snapshot = this.nativeHost.getScriptSnapshot(fileName); return snapshot && snapshot.getText(0, snapshot.getLength()); } - resolvePath(path: string): string { - return this.nativeHost.resolvePath(path); - } log(s: string): void { this.nativeHost.log(s); } trace(s: string): void { this.nativeHost.trace(s); } error(s: string): void { this.nativeHost.error(s); } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6b2cdb804c4..3a1a4556e03 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -306,11 +306,6 @@ namespace ts.server { throw new Error("No script with name '" + filename + "'"); } - resolvePath(path: string): string { - const result = this.host.resolvePath(path); - return result; - } - fileExists(path: string): boolean { const result = this.host.fileExists(path); return result; diff --git a/src/services/services.ts b/src/services/services.ts index 30500189111..6108e1e976a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1159,7 +1159,6 @@ namespace ts { useCaseSensitiveFileNames?(): boolean; readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; - resolvePath(path: string): string; readFile(path: string, encoding?: string): string; fileExists(path: string): boolean; @@ -4589,7 +4588,7 @@ namespace ts { } const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment)); - const baseDirectory = host.resolvePath(getDirectoryPath(absolutePath)); + const baseDirectory = getDirectoryPath(absolutePath); const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); if (directoryProbablyExists(baseDirectory, host)) { @@ -4827,7 +4826,14 @@ namespace ts { }); } else if (host.getDirectories && options.typeRoots) { - const absoluteRoots = map(options.typeRoots, rootDirectory => getAbsoluteProjectPath(rootDirectory, host, options.project)); + const absoluteRoots = map(options.typeRoots, rootDirectory => { + if (isRootedDiskPath(rootDirectory)) { + return normalizePath(rootDirectory); + } + + const basePath = options.project || host.getCurrentDirectory(); + return normalizePath(combinePaths(basePath, rootDirectory)); + }); forEach(absoluteRoots, absoluteRoot => getCompletionEntriesFromDirectories(host, options, absoluteRoot, result)); } @@ -4842,18 +4848,6 @@ namespace ts { return result; } - function getAbsoluteProjectPath(path: string, host: LanguageServiceHost, projectDir?: string) { - if (isRootedDiskPath(path)) { - return normalizePath(path); - } - - if (projectDir) { - return normalizePath(combinePaths(projectDir, path)); - } - - return normalizePath(host.resolvePath(path)); - } - function getCompletionEntriesFromDirectories(host: LanguageServiceHost, options: CompilerOptions, directory: string, result: ImportCompletionEntry[]) { if (host.getDirectories && directoryProbablyExists(directory, host)) { forEach(host.getDirectories(directory), typeDirectory => { diff --git a/src/services/shims.ts b/src/services/shims.ts index 401137a28e9..b5ae306c71f 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -69,7 +69,6 @@ namespace ts { readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; readFile(path: string, encoding?: string): string; - resolvePath(path: string): string; fileExists(path: string): boolean; getModuleResolutionsForFile?(fileName: string): string; @@ -446,10 +445,6 @@ namespace ts { return this.shimHost.readFile(path, encoding); } - public resolvePath(path: string): string { - return this.shimHost.resolvePath(path); - } - public fileExists(path: string): boolean { return this.shimHost.fileExists(path); }