Skip to content

Commit 92c2a2f

Browse files
authored
Remove isort support (#22187)
This feature is now moved to `ms-python.isort` extension. For #22183 Closes #22147
1 parent 091e121 commit 92c2a2f

File tree

20 files changed

+6
-186
lines changed

20 files changed

+6
-186
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ updates:
3737
- dependency-name: prospector # Due to Python 2.7 and #14477.
3838
- dependency-name: pytest # Due to Python 2.7 and #13776.
3939
- dependency-name: py # Due to Python 2.7.
40-
- dependency-name: isort
4140
- dependency-name: jedi-language-server
4241
labels:
4342
- 'no-changelog'

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version
4848
"python.linting.enabled": false,
4949
"python.formatting.provider": "black",
50-
"python.sortImports.args": ["--profile", "black"],
5150
"typescript.preferences.quoteStyle": "single",
5251
"javascript.preferences.quoteStyle": "single",
5352
"typescriptHero.imports.stringQuoteStyle": "'",

build/test-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ flask
1717
fastapi
1818
uvicorn
1919
django
20-
isort
2120

2221
# Integrated TensorBoard tests
2322
tensorboard

package.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,23 +1161,6 @@
11611161
"scope": "machine-overridable",
11621162
"type": "string"
11631163
},
1164-
"python.sortImports.args": {
1165-
"default": [],
1166-
"description": "%python.sortImports.args.description%",
1167-
"items": {
1168-
"type": "string"
1169-
},
1170-
"scope": "resource",
1171-
"type": "array",
1172-
"deprecationMessage": "%python.sortImports.args.deprecationMessage%"
1173-
},
1174-
"python.sortImports.path": {
1175-
"default": "",
1176-
"description": "%python.sortImports.path.description%",
1177-
"scope": "machine-overridable",
1178-
"type": "string",
1179-
"deprecationMessage": "%python.sortImports.path.deprecationMessage%"
1180-
},
11811164
"python.tensorBoard.logDirectory": {
11821165
"default": "",
11831166
"description": "%python.tensorBoard.logDirectory.description%",

package.nls.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"python.command.python.sortImports.title": "Sort Imports",
32
"python.command.python.startREPL.title": "Start REPL",
43
"python.command.python.createEnvironment.title": "Create Environment...",
54
"python.command.python.createNewFile.title": "New Python File",
@@ -201,8 +200,6 @@
201200
"python.missingPackage.severity.description": "Set severity of missing packages in requirements.txt or pyproject.toml",
202201
"python.pipenvPath.description": "Path to the pipenv executable to use for activation.",
203202
"python.poetryPath.description": "Path to the poetry executable.",
204-
"python.sortImports.args.description": "Arguments passed in. Each argument is a separate item in the array.",
205-
"python.sortImports.path.description": "Path to isort script, default using inner version",
206203
"python.tensorBoard.logDirectory.description": "Set this setting to your preferred TensorBoard log directory to skip log directory prompt when starting TensorBoard.",
207204
"python.terminal.activateEnvInCurrentTerminal.description": "Activate Python Environment in the current Terminal on load of the Extension.",
208205
"python.terminal.activateEnvironment.description": "Activate Python Environment in all Terminals created.",
@@ -220,8 +217,6 @@
220217
"python.testing.unittestEnabled.description": "Enable testing using unittest.",
221218
"python.venvFolders.description": "Folders in your home directory to look into for virtual environments (supports pyenv, direnv and virtualenvwrapper by default).",
222219
"python.venvPath.description": "Path to folder with a list of Virtual Environments (e.g. ~/.pyenv, ~/Envs, ~/.virtualenvs).",
223-
"python.sortImports.args.deprecationMessage": "This setting will be removed soon. Use 'isort.args' instead.",
224-
"python.sortImports.path.deprecationMessage": "This setting will be removed soon. Use 'isort.path' instead.",
225220
"walkthrough.pythonWelcome.title": "Get Started with Python Development",
226221
"walkthrough.pythonWelcome.description": "Your first steps to set up a Python project with all the powerful tools and features that the Python extension has to offer!",
227222
"walkthrough.step.python.createPythonFile.title": "Create a Python file",

resources/report_issue_user_settings.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@
6969
"memory": true,
7070
"symbolsHierarchyDepthLimit": false
7171
},
72-
"sortImports": {
73-
"args": "placeholder",
74-
"path": "placeholder"
75-
},
7672
"formatting": {
7773
"autopep8Args": "placeholder",
7874
"autopep8Path": "placeholder",

src/client/common/application/commands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
9393
['workbench.action.openIssueReporter']: [{ extensionId: string; issueBody: string }];
9494
[Commands.GetSelectedInterpreterPath]: [{ workspaceFolder: string } | string[]];
9595
[Commands.TriggerEnvironmentSelection]: [undefined | Uri];
96-
[Commands.Sort_Imports]: [undefined, Uri];
9796
[Commands.Exec_In_Terminal]: [undefined, Uri];
9897
[Commands.Exec_In_Terminal_Icon]: [undefined, Uri];
9998
[Commands.Debug_In_Terminal]: [Uri];

src/client/common/configSettings.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
IInterpreterSettings,
3333
ILintingSettings,
3434
IPythonSettings,
35-
ISortImportSettings,
3635
ITensorBoardSettings,
3736
ITerminalSettings,
3837
Resource,
@@ -120,8 +119,6 @@ export class PythonSettings implements IPythonSettings {
120119

121120
public terminal!: ITerminalSettings;
122121

123-
public sortImports!: ISortImportSettings;
124-
125122
public globalModuleInstallation = false;
126123

127124
public experiments!: IExperiments;
@@ -319,14 +316,6 @@ export class PythonSettings implements IPythonSettings {
319316

320317
this.globalModuleInstallation = pythonSettings.get<boolean>('globalModuleInstallation') === true;
321318

322-
const sortImportSettings = systemVariables.resolveAny(pythonSettings.get<ISortImportSettings>('sortImports'))!;
323-
if (this.sortImports) {
324-
Object.assign<ISortImportSettings, ISortImportSettings>(this.sortImports, sortImportSettings);
325-
} else {
326-
this.sortImports = sortImportSettings;
327-
}
328-
// Support for travis.
329-
this.sortImports = this.sortImports ? this.sortImports : { path: '', args: [] };
330319
// Support for travis.
331320
this.linting = this.linting
332321
? this.linting

src/client/common/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export namespace Commands {
5858
export const ReportIssue = 'python.reportIssue';
5959
export const Set_Interpreter = 'python.setInterpreter';
6060
export const Set_ShebangInterpreter = 'python.setShebangInterpreter';
61-
export const Sort_Imports = 'python.sortImports';
6261
export const Start_REPL = 'python.startREPL';
6362
export const Tests_Configure = 'python.configureTests';
6463
export const TriggerEnvironmentSelection = 'python.triggerEnvSelection';

src/client/common/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ export enum Product {
106106
autopep8 = 10,
107107
mypy = 11,
108108
unittest = 12,
109-
isort = 15,
110109
black = 16,
111110
bandit = 17,
112111
tensorboard = 24,
@@ -190,7 +189,6 @@ export interface IPythonSettings {
190189
readonly testing: ITestingSettings;
191190
readonly autoComplete: IAutoCompleteSettings;
192191
readonly terminal: ITerminalSettings;
193-
readonly sortImports: ISortImportSettings;
194192
readonly envFile: string;
195193
readonly globalModuleInstallation: boolean;
196194
readonly experiments: IExperiments;
@@ -204,10 +202,6 @@ export interface IPythonSettings {
204202
export interface ITensorBoardSettings {
205203
logDirectory: string | undefined;
206204
}
207-
export interface ISortImportSettings {
208-
readonly path: string;
209-
readonly args: string[];
210-
}
211205

212206
export interface IPylintCategorySeverity {
213207
readonly convention: DiagnosticSeverity;

src/client/common/utils/localize.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ export namespace Diagnostics {
3939
'Your settings needs to be updated to change the setting "python.unitTest." to "python.testing.", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?',
4040
);
4141
export const updateSettings = l10n.t('Yes, update settings');
42-
export const checkIsort5UpgradeGuide = l10n.t(
43-
'We found outdated configuration for sorting imports in this workspace. Check the [isort upgrade guide](https://aka.ms/AA9j5x4) to update your settings.',
44-
);
4542
export const pylanceDefaultMessage = l10n.t(
4643
"The Python extension now includes Pylance to improve completions, code navigation, overall performance and much more! You can learn more about the update and learn how to change your language server [here](https://aka.ms/new-python-bundle).\n\nRead Pylance's license [here](https://marketplace.visualstudio.com/items/ms-python.vscode-pylance/license).",
4744
);
@@ -517,12 +514,8 @@ export namespace ToolsExtensions {
517514
export const pylintPromptMessage = l10n.t(
518515
'Use the Pylint extension to enable easier configuration and new features such as quick fixes.',
519516
);
520-
export const isortPromptMessage = l10n.t(
521-
'To use sort imports, install the isort extension. It provides easier configuration and new features such as code actions.',
522-
);
523517
export const installPylintExtension = l10n.t('Install Pylint extension');
524518
export const installFlake8Extension = l10n.t('Install Flake8 extension');
525-
export const installISortExtension = l10n.t('Install isort extension');
526519

527520
export const selectBlackFormatterPrompt = l10n.t(
528521
'You have the Black formatter extension installed, would you like to use that as the default formatter?',

src/client/providers/codeActionProvider/isortPrompt.ts

Lines changed: 0 additions & 89 deletions
This file was deleted.

src/client/providers/codeActionProvider/main.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,14 @@
44
import { inject, injectable } from 'inversify';
55
import * as vscodeTypes from 'vscode';
66
import { IExtensionSingleActivationService } from '../../activation/types';
7-
import { Commands } from '../../common/constants';
87
import { IDisposableRegistry } from '../../common/types';
9-
import { executeCommand, registerCommand } from '../../common/vscodeApis/commandApis';
10-
import { isExtensionEnabled } from '../../common/vscodeApis/extensionsApi';
11-
import { IServiceContainer } from '../../ioc/types';
12-
import { traceLog } from '../../logging';
13-
import { getOrCreateISortPrompt, ISORT_EXTENSION } from './isortPrompt';
148
import { LaunchJsonCodeActionProvider } from './launchJsonCodeActionProvider';
159

1610
@injectable()
1711
export class CodeActionProviderService implements IExtensionSingleActivationService {
1812
public readonly supportedWorkspaceTypes = { untrustedWorkspace: false, virtualWorkspace: false };
1913

20-
constructor(
21-
@inject(IDisposableRegistry) private disposableRegistry: IDisposableRegistry,
22-
@inject(IServiceContainer) private serviceContainer: IServiceContainer,
23-
) {}
14+
constructor(@inject(IDisposableRegistry) private disposableRegistry: IDisposableRegistry) {}
2415

2516
public async activate(): Promise<void> {
2617
// eslint-disable-next-line global-require
@@ -35,19 +26,5 @@ export class CodeActionProviderService implements IExtensionSingleActivationServ
3526
providedCodeActionKinds: [vscode.CodeActionKind.QuickFix],
3627
}),
3728
);
38-
this.disposableRegistry.push(
39-
registerCommand(Commands.Sort_Imports, async () => {
40-
const prompt = getOrCreateISortPrompt(this.serviceContainer);
41-
await prompt.showPrompt();
42-
if (!isExtensionEnabled(ISORT_EXTENSION)) {
43-
traceLog(
44-
'Sort Imports: Please install and enable `ms-python.isort` extension to use this feature.',
45-
);
46-
return;
47-
}
48-
49-
executeCommand('editor.action.organizeImports');
50-
}),
51-
);
5229
}
5330
}

src/client/telemetry/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ export interface IEventNamePropertyMapping {
21812181
}
21822182
*/
21832183
[EventName.TOOLS_EXTENSIONS_ALREADY_INSTALLED]: {
2184-
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
2184+
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
21852185
isEnabled: boolean;
21862186
};
21872187
/**
@@ -2193,7 +2193,7 @@ export interface IEventNamePropertyMapping {
21932193
}
21942194
*/
21952195
[EventName.TOOLS_EXTENSIONS_PROMPT_SHOWN]: {
2196-
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
2196+
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
21972197
};
21982198
/**
21992199
* Telemetry event sent when clicking to install linter or formatter extension from the suggestion prompt.
@@ -2204,7 +2204,7 @@ export interface IEventNamePropertyMapping {
22042204
}
22052205
*/
22062206
[EventName.TOOLS_EXTENSIONS_INSTALL_SELECTED]: {
2207-
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
2207+
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
22082208
};
22092209
/**
22102210
* Telemetry event sent when dismissing prompt suggesting to install the linter or formatter extension.
@@ -2216,7 +2216,7 @@ export interface IEventNamePropertyMapping {
22162216
}
22172217
*/
22182218
[EventName.TOOLS_EXTENSIONS_PROMPT_DISMISSED]: {
2219-
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
2219+
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
22202220
dismissType: 'close' | 'doNotShow';
22212221
};
22222222
/* __GDPR__

src/test/.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"python.linting.flake8Enabled": false,
44
"python.testing.pytestArgs": [],
55
"python.testing.unittestArgs": ["-s=./tests", "-p=test_*.py", "-v", "-s", ".", "-p", "*test*.py"],
6-
"python.sortImports.args": [],
76
"python.linting.lintOnSave": false,
87
"python.linting.enabled": true,
98
"python.linting.pycodestyleEnabled": false,

src/test/common.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export type PythonSettingKeys =
5353
| 'testing.pytestArgs'
5454
| 'testing.unittestArgs'
5555
| 'formatting.provider'
56-
| 'sortImports.args'
5756
| 'testing.pytestEnabled'
5857
| 'testing.unittestEnabled'
5958
| 'envFile'

src/test/common/configSettings/configSettings.unit.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
IFormattingSettings,
2323
IInterpreterSettings,
2424
ILintingSettings,
25-
ISortImportSettings,
2625
ITerminalSettings,
2726
} from '../../../client/common/types';
2827
import { noop } from '../../../client/common/utils/misc';
@@ -118,7 +117,6 @@ suite('Python Settings', async () => {
118117
// complex settings
119118
config.setup((c) => c.get<IInterpreterSettings>('interpreter')).returns(() => sourceSettings.interpreter);
120119
config.setup((c) => c.get<ILintingSettings>('linting')).returns(() => sourceSettings.linting);
121-
config.setup((c) => c.get<ISortImportSettings>('sortImports')).returns(() => sourceSettings.sortImports);
122120
config.setup((c) => c.get<IFormattingSettings>('formatting')).returns(() => sourceSettings.formatting);
123121
config.setup((c) => c.get<IAutoCompleteSettings>('autoComplete')).returns(() => sourceSettings.autoComplete);
124122
config.setup((c) => c.get<ITestingSettings>('testing')).returns(() => sourceSettings.testing);

src/test/common/productsToTest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function getProductsForInstallerTests(): { name: string; value: Product }
1717
'yapf',
1818
'autopep8',
1919
'mypy',
20-
'isort',
2120
'black',
2221
'bandit',
2322
].includes(p.name),

0 commit comments

Comments
 (0)