add typescript.preferences.includePackageJsonAutoImports configuration
This commit is contained in:
parent
5a8c68fc60
commit
4d78b618e4
4 changed files with 27 additions and 0 deletions
|
@ -137,6 +137,9 @@ for guide of coc.nvim's configuration.
|
|||
- `typescript.preferences.importModuleSpecifier` default: `"auto"`
|
||||
- `typescript.preferences.importModuleSpecifierEnding` default: `"auto"`
|
||||
- `typescript.preferences.quoteStyle` default: `"single"`
|
||||
- `typescript.preferences.includePackageJsonAutoImports`: Enable/disable
|
||||
searching `package.json` dependencies for available auto imports, default:
|
||||
`"auto"`
|
||||
- `typescript.suggestionActions.enabled`:Enable/disable suggestion diagnostics
|
||||
for TypeScript files in the editor. Requires using TypeScript 2.8 or newer in
|
||||
the workspace., default: `true`
|
||||
|
|
16
package.json
16
package.json
|
@ -330,6 +330,22 @@
|
|||
"description": "Preferred style for JSX attribute completions.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"typescript.preferences.includePackageJsonAutoImports": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"auto",
|
||||
"on",
|
||||
"off"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"Search dependencies based on estimated performance impact.",
|
||||
"Always search dependencies.",
|
||||
"Never search dependencies."
|
||||
],
|
||||
"default": "auto",
|
||||
"markdownDescription": "Enable/disable searching `package.json` dependencies for available auto imports.",
|
||||
"scope": "window"
|
||||
},
|
||||
"typescript.preferences.quoteStyle": {
|
||||
"type": "string",
|
||||
"default": "auto",
|
||||
|
|
|
@ -408,6 +408,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
|||
preferences: {
|
||||
providePrefixAndSuffixTextForRename: true,
|
||||
allowRenameOfImportPath: true,
|
||||
includePackageJsonAutoImports: this._configuration.includePackageJsonAutoImports
|
||||
},
|
||||
watchOptions
|
||||
}
|
||||
|
|
|
@ -40,14 +40,21 @@ export namespace TsServerLogLevel {
|
|||
|
||||
export class TypeScriptServiceConfiguration {
|
||||
private _configuration: WorkspaceConfiguration
|
||||
private _includePackageJsonAutoImports: 'auto' | 'on' | 'off'
|
||||
private constructor() {
|
||||
this._configuration = workspace.getConfiguration('tsserver')
|
||||
this._includePackageJsonAutoImports = workspace.getConfiguration('typescript').get<'auto' | 'on' | 'off'>('preferences.includePackageJsonAutoImports')
|
||||
|
||||
workspace.onDidChangeConfiguration(() => {
|
||||
this._configuration = workspace.getConfiguration('tsserver')
|
||||
this._includePackageJsonAutoImports = workspace.getConfiguration('typescript').get<'auto' | 'on' | 'off'>('preferences.includePackageJsonAutoImports')
|
||||
})
|
||||
}
|
||||
|
||||
public get includePackageJsonAutoImports(): 'auto' | 'on' | 'off' {
|
||||
return this._includePackageJsonAutoImports
|
||||
}
|
||||
|
||||
public get locale(): string | null {
|
||||
return this._configuration.get<string | null>('locale', null)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue