support yarn2 with pnpify
This commit is contained in:
parent
2a46480810
commit
52f625c453
2 changed files with 22 additions and 4 deletions
14
Readme.md
14
Readme.md
|
@ -17,6 +17,20 @@ In your vim/neovim, run command:
|
||||||
:CocInstall coc-tsserver
|
: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
|
### intructions for nvm users
|
||||||
|
|
||||||
Disable [nvm](https://github.com/creationix/nvm) with the following command:
|
Disable [nvm](https://github.com/creationix/nvm) with the following command:
|
||||||
|
|
|
@ -80,6 +80,8 @@ export class TypeScriptVersion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MODULE_FOLDERS = ['node_modules/typescript/lib', '.vscode/pnpify/typescript/lib']
|
||||||
|
|
||||||
export class TypeScriptVersionProvider {
|
export class TypeScriptVersionProvider {
|
||||||
|
|
||||||
public constructor(private configuration: TypeScriptServiceConfiguration) { }
|
public constructor(private configuration: TypeScriptServiceConfiguration) { }
|
||||||
|
@ -106,12 +108,14 @@ export class TypeScriptVersionProvider {
|
||||||
public getLocalVersion(): TypeScriptVersion | undefined {
|
public getLocalVersion(): TypeScriptVersion | undefined {
|
||||||
let folders = workspace.workspaceFolders.map(f => Uri.parse(f.uri).fsPath)
|
let folders = workspace.workspaceFolders.map(f => Uri.parse(f.uri).fsPath)
|
||||||
for (let p of folders) {
|
for (let p of folders) {
|
||||||
if (fs.existsSync(path.join(p, 'node_modules/typescript/lib'))) {
|
for (let folder of MODULE_FOLDERS) {
|
||||||
let lib = path.join(p, 'node_modules/typescript/lib')
|
let libFolder = path.join(p, folder)
|
||||||
let version = new TypeScriptVersion(lib)
|
if (fs.existsSync(libFolder)) {
|
||||||
|
let version = new TypeScriptVersion(libFolder)
|
||||||
if (version.isValid) return version
|
if (version.isValid) return version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue