mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 08:08:39 +01:00
Enable web type acquisition by default for js/ts (#212370)
* Enable web type acquisition by default for js/ts Fixes #182791 Fixes #172887 * Cleanup
This commit is contained in:
@@ -112,7 +112,7 @@ export interface TypeScriptServiceConfiguration {
|
||||
readonly useSyntaxServer: SyntaxServerConfiguration;
|
||||
readonly webProjectWideIntellisenseEnabled: boolean;
|
||||
readonly webProjectWideIntellisenseSuppressSemanticErrors: boolean;
|
||||
readonly webExperimentalTypeAcquisition: boolean;
|
||||
readonly webTypeAcquisitionEnabled: boolean;
|
||||
readonly enableDiagnosticsTelemetry: boolean;
|
||||
readonly enableProjectDiagnostics: boolean;
|
||||
readonly maxTsServerMemory: number;
|
||||
@@ -150,7 +150,7 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
useSyntaxServer: this.readUseSyntaxServer(configuration),
|
||||
webProjectWideIntellisenseEnabled: this.readWebProjectWideIntellisenseEnable(configuration),
|
||||
webProjectWideIntellisenseSuppressSemanticErrors: this.readWebProjectWideIntellisenseSuppressSemanticErrors(configuration),
|
||||
webExperimentalTypeAcquisition: this.readWebExperimentalTypeAcquisition(configuration),
|
||||
webTypeAcquisitionEnabled: this.readWebTypeAcquisition(configuration),
|
||||
enableDiagnosticsTelemetry: this.readEnableDiagnosticsTelemetry(configuration),
|
||||
enableProjectDiagnostics: this.readEnableProjectDiagnostics(configuration),
|
||||
maxTsServerMemory: this.readMaxTsServerMemory(configuration),
|
||||
@@ -187,10 +187,6 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
return configuration.get<boolean>('typescript.disableAutomaticTypeAcquisition', false);
|
||||
}
|
||||
|
||||
protected readWebExperimentalTypeAcquisition(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.experimental.tsserver.web.typeAcquisition.enabled', false);
|
||||
}
|
||||
|
||||
protected readLocale(configuration: vscode.WorkspaceConfiguration): string | null {
|
||||
const value = configuration.get<string>('typescript.locale', 'auto');
|
||||
return !value || value === 'auto' ? null : value;
|
||||
@@ -256,15 +252,19 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
return configuration.get<boolean>('typescript.tsserver.enableTracing', false);
|
||||
}
|
||||
|
||||
private readWorkspaceSymbolsExcludeLibrarySymbols(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.workspaceSymbols.excludeLibrarySymbols', true);
|
||||
}
|
||||
|
||||
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);
|
||||
return configuration.get<boolean>('typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors', false);
|
||||
}
|
||||
|
||||
private readWorkspaceSymbolsExcludeLibrarySymbols(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.workspaceSymbols.excludeLibrarySymbols', true);
|
||||
private readWebTypeAcquisition(configuration: vscode.WorkspaceConfiguration): boolean {
|
||||
return configuration.get<boolean>('typescript.tsserver.web.typeAcquisition.enabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<Api> {
|
||||
new TypeScriptVersion(
|
||||
TypeScriptVersionSource.Bundled,
|
||||
vscode.Uri.joinPath(context.extensionUri, 'dist/browser/typescript/tsserver.web.js').toString(),
|
||||
API.fromSimpleString('5.3.2')));
|
||||
API.fromSimpleString('5.4.5')));
|
||||
|
||||
let experimentTelemetryReporter: IExperimentationTelemetryReporter | undefined;
|
||||
const packageInfo = getPackageInfo(context);
|
||||
@@ -118,15 +118,21 @@ async function startPreloadWorkspaceContentsIfNeeded(context: vscode.ExtensionCo
|
||||
return;
|
||||
}
|
||||
|
||||
const workspaceUri = vscode.workspace.workspaceFolders?.at(0)?.uri;
|
||||
if (!workspaceUri || workspaceUri.scheme !== 'vscode-vfs' || !workspaceUri.authority.startsWith('github')) {
|
||||
logger.info(`Skipped loading workspace contents for repository ${workspaceUri?.toString()}`);
|
||||
if (!vscode.workspace.workspaceFolders) {
|
||||
return;
|
||||
}
|
||||
|
||||
const loader = new RemoteWorkspaceContentsPreloader(workspaceUri, logger);
|
||||
context.subscriptions.push(loader);
|
||||
return loader.triggerPreload();
|
||||
await Promise.all(vscode.workspace.workspaceFolders.map(async folder => {
|
||||
const workspaceUri = folder.uri;
|
||||
if (workspaceUri.scheme !== 'vscode-vfs' || !workspaceUri.authority.startsWith('github')) {
|
||||
logger.info(`Skipped pre loading workspace contents for repository ${workspaceUri?.toString()}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const loader = new RemoteWorkspaceContentsPreloader(workspaceUri, logger);
|
||||
context.subscriptions.push(loader);
|
||||
await loader.triggerPreload();
|
||||
}));
|
||||
}
|
||||
|
||||
class RemoteWorkspaceContentsPreloader extends Disposable {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { ClientCapability } from './typescriptService';
|
||||
import TypeScriptServiceClient from './typescriptServiceClient';
|
||||
import TypingsStatus from './ui/typingsStatus';
|
||||
import { Disposable } from './utils/dispose';
|
||||
import { isWeb } from './utils/platform';
|
||||
import { isWeb, isWebAndHasSharedArrayBuffers } from './utils/platform';
|
||||
|
||||
|
||||
const validateSetting = 'validate.enable';
|
||||
@@ -142,8 +142,13 @@ export default class LanguageProvider extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (diagnosticsKind === DiagnosticKind.Semantic && isWeb() && this.client.configuration.webProjectWideIntellisenseSuppressSemanticErrors) {
|
||||
return;
|
||||
if (diagnosticsKind === DiagnosticKind.Semantic && isWeb()) {
|
||||
if (!isWebAndHasSharedArrayBuffers()
|
||||
|| this.client.configuration.webProjectWideIntellisenseSuppressSemanticErrors
|
||||
|| !this.client.configuration.webProjectWideIntellisenseEnabled
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable semantic errors in notebooks until we have better notebook support
|
||||
|
||||
@@ -50,7 +50,7 @@ export class WorkerServerProcessFactory implements TsServerProcessFactory {
|
||||
// Explicitly give TS Server its path so it can load local resources
|
||||
'--executingFilePath', tsServerPath,
|
||||
];
|
||||
if (_configuration.webExperimentalTypeAcquisition) {
|
||||
if (_configuration.webTypeAcquisitionEnabled) {
|
||||
launchArgs.push('--experimentalTypeAcquisition');
|
||||
}
|
||||
return new WorkerServerProcess(kind, tsServerPath, this._extensionUri, launchArgs, tsServerLog, this._logger);
|
||||
|
||||
Reference in New Issue
Block a user