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.npm`:Executable path of npm for download typings, default: `""`
|
||||||
- `tsserver.log`:Log level of tsserver, default: `"off"`
|
- `tsserver.log`:Log level of tsserver, default: `"off"`
|
||||||
- `tsserver.trace.server`:Trace 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.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.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`
|
- `tsserver.reportStyleChecksAsWarnings` default: `true`
|
||||||
|
|
|
@ -211,13 +211,13 @@
|
||||||
],
|
],
|
||||||
"description": "Trace level of tsserver"
|
"description": "Trace level of tsserver"
|
||||||
},
|
},
|
||||||
"tsserver.pluginRoot": {
|
"tsserver.pluginPaths": {
|
||||||
"type": "string",
|
"type": "array",
|
||||||
"default": [],
|
"default": [],
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": "Folder contains tsserver plugins"
|
"description": "Folders contains tsserver plugins"
|
||||||
},
|
},
|
||||||
"tsserver.debugPort": {
|
"tsserver.debugPort": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
|
|
@ -281,7 +281,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||||
this._tscPath = currentVersion.tscPath
|
this._tscPath = currentVersion.tscPath
|
||||||
this.versionStatus.onDidChangeTypeScriptVersion(currentVersion)
|
this.versionStatus.onDidChangeTypeScriptVersion(currentVersion)
|
||||||
this.lastError = null
|
this.lastError = null
|
||||||
const tsServerForkArgs = await this.getTsServerArgs()
|
const tsServerForkArgs = await this.getTsServerArgs(currentVersion)
|
||||||
const debugPort = this._configuration.debugPort
|
const debugPort = this._configuration.debugPort
|
||||||
const maxTsServerMemory = this._configuration.maxTsServerMemory
|
const maxTsServerMemory = this._configuration.maxTsServerMemory
|
||||||
const options = {
|
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[] = []
|
const args: string[] = []
|
||||||
args.push('--allowLocalPluginLoads')
|
args.push('--allowLocalPluginLoads')
|
||||||
|
|
||||||
|
@ -809,13 +809,24 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||||
|
|
||||||
if (this.apiVersion.gte(API.v230)) {
|
if (this.apiVersion.gte(API.v230)) {
|
||||||
const pluginNames = this.pluginManager.plugins.map(x => x.name)
|
const pluginNames = this.pluginManager.plugins.map(x => x.name)
|
||||||
const pluginRoot = this._configuration.tsServerPluginRoot
|
let pluginPaths = this._configuration.tsServerPluginPaths
|
||||||
const pluginPaths = pluginRoot ? [pluginRoot] : []
|
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) {
|
if (pluginNames.length) {
|
||||||
|
const isUsingBundledTypeScriptVersion = currentVersion.path == this.versionProvider.bundledVersion.path
|
||||||
args.push('--globalPlugins', pluginNames.join(','))
|
args.push('--globalPlugins', pluginNames.join(','))
|
||||||
for (const plugin of this.pluginManager.plugins) {
|
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', '')
|
return this._configuration.get<string>('typingsCacheLocation', '')
|
||||||
}
|
}
|
||||||
|
|
||||||
public get tsServerPluginRoot(): string | null {
|
public get tsServerPluginPaths(): string[] {
|
||||||
return this._configuration.get<string | null>('tsServerPluginRoot', null)
|
return this._configuration.get<string[]>('pluginPaths', [])
|
||||||
}
|
}
|
||||||
|
|
||||||
public get checkJs(): boolean {
|
public get checkJs(): boolean {
|
||||||
|
|
Loading…
Add table
Reference in a new issue