Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use isort extension instead of isort. #19997

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async function addExtensionPackDependencies() {
// extension dependencies need not be installed during development
const packageJsonContents = await fsExtra.readFile('package.json', 'utf-8');
const packageJson = JSON.parse(packageJsonContents);
packageJson.extensionPack = ['ms-toolsai.jupyter', 'ms-python.vscode-pylance'].concat(
packageJson.extensionPack = ['ms-toolsai.jupyter', 'ms-python.vscode-pylance', 'ms-python.isort'].concat(
packageJson.extensionPack ? packageJson.extensionPack : [],
);
await fsExtra.writeFile('package.json', JSON.stringify(packageJson, null, 4), 'utf-8');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@
{
"command": "python.sortImports",
"group": "Refactor",
"title": "Refactor: Sort Imports",
"title": "%python.command.python.sortImports.title%",
"when": "editorLangId == python && !notebookEditorFocused && !virtualWorkspace && shellExecutionSupported"
}
],
Expand Down
3 changes: 0 additions & 3 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@

# Unittest test adapter
typing-extensions==4.4.0

# Sort Imports
isort==5.10.1
4 changes: 0 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
#
# pip-compile --generate-hashes requirements.in
#
isort==5.10.1 \
--hash=sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7 \
--hash=sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951
# via -r requirements.in
typing-extensions==4.4.0 \
--hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \
--hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
Expand Down
12 changes: 0 additions & 12 deletions src/client/extensionActivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
'use strict';

import {
CodeActionKind,
debug,
DebugConfigurationProvider,
DebugConfigurationProviderTriggerKind,
Expand Down Expand Up @@ -38,12 +37,10 @@ import { getLanguageConfiguration } from './language/languageConfiguration';
import { LinterCommands } from './linters/linterCommands';
import { registerTypes as lintersRegisterTypes } from './linters/serviceRegistry';
import { setLoggingLevel } from './logging';
import { PythonCodeActionProvider } from './providers/codeActionProvider/pythonCodeActionProvider';
import { PythonFormattingEditProvider } from './providers/formatProvider';
import { ReplProvider } from './providers/replProvider';
import { registerTypes as providersRegisterTypes } from './providers/serviceRegistry';
import { TerminalProvider } from './providers/terminalProvider';
import { ISortImportsEditingProvider } from './providers/types';
import { setExtensionInstallTelemetryProperties } from './telemetry/extensionInstallTelemetry';
import { registerTypes as tensorBoardRegisterTypes } from './tensorBoard/serviceRegistry';
import { registerTypes as commonRegisterTerminalTypes } from './terminals/serviceRegistry';
Expand Down Expand Up @@ -182,9 +179,6 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
serviceManager.get<ITerminalAutoActivation>(ITerminalAutoActivation).register();
const pythonSettings = configuration.getSettings();

const sortImports = serviceContainer.get<ISortImportsEditingProvider>(ISortImportsEditingProvider);
sortImports.registerCommands();

serviceManager.get<ICodeExecutionManager>(ICodeExecutionManager).registerCommands();

disposables.push(new LinterCommands(serviceManager));
Expand All @@ -205,12 +199,6 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
terminalProvider.initialize(window.activeTerminal).ignoreErrors();
disposables.push(terminalProvider);

disposables.push(
languages.registerCodeActionsProvider(PYTHON, new PythonCodeActionProvider(), {
providedCodeActionKinds: [CodeActionKind.SourceOrganizeImports],
}),
);

serviceContainer
.getAll<DebugConfigurationProvider>(IDebugConfigurationService)
.forEach((debugConfigProvider) => {
Expand Down
5 changes: 5 additions & 0 deletions src/client/providers/codeActionProvider/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import { inject, injectable } from 'inversify';
import * as vscodeTypes from 'vscode';
import { IExtensionSingleActivationService } from '../../activation/types';
import { Commands } from '../../common/constants';
import { IDisposableRegistry } from '../../common/types';
import { executeCommand, registerCommand } from '../../common/vscodeApis/commandApis';
import { LaunchJsonCodeActionProvider } from './launchJsonCodeActionProvider';

@injectable()
Expand All @@ -26,5 +28,8 @@ export class CodeActionProviderService implements IExtensionSingleActivationServ
providedCodeActionKinds: [vscode.CodeActionKind.QuickFix],
}),
);
this.disposableRegistry.push(
registerCommand(Commands.Sort_Imports, () => executeCommand('editor.action.organizeImports')),
);
}
}

This file was deleted.

Loading