From 3a4f9939186a2d2ff92cabaf500e20b2f0207c26 Mon Sep 17 00:00:00 2001 From: Geoff Whatley Date: Mon, 9 Sep 2019 14:04:01 +1000 Subject: [PATCH] resolve `tsserver.js` via an absolute path (#57) this commit changes the `tsserver.js` resolution logic to use an absolute path rather than a relative one. previously, if a user wanted to use a `tsserver.js` that was local to a project but didn't live in `node_modules` (which would be automatically resolved by default), the `tsserver.tsdk` needed to be hardcoded to an absolute path. this required the user to modify `coc-settings.json` each time they wished to switch projects. by resolving to an absolute path, a user can now set the value to a relative path which will resolve correctly per project. this change facilitates simplified usage of Yarn v2's PnP feature, which can generate a project-specific `tsserver.js` to enable correct IDE integration. --- src/server/utils/versionProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/utils/versionProvider.ts b/src/server/utils/versionProvider.ts index 5a1afa8..c6b2a9f 100644 --- a/src/server/utils/versionProvider.ts +++ b/src/server/utils/versionProvider.ts @@ -21,7 +21,7 @@ export class TypeScriptVersion { } public get tsServerPath(): string { - return path.join(this.path, 'tsserver.js') + return path.resolve(this.path, 'tsserver.js') } public get pathLabel(): string {