Allow configuring TS Server watch options through VS Code
Fixes #89381 Given that these are advanced options, we require editing them in the json file instead of using our settings UI
This commit is contained in:
parent
ea54f48dda
commit
718331d6f3
|
@ -736,6 +736,65 @@
|
|||
"default": false,
|
||||
"description": "%configuration.tsserver.experimental.enableProjectDiagnostics%",
|
||||
"scope": "window"
|
||||
},
|
||||
"typescript.tsserver.watchOptions": {
|
||||
"type": "object",
|
||||
"description": "%configuration.tsserver.watchOptions%",
|
||||
"scope": "window",
|
||||
"properties": {
|
||||
"watchFile": {
|
||||
"type": "string",
|
||||
"description": "%configuration.tsserver.watchOptions.watchFile%",
|
||||
"enum": [
|
||||
"fixedPollingInterval",
|
||||
"priorityPollingInterval",
|
||||
"dynamicPriorityPolling",
|
||||
"useFsEvents",
|
||||
"useFsEventsOnParentDirectory"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"%configuration.tsserver.watchOptions.watchFile.fixedPollingInterval%",
|
||||
"%configuration.tsserver.watchOptions.watchFile.priorityPollingInterval%",
|
||||
"%configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling%",
|
||||
"%configuration.tsserver.watchOptions.watchFile.useFsEvents%",
|
||||
"%configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory%"
|
||||
],
|
||||
"default": "useFsEvents"
|
||||
},
|
||||
"watchDirectory": {
|
||||
"type": "string",
|
||||
"description": "%configuration.tsserver.watchOptions.watchDirectory%",
|
||||
"enum": [
|
||||
"fixedPollingInterval",
|
||||
"dynamicPriorityPolling",
|
||||
"useFsEvents"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"%configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval%",
|
||||
"%configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling%",
|
||||
"%configuration.tsserver.watchOptions.watchDirectory.useFsEvents%"
|
||||
],
|
||||
"default": "useFsEvents"
|
||||
},
|
||||
"fallbackPolling": {
|
||||
"type": "string",
|
||||
"description": "%configuration.tsserver.watchOptions.fallbackPolling%",
|
||||
"enum": [
|
||||
"fixedPollingInterval",
|
||||
"priorityPollingInterval",
|
||||
"dynamicPriorityPolling"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval",
|
||||
"configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval",
|
||||
"configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"
|
||||
]
|
||||
},
|
||||
"synchronousWatchDirectory": {
|
||||
"type": "boolean",
|
||||
"description": "%configuration.tsserver.watchOptions.synchronousWatchDirectory%"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -78,6 +78,22 @@
|
|||
"typescript.suggest.enabled": "Enabled/disable autocomplete suggestions.",
|
||||
"configuration.surveys.enabled": "Enabled/disable occasional surveys that help us improve VS Code's JavaScript and TypeScript support.",
|
||||
"configuration.suggest.completeJSDocs": "Enable/disable suggestion to complete JSDoc comments.",
|
||||
"configuration.tsserver.watchOptions": "Configure which watching strategies should be used to keep track of files and directories. Requires using TypeScript 3.8+ in the workspace.",
|
||||
"configuration.tsserver.watchOptions.watchFile": "Strategy for how individual files are watched.",
|
||||
"configuration.tsserver.watchOptions.watchFile.fixedPollingInterval": "Check every file for changes several times a second at a fixed interval.",
|
||||
"configuration.tsserver.watchOptions.watchFile.priorityPollingInterval": "Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.",
|
||||
"configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling": "Use a dynamic queue where less-frequently modified files will be checked less often.",
|
||||
"configuration.tsserver.watchOptions.watchFile.useFsEvents": "Attempt to use the operating system/file system’s native events for file changes.",
|
||||
"configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory": "Attempt to use the operating system/file system’s native events to listen for changes on a file’s containing directories. This can use fewer file watchers, but might be less accurate.",
|
||||
"configuration.tsserver.watchOptions.watchDirectory": "Strategy for how entire directory trees are watched under systems that lack recursive file-watching functionality.",
|
||||
"configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval": "Check every directory for changes several times a second at a fixed interval.",
|
||||
"configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling": "Use a dynamic queue where less-frequently modified directories will be checked less often.",
|
||||
"configuration.tsserver.watchOptions.watchDirectory.useFsEvents": "Attempt to use the operating system/file system’s native events for directory changes.",
|
||||
"configuration.tsserver.watchOptions.fallbackPolling": "When using file system events, this option specifies the polling strategy that gets used when the system runs out of native file watchers and/or doesn’t support native file watchers.",
|
||||
"configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval": "Check every file for changes several times a second at a fixed interval.",
|
||||
"configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval": "Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.",
|
||||
"configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling ": "Use a dynamic queue where less-frequently modified files will be checked less often.",
|
||||
"configuration.tsserver.watchOptions.synchronousWatchDirectory": "Disable deferred watching on directories. Deferred watching is useful when lots of file changes might occur at once (e.g. a change in node_modules from running npm install), but you might want to disable it with this flag for some less-common setups.",
|
||||
"typescript.preferences.renameShorthandProperties": "Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace.",
|
||||
"codeActions.refactor.extract.constant.title": "Extract constant",
|
||||
"codeActions.refactor.extract.constant.description": "Extract expression to constant.",
|
||||
|
|
|
@ -477,12 +477,17 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||
private serviceStarted(resendModels: boolean): void {
|
||||
this.bufferSyncSupport.reset();
|
||||
|
||||
const watchOptions = this.apiVersion.gte(API.v380)
|
||||
? vscode.workspace.getConfiguration('typescript').get<Proto.WatchOptions | undefined>('tsserver.watchOptions')
|
||||
: undefined;
|
||||
|
||||
const configureOptions: Proto.ConfigureRequestArguments = {
|
||||
hostInfo: 'vscode',
|
||||
preferences: {
|
||||
providePrefixAndSuffixTextForRename: true,
|
||||
allowRenameOfImportPath: true,
|
||||
}
|
||||
},
|
||||
watchOptions
|
||||
};
|
||||
this.executeWithoutWaitingForResponse('configure', configureOptions);
|
||||
this.setCompilerOptionsForInferredProjects(this._configuration);
|
||||
|
|
Loading…
Reference in a new issue