mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 22:41:31 +01:00
Introduce typescript.tsserver.useSyntaxServer
Fixes #131142 This setting replaces `typescript.tsserver.useSeparateSyntaxServer` and officailly documents the syntax only mode on desktop
This commit is contained in:
@@ -8,7 +8,7 @@ import * as vscode from 'vscode';
|
||||
import { OngoingRequestCancellerFactory } from '../tsServer/cancellation';
|
||||
import { ClientCapabilities, ClientCapability, ServerType } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { SeparateSyntaxServerConfiguration, TsServerLogLevel, TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
import { SyntaxServerConfiguration, TsServerLogLevel, TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
import { Logger } from '../utils/logger';
|
||||
import { isWeb } from '../utils/platform';
|
||||
import { TypeScriptPluginPathsProvider } from '../utils/pluginPathsProvider';
|
||||
@@ -98,14 +98,14 @@ export class TypeScriptServerSpawner {
|
||||
return CompositeServerType.SyntaxOnly;
|
||||
}
|
||||
|
||||
switch (configuration.separateSyntaxServer) {
|
||||
case SeparateSyntaxServerConfiguration.ForAllRequests:
|
||||
switch (configuration.useSyntaxServer) {
|
||||
case SyntaxServerConfiguration.Always:
|
||||
return CompositeServerType.SyntaxOnly;
|
||||
|
||||
case SeparateSyntaxServerConfiguration.Disabled:
|
||||
case SyntaxServerConfiguration.Never:
|
||||
return CompositeServerType.Single;
|
||||
|
||||
case SeparateSyntaxServerConfiguration.Enabled:
|
||||
case SyntaxServerConfiguration.Auto:
|
||||
if (version.apiVersion?.gte(API.v340)) {
|
||||
return version.apiVersion?.gte(API.v400)
|
||||
? CompositeServerType.DynamicSeparateSyntax
|
||||
|
||||
@@ -19,7 +19,7 @@ import { TypeScriptVersionManager } from './tsServer/versionManager';
|
||||
import { ITypeScriptVersionProvider, TypeScriptVersion } from './tsServer/versionProvider';
|
||||
import { ClientCapabilities, ClientCapability, ExecConfig, ITypeScriptServiceClient, ServerResponse, TypeScriptRequests } from './typescriptService';
|
||||
import API from './utils/api';
|
||||
import { areServiceConfigurationsEqual, SeparateSyntaxServerConfiguration, ServiceConfigurationProvider, TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
|
||||
import { areServiceConfigurationsEqual, SyntaxServerConfiguration, ServiceConfigurationProvider, TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
|
||||
import { Disposable } from './utils/dispose';
|
||||
import * as fileSchemes from './utils/fileSchemes';
|
||||
import { Logger } from './utils/logger';
|
||||
@@ -225,7 +225,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
}
|
||||
|
||||
public get capabilities() {
|
||||
if (this._configuration.separateSyntaxServer === SeparateSyntaxServerConfiguration.ForAllRequests) {
|
||||
if (this._configuration.useSyntaxServer === SyntaxServerConfiguration.Always) {
|
||||
return new ClientCapabilities(
|
||||
ClientCapability.Syntax,
|
||||
ClientCapability.EnhancedSyntax);
|
||||
|
||||
@@ -43,11 +43,11 @@ export namespace TsServerLogLevel {
|
||||
}
|
||||
}
|
||||
|
||||
export const enum SeparateSyntaxServerConfiguration {
|
||||
Disabled,
|
||||
Enabled,
|
||||
export const enum SyntaxServerConfiguration {
|
||||
Never,
|
||||
Always,
|
||||
/** Use a single syntax server for every request, even on desktop */
|
||||
ForAllRequests,
|
||||
Auto,
|
||||
}
|
||||
|
||||
export class ImplicitProjectConfiguration {
|
||||
@@ -96,7 +96,7 @@ export interface TypeScriptServiceConfiguration {
|
||||
readonly tsServerPluginPaths: readonly string[];
|
||||
readonly implicitProjectConfiguration: ImplicitProjectConfiguration;
|
||||
readonly disableAutomaticTypeAcquisition: boolean;
|
||||
readonly separateSyntaxServer: SeparateSyntaxServerConfiguration;
|
||||
readonly useSyntaxServer: SyntaxServerConfiguration;
|
||||
readonly enableProjectDiagnostics: boolean;
|
||||
readonly maxTsServerMemory: number;
|
||||
readonly enablePromptUseWorkspaceTsdk: boolean;
|
||||
@@ -126,7 +126,7 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
tsServerPluginPaths: this.readTsServerPluginPaths(configuration),
|
||||
implicitProjectConfiguration: new ImplicitProjectConfiguration(configuration),
|
||||
disableAutomaticTypeAcquisition: this.readDisableAutomaticTypeAcquisition(configuration),
|
||||
separateSyntaxServer: this.readUseSeparateSyntaxServer(configuration),
|
||||
useSyntaxServer: this.readUseSyntaxServer(configuration),
|
||||
enableProjectDiagnostics: this.readEnableProjectDiagnostics(configuration),
|
||||
maxTsServerMemory: this.readMaxTsServerMemory(configuration),
|
||||
enablePromptUseWorkspaceTsdk: this.readEnablePromptUseWorkspaceTsdk(configuration),
|
||||
@@ -160,15 +160,23 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
return configuration.get<string | null>('typescript.locale', null);
|
||||
}
|
||||
|
||||
protected readUseSeparateSyntaxServer(configuration: vscode.WorkspaceConfiguration): SeparateSyntaxServerConfiguration {
|
||||
const value = configuration.get<boolean | string>('typescript.tsserver.useSeparateSyntaxServer', true);
|
||||
if (value === 'forAllRequests') {
|
||||
return SeparateSyntaxServerConfiguration.ForAllRequests;
|
||||
protected readUseSyntaxServer(configuration: vscode.WorkspaceConfiguration): SyntaxServerConfiguration {
|
||||
const value = configuration.get<string>('typescript.tsserver.useSyntaxServer');
|
||||
switch (value) {
|
||||
case 'never': return SyntaxServerConfiguration.Never;
|
||||
case 'always': return SyntaxServerConfiguration.Always;
|
||||
case 'auto': return SyntaxServerConfiguration.Auto;
|
||||
}
|
||||
if (value === true) {
|
||||
return SeparateSyntaxServerConfiguration.Enabled;
|
||||
|
||||
// Fallback to deprecated setting
|
||||
const deprecatedValue = configuration.get<boolean | string>('typescript.tsserver.useSeparateSyntaxServer', true);
|
||||
if (deprecatedValue === 'forAllRequests') { // Undocumented setting
|
||||
return SyntaxServerConfiguration.Always;
|
||||
}
|
||||
return SeparateSyntaxServerConfiguration.Disabled;
|
||||
if (deprecatedValue === true) {
|
||||
return SyntaxServerConfiguration.Auto;
|
||||
}
|
||||
return SyntaxServerConfiguration.Never;
|
||||
}
|
||||
|
||||
protected readEnableProjectDiagnostics(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
|
||||
Reference in New Issue
Block a user