diff --git a/news/2 Fixes/1774.md b/news/2 Fixes/1774.md new file mode 100644 index 000000000000..9bf55ad96f30 --- /dev/null +++ b/news/2 Fixes/1774.md @@ -0,0 +1 @@ +Enable code refactoring when using the new Analysis Engine. diff --git a/src/client/activation/classic.ts b/src/client/activation/classic.ts index 5ca9ee04c216..a2da07d38cf9 100644 --- a/src/client/activation/classic.ts +++ b/src/client/activation/classic.ts @@ -2,9 +2,9 @@ // Licensed under the MIT License. import { inject, injectable } from 'inversify'; -import { DocumentFilter, languages, OutputChannel } from 'vscode'; -import { PYTHON, STANDARD_OUTPUT_CHANNEL } from '../common/constants'; -import { IConfigurationService, IExtensionContext, ILogger, IOutputChannel } from '../common/types'; +import { DocumentFilter, languages } from 'vscode'; +import { PYTHON } from '../common/constants'; +import { IConfigurationService, IExtensionContext, ILogger } from '../common/types'; import { IShebangCodeLensProvider } from '../interpreter/contracts'; import { IServiceManager } from '../ioc/types'; import { JediFactory } from '../languageServices/jediProxyFactory'; @@ -15,7 +15,6 @@ import { activateGoToObjectDefinitionProvider } from '../providers/objectDefinit import { PythonReferenceProvider } from '../providers/referenceProvider'; import { PythonRenameProvider } from '../providers/renameProvider'; import { PythonSignatureProvider } from '../providers/signatureProvider'; -import { activateSimplePythonRefactorProvider } from '../providers/simpleRefactorProvider'; import { PythonSymbolProvider } from '../providers/symbolProvider'; import { IUnitTestManagementService } from '../unittests/types'; import { IExtensionActivator } from './types'; @@ -32,8 +31,6 @@ export class ClassicExtensionActivator implements IExtensionActivator { public async activate(): Promise { const context = this.context; - const standardOutputChannel = this.serviceManager.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); - activateSimplePythonRefactorProvider(context, standardOutputChannel, this.serviceManager); const jediFactory = this.jediFactory = new JediFactory(context.asAbsolutePath('.'), this.serviceManager); context.subscriptions.push(jediFactory); diff --git a/src/client/extension.ts b/src/client/extension.ts index 05a15fa5db55..44ad9ee776e2 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -43,7 +43,9 @@ import { ILintingEngine } from './linters/types'; import { DocStringFoldingProvider } from './providers/docStringFoldingProvider'; import { PythonFormattingEditProvider } from './providers/formatProvider'; import { LinterProvider } from './providers/linterProvider'; +import { PythonRenameProvider } from './providers/renameProvider'; import { ReplProvider } from './providers/replProvider'; +import { activateSimplePythonRefactorProvider } from './providers/simpleRefactorProvider'; import { TerminalProvider } from './providers/terminalProvider'; import { activateUpdateSparkLibraryProvider } from './providers/updateSparkLibraryProvider'; import * as sortImports from './sortImports'; @@ -75,10 +77,13 @@ export async function activate(context: ExtensionContext) { const configuration = serviceManager.get(IConfigurationService); const pythonSettings = configuration.getSettings(); + const standardOutputChannel = serviceManager.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); + context.subscriptions.push(languages.registerRenameProvider(PYTHON, new PythonRenameProvider(serviceManager))); + activateSimplePythonRefactorProvider(context, standardOutputChannel, serviceManager); + const activationService = serviceContainer.get(IExtensionActivationService); await activationService.activate(); - const standardOutputChannel = serviceManager.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); sortImports.activate(context, standardOutputChannel, serviceManager); serviceManager.get(ICodeExecutionManager).registerCommands();