fix configured tsserver.tsdk not used
Use configured tsserver.tsdk when local tsserver not used.
This commit is contained in:
parent
35a9f25423
commit
63e22e092c
2 changed files with 15 additions and 2 deletions
|
@ -227,7 +227,16 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||||
if (this.tscPathVim) currentVersion = this.versionProvider.getVersionFromTscPath(this.tscPathVim)
|
if (this.tscPathVim) currentVersion = this.versionProvider.getVersionFromTscPath(this.tscPathVim)
|
||||||
if (!currentVersion && !ignoreLocalTsserver) currentVersion = this.versionProvider.getLocalVersion()
|
if (!currentVersion && !ignoreLocalTsserver) currentVersion = this.versionProvider.getLocalVersion()
|
||||||
if (!currentVersion || !fs.existsSync(currentVersion.tsServerPath)) {
|
if (!currentVersion || !fs.existsSync(currentVersion.tsServerPath)) {
|
||||||
this.info('Local tsserver not found, using bundled tsserver with coc-tsserver.')
|
if (ignoreLocalTsserver) {
|
||||||
|
this.info(`local tsserver is ignored, try global version`)
|
||||||
|
} else {
|
||||||
|
this.info(`local tsserver is not found, try global version`)
|
||||||
|
}
|
||||||
|
currentVersion = this.versionProvider.globalVersion
|
||||||
|
if (currentVersion) this.info('Local and global tsserver not found, using global tsserver from configuration')
|
||||||
|
}
|
||||||
|
if (!currentVersion || !fs.existsSync(currentVersion.tsServerPath)) {
|
||||||
|
this.info('Local and global tsserver not found, using bundled tsserver with coc-tsserver.')
|
||||||
currentVersion = this.versionProvider.getDefaultVersion()
|
currentVersion = this.versionProvider.getDefaultVersion()
|
||||||
}
|
}
|
||||||
if (!currentVersion || !currentVersion.isValid) {
|
if (!currentVersion || !currentVersion.isValid) {
|
||||||
|
|
|
@ -102,7 +102,11 @@ export class TypeScriptVersionProvider {
|
||||||
|
|
||||||
public get globalVersion(): TypeScriptVersion | undefined {
|
public get globalVersion(): TypeScriptVersion | undefined {
|
||||||
let { globalTsdk } = this.configuration
|
let { globalTsdk } = this.configuration
|
||||||
if (globalTsdk) return new TypeScriptVersion(workspace.expand(globalTsdk))
|
let folder = workspace.expand(globalTsdk)
|
||||||
|
if (!path.isAbsolute(folder)) {
|
||||||
|
folder = path.join(workspace.root, folder)
|
||||||
|
}
|
||||||
|
if (globalTsdk) return new TypeScriptVersion(folder)
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue