Make sure we opt in to new TS user preferences for enabling rename features

Fixes #66176
This commit is contained in:
Matt Bierner
2019-01-11 15:42:03 -08:00
parent d3d16d2b34
commit 2ab82c12ed
3 changed files with 12 additions and 5 deletions

View File

@@ -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;
}
}

View File

@@ -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));
}

View File

@@ -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));