use tsserver.pluginPaths replace tsserver.pluginRoot
This commit is contained in:
parent
8e2d3eefef
commit
50d6c6241a
4 changed files with 22 additions and 11 deletions
|
@ -104,7 +104,7 @@ Checkout [using the configuration file](https://github.com/neoclide/coc.nvim/wik
|
|||
- `tsserver.npm`:Executable path of npm for download typings, default: `""`
|
||||
- `tsserver.log`:Log level of tsserver, default: `"off"`
|
||||
- `tsserver.trace.server`:Trace level of tsserver, default: `"off"`
|
||||
- `tsserver.pluginRoot`:Folder contains tsserver plugins, default: `[]`
|
||||
- `tsserver.pluginPaths`:Folders contains tsserver plugins, default: `[]`
|
||||
- `tsserver.debugPort`:Debug port number of tsserver
|
||||
- `tsserver.watchOptions`:Configure which watching strategies should be used to keep track of files and directories. Requires using TypeScript 3.8+ in the workspace, default: undefined.
|
||||
- `tsserver.reportStyleChecksAsWarnings` default: `true`
|
||||
|
|
|
@ -211,13 +211,13 @@
|
|||
],
|
||||
"description": "Trace level of tsserver"
|
||||
},
|
||||
"tsserver.pluginRoot": {
|
||||
"type": "string",
|
||||
"tsserver.pluginPaths": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Folder contains tsserver plugins"
|
||||
"description": "Folders contains tsserver plugins"
|
||||
},
|
||||
"tsserver.debugPort": {
|
||||
"type": "number",
|
||||
|
|
|
@ -281,7 +281,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
|||
this._tscPath = currentVersion.tscPath
|
||||
this.versionStatus.onDidChangeTypeScriptVersion(currentVersion)
|
||||
this.lastError = null
|
||||
const tsServerForkArgs = await this.getTsServerArgs()
|
||||
const tsServerForkArgs = await this.getTsServerArgs(currentVersion)
|
||||
const debugPort = this._configuration.debugPort
|
||||
const maxTsServerMemory = this._configuration.maxTsServerMemory
|
||||
const options = {
|
||||
|
@ -766,7 +766,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
|||
}
|
||||
}
|
||||
|
||||
private async getTsServerArgs(): Promise<string[]> {
|
||||
private async getTsServerArgs(currentVersion: TypeScriptVersion): Promise<string[]> {
|
||||
const args: string[] = []
|
||||
args.push('--allowLocalPluginLoads')
|
||||
|
||||
|
@ -809,13 +809,24 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
|||
|
||||
if (this.apiVersion.gte(API.v230)) {
|
||||
const pluginNames = this.pluginManager.plugins.map(x => x.name)
|
||||
const pluginRoot = this._configuration.tsServerPluginRoot
|
||||
const pluginPaths = pluginRoot ? [pluginRoot] : []
|
||||
let pluginPaths = this._configuration.tsServerPluginPaths
|
||||
pluginPaths = pluginPaths.reduce((p, c) => {
|
||||
if (path.isAbsolute(c)) {
|
||||
p.push(c)
|
||||
} else {
|
||||
let roots = workspace.workspaceFolders.map(o => Uri.parse(o.uri).fsPath)
|
||||
p.push(...roots.map(r => path.join(r, c)))
|
||||
}
|
||||
return p
|
||||
}, [])
|
||||
|
||||
if (pluginNames.length) {
|
||||
const isUsingBundledTypeScriptVersion = currentVersion.path == this.versionProvider.bundledVersion.path
|
||||
args.push('--globalPlugins', pluginNames.join(','))
|
||||
for (const plugin of this.pluginManager.plugins) {
|
||||
pluginPaths.push(plugin.path)
|
||||
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
|
||||
pluginPaths.push(plugin.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ export class TypeScriptServiceConfiguration {
|
|||
return this._configuration.get<string>('typingsCacheLocation', '')
|
||||
}
|
||||
|
||||
public get tsServerPluginRoot(): string | null {
|
||||
return this._configuration.get<string | null>('tsServerPluginRoot', null)
|
||||
public get tsServerPluginPaths(): string[] {
|
||||
return this._configuration.get<string[]>('pluginPaths', [])
|
||||
}
|
||||
|
||||
public get checkJs(): boolean {
|
||||
|
|
Loading…
Reference in a new issue