Merge branch 'main' into ai-codefixes

This commit is contained in:
Nathan Shively-Sanders
2023-09-14 11:24:50 -07:00
589 changed files with 12513 additions and 7238 deletions

View File

@@ -122,6 +122,7 @@ export interface TypeScriptServiceConfiguration {
readonly enableTsServerTracing: boolean;
readonly localNodePath: string | null;
readonly globalNodePath: string | null;
readonly workspaceSymbolsExcludeLibrarySymbols: boolean;
}
export function areServiceConfigurationsEqual(a: TypeScriptServiceConfiguration, b: TypeScriptServiceConfiguration): boolean {
@@ -158,6 +159,7 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
enableTsServerTracing: this.readEnableTsServerTracing(configuration),
localNodePath: this.readLocalNodePath(configuration),
globalNodePath: this.readGlobalNodePath(configuration),
workspaceSymbolsExcludeLibrarySymbols: this.readWorkspaceSymbolsExcludeLibrarySymbols(configuration),
};
}
@@ -255,4 +257,8 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
private readWebProjectWideIntellisenseSuppressSemanticErrors(configuration: vscode.WorkspaceConfiguration): boolean {
return configuration.get<boolean>('typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors', true);
}
private readWorkspaceSymbolsExcludeLibrarySymbols(configuration: vscode.WorkspaceConfiguration): boolean {
return configuration.get<boolean>('typescript.workspaceSymbols.excludeLibrarySymbols', true);
}
}

View File

@@ -56,38 +56,39 @@ class UpdateImportsOnFileRenameHandler extends Disposable {
super();
this._register(vscode.workspace.onDidRenameFiles(async (e) => {
const [{ newUri, oldUri }] = e.files;
const newFilePath = this.client.toTsFilePath(newUri);
if (!newFilePath) {
return;
for (const { newUri, oldUri } of e.files) {
const newFilePath = this.client.toTsFilePath(newUri);
if (!newFilePath) {
continue;
}
const oldFilePath = this.client.toTsFilePath(oldUri);
if (!oldFilePath) {
continue;
}
const config = this.getConfiguration(newUri);
const setting = config.get<UpdateImportsOnFileMoveSetting>(updateImportsOnFileMoveName);
if (setting === UpdateImportsOnFileMoveSetting.Never) {
continue;
}
// Try to get a js/ts file that is being moved
// For directory moves, this returns a js/ts file under the directory.
const jsTsFileThatIsBeingMoved = await this.getJsTsFileBeingMoved(newUri);
if (!jsTsFileThatIsBeingMoved || !this.client.toTsFilePath(jsTsFileThatIsBeingMoved)) {
continue;
}
this._pendingRenames.add({ oldUri, newUri, newFilePath, oldFilePath, jsTsFileThatIsBeingMoved });
this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: vscode.l10n.t("Checking for update of JS/TS imports")
}, () => this.flushRenames());
});
}
const oldFilePath = this.client.toTsFilePath(oldUri);
if (!oldFilePath) {
return;
}
const config = this.getConfiguration(newUri);
const setting = config.get<UpdateImportsOnFileMoveSetting>(updateImportsOnFileMoveName);
if (setting === UpdateImportsOnFileMoveSetting.Never) {
return;
}
// Try to get a js/ts file that is being moved
// For directory moves, this returns a js/ts file under the directory.
const jsTsFileThatIsBeingMoved = await this.getJsTsFileBeingMoved(newUri);
if (!jsTsFileThatIsBeingMoved || !this.client.toTsFilePath(jsTsFileThatIsBeingMoved)) {
return;
}
this._pendingRenames.add({ oldUri, newUri, newFilePath, oldFilePath, jsTsFileThatIsBeingMoved });
this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: vscode.l10n.t("Checking for update of JS/TS imports")
}, () => this.flushRenames());
});
}));
}

View File

@@ -558,6 +558,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
providePrefixAndSuffixTextForRename: true,
allowRenameOfImportPath: true,
includePackageJsonAutoImports: this._configuration.includePackageJsonAutoImports,
excludeLibrarySymbolsInNavTo: this._configuration.workspaceSymbolsExcludeLibrarySymbols,
},
watchOptions
};