diff --git a/packages/language-service/ivy/adapters.ts b/packages/language-service/ivy/adapters.ts index bd02eaa562..9582177175 100644 --- a/packages/language-service/ivy/adapters.ts +++ b/packages/language-service/ivy/adapters.ts @@ -123,7 +123,7 @@ export class LSParseConfigHost implements ConfigurationHost { return p.extname(path); } resolve(...paths: string[]): AbsoluteFsPath { - return this.serverHost.resolvePath(this.join(paths[0], ...paths.slice(1))) as AbsoluteFsPath; + return p.resolve(...paths) as AbsoluteFsPath; } dirname(file: T): T { return p.dirname(file) as T; diff --git a/packages/language-service/ivy/test/adapters_spec.ts b/packages/language-service/ivy/test/adapters_spec.ts new file mode 100644 index 0000000000..cd3ae1d8f9 --- /dev/null +++ b/packages/language-service/ivy/test/adapters_spec.ts @@ -0,0 +1,21 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import * as ts from 'typescript/lib/tsserverlibrary'; + +import {LSParseConfigHost} from '../adapters'; + +describe('LSParseConfigHost.resolve()', () => { + it('should collapse absolute paths', () => { + const p1 = '/foo/bar/baz'; + const p2 = '/foo/bar/baz/tsconfig.json'; + const host = new LSParseConfigHost(ts.sys as ts.server.ServerHost); + const resolved = host.resolve(p1, p2); + expect(resolved).toBe('/foo/bar/baz/tsconfig.json'); + }); +});