diff --git a/Readme.md b/Readme.md index 8594133..8abf432 100644 --- a/Readme.md +++ b/Readme.md @@ -17,6 +17,20 @@ In your vim/neovim, run command: :CocInstall coc-tsserver ``` +For yarn2 user what to use local typescript module: + +- Add PnPify to your dependencies: + + ``` + yarn add @yarnpkg/pnpify + ``` + +- Run the following command, which will generate a new directory called .vscode/pnpify + + ``` + yarn pnpify --sdk + ``` + ### intructions for nvm users Disable [nvm](https://github.com/creationix/nvm) with the following command: diff --git a/src/server/utils/versionProvider.ts b/src/server/utils/versionProvider.ts index c6b2a9f..0bff15a 100644 --- a/src/server/utils/versionProvider.ts +++ b/src/server/utils/versionProvider.ts @@ -80,6 +80,8 @@ export class TypeScriptVersion { } } +const MODULE_FOLDERS = ['node_modules/typescript/lib', '.vscode/pnpify/typescript/lib'] + export class TypeScriptVersionProvider { public constructor(private configuration: TypeScriptServiceConfiguration) { } @@ -106,10 +108,12 @@ export class TypeScriptVersionProvider { public getLocalVersion(): TypeScriptVersion | undefined { let folders = workspace.workspaceFolders.map(f => Uri.parse(f.uri).fsPath) for (let p of folders) { - if (fs.existsSync(path.join(p, 'node_modules/typescript/lib'))) { - let lib = path.join(p, 'node_modules/typescript/lib') - let version = new TypeScriptVersion(lib) - if (version.isValid) return version + for (let folder of MODULE_FOLDERS) { + let libFolder = path.join(p, folder) + if (fs.existsSync(libFolder)) { + let version = new TypeScriptVersion(libFolder) + if (version.isValid) return version + } } } return null