Add typescript.check.npmIsInstalled configuration
This commit is contained in:
parent
43e6f62e87
commit
3bd84b1ead
5 changed files with 26 additions and 6 deletions
|
@ -132,6 +132,9 @@ for guide of coc.nvim's configuration.
|
||||||
directory. These trace files can be used to diagnose TS Server performance
|
directory. These trace files can be used to diagnose TS Server performance
|
||||||
issues. The log may contain file paths, source code, and other potentially
|
issues. The log may contain file paths, source code, and other potentially
|
||||||
sensitive information from your project, default: `false`
|
sensitive information from your project, default: `false`
|
||||||
|
- `typescript.check.npmIsInstalled`: Check if npm is installed for [Automatic
|
||||||
|
Type
|
||||||
|
Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).
|
||||||
- `typescript.updateImportsOnFileMove.enable`:Enable update imports on file
|
- `typescript.updateImportsOnFileMove.enable`:Enable update imports on file
|
||||||
move., default: `true`
|
move., default: `true`
|
||||||
- `typescript.implementationsCodeLens.enable`:Enable codeLens for
|
- `typescript.implementationsCodeLens.enable`:Enable codeLens for
|
||||||
|
|
|
@ -258,7 +258,7 @@
|
||||||
},
|
},
|
||||||
"tsserver.disableAutomaticTypeAcquisition": {
|
"tsserver.disableAutomaticTypeAcquisition": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": false,
|
||||||
"description": "Disable download of typings"
|
"description": "Disable download of typings"
|
||||||
},
|
},
|
||||||
"tsserver.useBatchedBufferSync": {
|
"tsserver.useBatchedBufferSync": {
|
||||||
|
@ -266,6 +266,12 @@
|
||||||
"default": true,
|
"default": true,
|
||||||
"description": "Use batched buffer sync support."
|
"description": "Use batched buffer sync support."
|
||||||
},
|
},
|
||||||
|
"typescript.check.npmIsInstalled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true,
|
||||||
|
"markdownDescription": "Check if npm is installed for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).",
|
||||||
|
"scope": "window"
|
||||||
|
},
|
||||||
"typescript.showUnused": {
|
"typescript.showUnused": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
|
|
|
@ -177,7 +177,7 @@ export default class FileConfigurationManager {
|
||||||
const config = workspace.getConfiguration(`${language}.preferences`, uri)
|
const config = workspace.getConfiguration(`${language}.preferences`, uri)
|
||||||
const suggestConfig = this.getCompleteOptions(language)
|
const suggestConfig = this.getCompleteOptions(language)
|
||||||
// getImportModuleSpecifierEndingPreference available on ts 2.9.0
|
// getImportModuleSpecifierEndingPreference available on ts 2.9.0
|
||||||
const preferences: Proto.UserPreferences & { importModuleSpecifierEnding?: string } = {
|
const preferences: Proto.UserPreferences = {
|
||||||
quotePreference: this.getQuoteStyle(config),
|
quotePreference: this.getQuoteStyle(config),
|
||||||
importModuleSpecifierPreference: getImportModuleSpecifier(config) as any,
|
importModuleSpecifierPreference: getImportModuleSpecifier(config) as any,
|
||||||
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config),
|
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config),
|
||||||
|
@ -191,6 +191,8 @@ export default class FileConfigurationManager {
|
||||||
includeCompletionsForImportStatements: suggestConfig.includeCompletionsForImportStatements,
|
includeCompletionsForImportStatements: suggestConfig.includeCompletionsForImportStatements,
|
||||||
includeCompletionsWithClassMemberSnippets: suggestConfig.includeCompletionsWithClassMemberSnippets,
|
includeCompletionsWithClassMemberSnippets: suggestConfig.includeCompletionsWithClassMemberSnippets,
|
||||||
includeCompletionsWithSnippetText: suggestConfig.includeCompletionsWithSnippetText,
|
includeCompletionsWithSnippetText: suggestConfig.includeCompletionsWithSnippetText,
|
||||||
|
allowIncompleteCompletions: true,
|
||||||
|
displayPartsForJSDoc: true,
|
||||||
}
|
}
|
||||||
return preferences
|
return preferences
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ export class TypeScriptServiceConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public get disableAutomaticTypeAcquisition(): boolean {
|
public get disableAutomaticTypeAcquisition(): boolean {
|
||||||
return this._configuration.get<boolean>('disableAutomaticTypeAcquisition', true)
|
return this._configuration.get<boolean>('disableAutomaticTypeAcquisition', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
public get formatOnType(): boolean {
|
public get formatOnType(): boolean {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { StatusBarItem, window } from 'coc.nvim'
|
import { StatusBarItem, workspace, window } from 'coc.nvim'
|
||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
@ -110,10 +110,19 @@ export class AtaProgressReporter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onTypesInstallerInitializationFailed() { // tslint:disable-line
|
private async onTypesInstallerInitializationFailed() { // tslint:disable-line
|
||||||
this.statusItem.hide()
|
this.statusItem.hide()
|
||||||
if (!this._invalid) {
|
if (!this._invalid) {
|
||||||
window.showMessage('Could not install typings files for JavaScript language features. Please ensure that NPM is installed', 'error')
|
const config = workspace.getConfiguration('typescript')
|
||||||
|
if (config.get<boolean>('check.npmIsInstalled', true)) {
|
||||||
|
const dontShowAgain = "Don't Show Again"
|
||||||
|
const selected = await window.showWarningMessage(
|
||||||
|
"Could not install typings files for JavaScript language features. Please ensure that NPM is installed or configure 'typescript.npm' in your user settings. visit https://go.microsoft.com/fwlink/?linkid=847635 to learn more.",
|
||||||
|
dontShowAgain)
|
||||||
|
if (selected === dontShowAgain) {
|
||||||
|
config.update('check.npmIsInstalled', false, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._invalid = true
|
this._invalid = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue