|
@@ -226,6 +226,73 @@ interface OutputFile {
|
|
text: string;
|
|
text: string;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+export interface ModeConfiguration {
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in completionItemProvider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly completionItems?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in hoverProvider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly hovers?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in documentSymbolProvider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly documentSymbols?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in definitions provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly definitions?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in references provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly references?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in references provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly documentHighlights?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in rename provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly rename?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in diagnostic provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly diagnostics?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in document formatting range edit provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly documentRangeFormattingEdits?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in signature help provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly signatureHelp?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in onType formatting edit provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly onTypeFormattingEdits?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in code actions provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly codeActions?: boolean;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Defines whether the built-in inlay hints provider is enabled.
|
|
|
|
+ */
|
|
|
|
+ readonly inlayHints?: boolean;
|
|
|
|
+}
|
|
|
|
+
|
|
export interface LanguageServiceDefaults {
|
|
export interface LanguageServiceDefaults {
|
|
/**
|
|
/**
|
|
* Event fired when compiler options or diagnostics options are changed.
|
|
* Event fired when compiler options or diagnostics options are changed.
|
|
@@ -241,6 +308,9 @@ export interface LanguageServiceDefaults {
|
|
|
|
|
|
readonly inlayHintsOptions: InlayHintsOptions;
|
|
readonly inlayHintsOptions: InlayHintsOptions;
|
|
|
|
|
|
|
|
+ readonly modeConfiguration: ModeConfiguration;
|
|
|
|
+ setModeConfiguration(modeConfiguration: ModeConfiguration): void;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Get the current extra libs registered with the language service.
|
|
* Get the current extra libs registered with the language service.
|
|
*/
|
|
*/
|
|
@@ -491,12 +561,14 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
private _workerOptions!: WorkerOptions;
|
|
private _workerOptions!: WorkerOptions;
|
|
private _onDidExtraLibsChangeTimeout: number;
|
|
private _onDidExtraLibsChangeTimeout: number;
|
|
private _inlayHintsOptions!: InlayHintsOptions;
|
|
private _inlayHintsOptions!: InlayHintsOptions;
|
|
|
|
+ private _modeConfiguration!: ModeConfiguration;
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
compilerOptions: CompilerOptions,
|
|
compilerOptions: CompilerOptions,
|
|
diagnosticsOptions: DiagnosticsOptions,
|
|
diagnosticsOptions: DiagnosticsOptions,
|
|
workerOptions: WorkerOptions,
|
|
workerOptions: WorkerOptions,
|
|
- inlayHintsOptions: InlayHintsOptions
|
|
|
|
|
|
+ inlayHintsOptions: InlayHintsOptions,
|
|
|
|
+ modeConfiguration: ModeConfiguration
|
|
) {
|
|
) {
|
|
this._extraLibs = Object.create(null);
|
|
this._extraLibs = Object.create(null);
|
|
this._removedExtraLibs = Object.create(null);
|
|
this._removedExtraLibs = Object.create(null);
|
|
@@ -505,6 +577,7 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
this.setDiagnosticsOptions(diagnosticsOptions);
|
|
this.setDiagnosticsOptions(diagnosticsOptions);
|
|
this.setWorkerOptions(workerOptions);
|
|
this.setWorkerOptions(workerOptions);
|
|
this.setInlayHintsOptions(inlayHintsOptions);
|
|
this.setInlayHintsOptions(inlayHintsOptions);
|
|
|
|
+ this.setModeConfiguration(modeConfiguration);
|
|
this._onDidExtraLibsChangeTimeout = -1;
|
|
this._onDidExtraLibsChangeTimeout = -1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -516,6 +589,10 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
return this._onDidExtraLibsChange.event;
|
|
return this._onDidExtraLibsChange.event;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ get modeConfiguration(): ModeConfiguration {
|
|
|
|
+ return this._modeConfiguration;
|
|
|
|
+ }
|
|
|
|
+
|
|
get workerOptions(): WorkerOptions {
|
|
get workerOptions(): WorkerOptions {
|
|
return this._workerOptions;
|
|
return this._workerOptions;
|
|
}
|
|
}
|
|
@@ -650,22 +727,45 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
|
getEagerModelSync() {
|
|
getEagerModelSync() {
|
|
return this._eagerModelSync;
|
|
return this._eagerModelSync;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ setModeConfiguration(modeConfiguration: ModeConfiguration): void {
|
|
|
|
+ this._modeConfiguration = modeConfiguration || Object.create(null);
|
|
|
|
+ this._onDidChange.fire(undefined);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
export const typescriptVersion: string = tsversion;
|
|
export const typescriptVersion: string = tsversion;
|
|
|
|
|
|
|
|
+const modeConfigurationDefault: Required<ModeConfiguration> = {
|
|
|
|
+ completionItems: true,
|
|
|
|
+ hovers: true,
|
|
|
|
+ documentSymbols: true,
|
|
|
|
+ definitions: true,
|
|
|
|
+ references: true,
|
|
|
|
+ documentHighlights: true,
|
|
|
|
+ rename: true,
|
|
|
|
+ diagnostics: true,
|
|
|
|
+ documentRangeFormattingEdits: true,
|
|
|
|
+ signatureHelp: true,
|
|
|
|
+ onTypeFormattingEdits: true,
|
|
|
|
+ codeActions: true,
|
|
|
|
+ inlayHints: true
|
|
|
|
+};
|
|
|
|
+
|
|
export const typescriptDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
|
|
export const typescriptDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
|
|
{ allowNonTsExtensions: true, target: ScriptTarget.Latest },
|
|
{ allowNonTsExtensions: true, target: ScriptTarget.Latest },
|
|
{ noSemanticValidation: false, noSyntaxValidation: false, onlyVisible: false },
|
|
{ noSemanticValidation: false, noSyntaxValidation: false, onlyVisible: false },
|
|
{},
|
|
{},
|
|
- {}
|
|
|
|
|
|
+ {},
|
|
|
|
+ modeConfigurationDefault
|
|
);
|
|
);
|
|
|
|
|
|
export const javascriptDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
|
|
export const javascriptDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
|
|
{ allowNonTsExtensions: true, allowJs: true, target: ScriptTarget.Latest },
|
|
{ allowNonTsExtensions: true, allowJs: true, target: ScriptTarget.Latest },
|
|
{ noSemanticValidation: true, noSyntaxValidation: false, onlyVisible: false },
|
|
{ noSemanticValidation: true, noSyntaxValidation: false, onlyVisible: false },
|
|
{},
|
|
{},
|
|
- {}
|
|
|
|
|
|
+ {},
|
|
|
|
+ modeConfigurationDefault
|
|
);
|
|
);
|
|
|
|
|
|
export const getTypeScriptWorker = (): Promise<(...uris: Uri[]) => Promise<TypeScriptWorker>> => {
|
|
export const getTypeScriptWorker = (): Promise<(...uris: Uri[]) => Promise<TypeScriptWorker>> => {
|