mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Make sure we opt in to new TS user preferences for enabling rename features
Fixes #66176
This commit is contained in:
@@ -186,8 +186,10 @@ export default class FileConfigurationManager {
|
||||
return {
|
||||
quotePreference: getQuoteStylePreference(preferences),
|
||||
importModuleSpecifierPreference: getImportModuleSpecifierPreference(preferences),
|
||||
allowTextChangesInNewFiles: document.uri.scheme === 'file'
|
||||
};
|
||||
allowTextChangesInNewFiles: document.uri.scheme === 'file',
|
||||
providePrefixAndSuffixTextForRename: true,
|
||||
allowRenameOfImportPath: true,
|
||||
} as Proto.UserPreferences;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,14 @@ import * as Proto from '../protocol';
|
||||
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class TypeScriptRenameProvider implements vscode.RenameProvider {
|
||||
public constructor(
|
||||
private readonly client: ITypeScriptServiceClient
|
||||
private readonly client: ITypeScriptServiceClient,
|
||||
private readonly fileConfigurationManager: FileConfigurationManager
|
||||
) { }
|
||||
|
||||
public async prepareRename(
|
||||
@@ -90,6 +92,7 @@ class TypeScriptRenameProvider implements vscode.RenameProvider {
|
||||
};
|
||||
|
||||
return this.client.interuptGetErr(() => {
|
||||
this.fileConfigurationManager.ensureConfigurationForDocument(document, token);
|
||||
return this.client.execute('rename', args, token);
|
||||
});
|
||||
}
|
||||
@@ -143,6 +146,8 @@ class TypeScriptRenameProvider implements vscode.RenameProvider {
|
||||
export function register(
|
||||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
fileConfigurationManager: FileConfigurationManager,
|
||||
) {
|
||||
return vscode.languages.registerRenameProvider(selector, new TypeScriptRenameProvider(client));
|
||||
return vscode.languages.registerRenameProvider(selector,
|
||||
new TypeScriptRenameProvider(client, fileConfigurationManager));
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export default class LanguageProvider extends Disposable {
|
||||
this._register((await import('./features/refactor')).register(selector, this.client, this.fileConfigurationManager, this.commandManager, this.telemetryReporter));
|
||||
this._register((await import('./features/references')).register(selector, this.client));
|
||||
this._register((await import('./features/referencesCodeLens')).register(selector, this.description.id, this.client, cachedResponse));
|
||||
this._register((await import('./features/rename')).register(selector, this.client));
|
||||
this._register((await import('./features/rename')).register(selector, this.client, this.fileConfigurationManager));
|
||||
this._register((await import('./features/signatureHelp')).register(selector, this.client));
|
||||
this._register((await import('./features/tagClosing')).register(selector, this.description.id, this.client));
|
||||
this._register((await import('./features/typeDefinitions')).register(selector, this.client));
|
||||
|
||||
Reference in New Issue
Block a user