mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
Enable project wide JS/TS intellisense on web by default (#182812)
Fixes #170920 Enables this feature by default but also disables semantic errors. This is needed to avoid lots of annoying false positive errors for external modules. We plan to remove this limitation once type downloading support is enabled
This commit is contained in:
@@ -110,7 +110,8 @@ export interface TypeScriptServiceConfiguration {
|
||||
readonly implicitProjectConfiguration: ImplicitProjectConfiguration;
|
||||
readonly disableAutomaticTypeAcquisition: boolean;
|
||||
readonly useSyntaxServer: SyntaxServerConfiguration;
|
||||
readonly enableProjectWideIntellisenseOnWeb: boolean;
|
||||
readonly webProjectWideIntellisenseEnabled: boolean;
|
||||
readonly webProjectWideIntellisenseSuppressSemanticErrors: boolean;
|
||||
readonly enableProjectDiagnostics: boolean;
|
||||
readonly maxTsServerMemory: number;
|
||||
readonly enablePromptUseWorkspaceTsdk: boolean;
|
||||
@@ -141,7 +142,8 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
implicitProjectConfiguration: new ImplicitProjectConfiguration(configuration),
|
||||
disableAutomaticTypeAcquisition: this.readDisableAutomaticTypeAcquisition(configuration),
|
||||
useSyntaxServer: this.readUseSyntaxServer(configuration),
|
||||
enableProjectWideIntellisenseOnWeb: this.readEnableProjectWideIntellisenseOnWeb(configuration),
|
||||
webProjectWideIntellisenseEnabled: this.readWebProjectWideIntellisenseEnable(configuration),
|
||||
webProjectWideIntellisenseSuppressSemanticErrors: this.readWebProjectWideIntellisenseSuppressSemanticErrors(configuration),
|
||||
enableProjectDiagnostics: this.readEnableProjectDiagnostics(configuration),
|
||||
maxTsServerMemory: this.readMaxTsServerMemory(configuration),
|
||||
enablePromptUseWorkspaceTsdk: this.readEnablePromptUseWorkspaceTsdk(configuration),
|
||||
@@ -227,7 +229,11 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
return configuration.get<boolean>('typescript.tsserver.enableTracing', false);
|
||||
}
|
||||
|
||||
private readEnableProjectWideIntellisenseOnWeb(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.experimental.tsserver.web.enableProjectWideIntellisense', false);
|
||||
private readWebProjectWideIntellisenseEnable(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.tsserver.web.projectWideIntellisense.enabled', true);
|
||||
}
|
||||
|
||||
private readWebProjectWideIntellisenseSuppressSemanticErrors(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors', true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,18 @@
|
||||
import { basename, extname } from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { CommandManager } from './commands/commandManager';
|
||||
import { DocumentSelector } from './configuration/documentSelector';
|
||||
import * as fileSchemes from './configuration/fileSchemes';
|
||||
import { LanguageDescription } from './configuration/languageDescription';
|
||||
import { DiagnosticKind } from './languageFeatures/diagnostics';
|
||||
import FileConfigurationManager from './languageFeatures/fileConfigurationManager';
|
||||
import { TelemetryReporter } from './logging/telemetry';
|
||||
import { CachedResponse } from './tsServer/cachedResponse';
|
||||
import { ClientCapability } from './typescriptService';
|
||||
import TypeScriptServiceClient from './typescriptServiceClient';
|
||||
import TypingsStatus from './ui/typingsStatus';
|
||||
import { Disposable } from './utils/dispose';
|
||||
import { DocumentSelector } from './configuration/documentSelector';
|
||||
import * as fileSchemes from './configuration/fileSchemes';
|
||||
import { LanguageDescription } from './configuration/languageDescription';
|
||||
import { TelemetryReporter } from './logging/telemetry';
|
||||
import { isWeb } from './utils/platform';
|
||||
|
||||
|
||||
const validateSetting = 'validate.enable';
|
||||
@@ -139,6 +140,10 @@ export default class LanguageProvider extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (diagnosticsKind === DiagnosticKind.Semantic && isWeb() && this.client.configuration.webProjectWideIntellisenseSuppressSemanticErrors) {
|
||||
return;
|
||||
}
|
||||
|
||||
const config = vscode.workspace.getConfiguration(this.id, file);
|
||||
const reportUnnecessary = config.get<boolean>('showUnused', true);
|
||||
const reportDeprecated = config.get<boolean>('showDeprecated', true);
|
||||
|
||||
@@ -258,7 +258,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
readonly onDidChangeCapabilities = this._onDidChangeCapabilities.event;
|
||||
|
||||
private isProjectWideIntellisenseOnWebEnabled(): boolean {
|
||||
return isWebAndHasSharedArrayBuffers() && this._configuration.enableProjectWideIntellisenseOnWeb;
|
||||
return isWebAndHasSharedArrayBuffers() && this._configuration.webProjectWideIntellisenseEnabled;
|
||||
}
|
||||
|
||||
private cancelInflightRequestsForResource(resource: vscode.Uri): void {
|
||||
@@ -902,7 +902,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
const diagnosticEvent = event as Proto.DiagnosticEvent;
|
||||
if (diagnosticEvent.body?.diagnostics) {
|
||||
this._onDiagnosticsReceived.fire({
|
||||
kind: getDignosticsKind(event),
|
||||
kind: getDiagnosticsKind(event),
|
||||
resource: this.toResource(diagnosticEvent.body.file),
|
||||
diagnostics: diagnosticEvent.body.diagnostics
|
||||
});
|
||||
@@ -1089,7 +1089,7 @@ ${error.serverStack}
|
||||
};
|
||||
}
|
||||
|
||||
function getDignosticsKind(event: Proto.Event) {
|
||||
function getDiagnosticsKind(event: Proto.Event) {
|
||||
switch (event.event) {
|
||||
case 'syntaxDiag': return DiagnosticKind.Syntax;
|
||||
case 'semanticDiag': return DiagnosticKind.Semantic;
|
||||
|
||||
Reference in New Issue
Block a user