Skip to content

Commit

Permalink
Merge branch 'main' into moaning-rodent
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd authored Oct 10, 2023
2 parents 602aa5b + 92c2a2f commit 65bfc03
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 186 deletions.
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ updates:
- dependency-name: prospector # Due to Python 2.7 and #14477.
- dependency-name: pytest # Due to Python 2.7 and #13776.
- dependency-name: py # Due to Python 2.7.
- dependency-name: isort
- dependency-name: jedi-language-server
labels:
- 'no-changelog'
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version
"python.linting.enabled": false,
"python.formatting.provider": "black",
"python.sortImports.args": ["--profile", "black"],
"typescript.preferences.quoteStyle": "single",
"javascript.preferences.quoteStyle": "single",
"typescriptHero.imports.stringQuoteStyle": "'",
Expand Down
1 change: 0 additions & 1 deletion build/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ flask
fastapi
uvicorn
django
isort

# Integrated TensorBoard tests
tensorboard
Expand Down
17 changes: 0 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1161,23 +1161,6 @@
"scope": "machine-overridable",
"type": "string"
},
"python.sortImports.args": {
"default": [],
"description": "%python.sortImports.args.description%",
"items": {
"type": "string"
},
"scope": "resource",
"type": "array",
"deprecationMessage": "%python.sortImports.args.deprecationMessage%"
},
"python.sortImports.path": {
"default": "",
"description": "%python.sortImports.path.description%",
"scope": "machine-overridable",
"type": "string",
"deprecationMessage": "%python.sortImports.path.deprecationMessage%"
},
"python.tensorBoard.logDirectory": {
"default": "",
"description": "%python.tensorBoard.logDirectory.description%",
Expand Down
5 changes: 0 additions & 5 deletions package.nls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"python.command.python.sortImports.title": "Sort Imports",
"python.command.python.startREPL.title": "Start REPL",
"python.command.python.createEnvironment.title": "Create Environment...",
"python.command.python.createNewFile.title": "New Python File",
Expand Down Expand Up @@ -201,8 +200,6 @@
"python.missingPackage.severity.description": "Set severity of missing packages in requirements.txt or pyproject.toml",
"python.pipenvPath.description": "Path to the pipenv executable to use for activation.",
"python.poetryPath.description": "Path to the poetry executable.",
"python.sortImports.args.description": "Arguments passed in. Each argument is a separate item in the array.",
"python.sortImports.path.description": "Path to isort script, default using inner version",
"python.tensorBoard.logDirectory.description": "Set this setting to your preferred TensorBoard log directory to skip log directory prompt when starting TensorBoard.",
"python.terminal.activateEnvInCurrentTerminal.description": "Activate Python Environment in the current Terminal on load of the Extension.",
"python.terminal.activateEnvironment.description": "Activate Python Environment in all Terminals created.",
Expand All @@ -220,8 +217,6 @@
"python.testing.unittestEnabled.description": "Enable testing using unittest.",
"python.venvFolders.description": "Folders in your home directory to look into for virtual environments (supports pyenv, direnv and virtualenvwrapper by default).",
"python.venvPath.description": "Path to folder with a list of Virtual Environments (e.g. ~/.pyenv, ~/Envs, ~/.virtualenvs).",
"python.sortImports.args.deprecationMessage": "This setting will be removed soon. Use 'isort.args' instead.",
"python.sortImports.path.deprecationMessage": "This setting will be removed soon. Use 'isort.path' instead.",
"walkthrough.pythonWelcome.title": "Get Started with Python Development",
"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!",
"walkthrough.step.python.createPythonFile.title": "Create a Python file",
Expand Down
4 changes: 0 additions & 4 deletions resources/report_issue_user_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@
"memory": true,
"symbolsHierarchyDepthLimit": false
},
"sortImports": {
"args": "placeholder",
"path": "placeholder"
},
"formatting": {
"autopep8Args": "placeholder",
"autopep8Path": "placeholder",
Expand Down
1 change: 0 additions & 1 deletion src/client/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
['workbench.action.openIssueReporter']: [{ extensionId: string; issueBody: string }];
[Commands.GetSelectedInterpreterPath]: [{ workspaceFolder: string } | string[]];
[Commands.TriggerEnvironmentSelection]: [undefined | Uri];
[Commands.Sort_Imports]: [undefined, Uri];
[Commands.Exec_In_Terminal]: [undefined, Uri];
[Commands.Exec_In_Terminal_Icon]: [undefined, Uri];
[Commands.Debug_In_Terminal]: [Uri];
Expand Down
11 changes: 0 additions & 11 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
IInterpreterSettings,
ILintingSettings,
IPythonSettings,
ISortImportSettings,
ITensorBoardSettings,
ITerminalSettings,
Resource,
Expand Down Expand Up @@ -120,8 +119,6 @@ export class PythonSettings implements IPythonSettings {

public terminal!: ITerminalSettings;

public sortImports!: ISortImportSettings;

public globalModuleInstallation = false;

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

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

const sortImportSettings = systemVariables.resolveAny(pythonSettings.get<ISortImportSettings>('sortImports'))!;
if (this.sortImports) {
Object.assign<ISortImportSettings, ISortImportSettings>(this.sortImports, sortImportSettings);
} else {
this.sortImports = sortImportSettings;
}
// Support for travis.
this.sortImports = this.sortImports ? this.sortImports : { path: '', args: [] };
// Support for travis.
this.linting = this.linting
? this.linting
Expand Down
1 change: 0 additions & 1 deletion src/client/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export namespace Commands {
export const ReportIssue = 'python.reportIssue';
export const Set_Interpreter = 'python.setInterpreter';
export const Set_ShebangInterpreter = 'python.setShebangInterpreter';
export const Sort_Imports = 'python.sortImports';
export const Start_REPL = 'python.startREPL';
export const Tests_Configure = 'python.configureTests';
export const TriggerEnvironmentSelection = 'python.triggerEnvSelection';
Expand Down
6 changes: 0 additions & 6 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export enum Product {
autopep8 = 10,
mypy = 11,
unittest = 12,
isort = 15,
black = 16,
bandit = 17,
tensorboard = 24,
Expand Down Expand Up @@ -190,7 +189,6 @@ export interface IPythonSettings {
readonly testing: ITestingSettings;
readonly autoComplete: IAutoCompleteSettings;
readonly terminal: ITerminalSettings;
readonly sortImports: ISortImportSettings;
readonly envFile: string;
readonly globalModuleInstallation: boolean;
readonly experiments: IExperiments;
Expand All @@ -204,10 +202,6 @@ export interface IPythonSettings {
export interface ITensorBoardSettings {
logDirectory: string | undefined;
}
export interface ISortImportSettings {
readonly path: string;
readonly args: string[];
}

export interface IPylintCategorySeverity {
readonly convention: DiagnosticSeverity;
Expand Down
7 changes: 0 additions & 7 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ export namespace Diagnostics {
'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?',
);
export const updateSettings = l10n.t('Yes, update settings');
export const checkIsort5UpgradeGuide = l10n.t(
'We found outdated configuration for sorting imports in this workspace. Check the [isort upgrade guide](https://aka.ms/AA9j5x4) to update your settings.',
);
export const pylanceDefaultMessage = l10n.t(
"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).",
);
Expand Down Expand Up @@ -517,12 +514,8 @@ export namespace ToolsExtensions {
export const pylintPromptMessage = l10n.t(
'Use the Pylint extension to enable easier configuration and new features such as quick fixes.',
);
export const isortPromptMessage = l10n.t(
'To use sort imports, install the isort extension. It provides easier configuration and new features such as code actions.',
);
export const installPylintExtension = l10n.t('Install Pylint extension');
export const installFlake8Extension = l10n.t('Install Flake8 extension');
export const installISortExtension = l10n.t('Install isort extension');

export const selectBlackFormatterPrompt = l10n.t(
'You have the Black formatter extension installed, would you like to use that as the default formatter?',
Expand Down
89 changes: 0 additions & 89 deletions src/client/providers/codeActionProvider/isortPrompt.ts

This file was deleted.

25 changes: 1 addition & 24 deletions src/client/providers/codeActionProvider/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@
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 { isExtensionEnabled } from '../../common/vscodeApis/extensionsApi';
import { IServiceContainer } from '../../ioc/types';
import { traceLog } from '../../logging';
import { getOrCreateISortPrompt, ISORT_EXTENSION } from './isortPrompt';
import { LaunchJsonCodeActionProvider } from './launchJsonCodeActionProvider';

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

constructor(
@inject(IDisposableRegistry) private disposableRegistry: IDisposableRegistry,
@inject(IServiceContainer) private serviceContainer: IServiceContainer,
) {}
constructor(@inject(IDisposableRegistry) private disposableRegistry: IDisposableRegistry) {}

public async activate(): Promise<void> {
// eslint-disable-next-line global-require
Expand All @@ -35,19 +26,5 @@ export class CodeActionProviderService implements IExtensionSingleActivationServ
providedCodeActionKinds: [vscode.CodeActionKind.QuickFix],
}),
);
this.disposableRegistry.push(
registerCommand(Commands.Sort_Imports, async () => {
const prompt = getOrCreateISortPrompt(this.serviceContainer);
await prompt.showPrompt();
if (!isExtensionEnabled(ISORT_EXTENSION)) {
traceLog(
'Sort Imports: Please install and enable `ms-python.isort` extension to use this feature.',
);
return;
}

executeCommand('editor.action.organizeImports');
}),
);
}
}
8 changes: 4 additions & 4 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ export interface IEventNamePropertyMapping {
}
*/
[EventName.TOOLS_EXTENSIONS_ALREADY_INSTALLED]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
isEnabled: boolean;
};
/**
Expand All @@ -2193,7 +2193,7 @@ export interface IEventNamePropertyMapping {
}
*/
[EventName.TOOLS_EXTENSIONS_PROMPT_SHOWN]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
};
/**
* Telemetry event sent when clicking to install linter or formatter extension from the suggestion prompt.
Expand All @@ -2204,7 +2204,7 @@ export interface IEventNamePropertyMapping {
}
*/
[EventName.TOOLS_EXTENSIONS_INSTALL_SELECTED]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
};
/**
* Telemetry event sent when dismissing prompt suggesting to install the linter or formatter extension.
Expand All @@ -2216,7 +2216,7 @@ export interface IEventNamePropertyMapping {
}
*/
[EventName.TOOLS_EXTENSIONS_PROMPT_DISMISSED]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8' | 'ms-python.isort';
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
dismissType: 'close' | 'doNotShow';
};
/* __GDPR__
Expand Down
1 change: 0 additions & 1 deletion src/test/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"python.linting.flake8Enabled": false,
"python.testing.pytestArgs": [],
"python.testing.unittestArgs": ["-s=./tests", "-p=test_*.py", "-v", "-s", ".", "-p", "*test*.py"],
"python.sortImports.args": [],
"python.linting.lintOnSave": false,
"python.linting.enabled": true,
"python.linting.pycodestyleEnabled": false,
Expand Down
1 change: 0 additions & 1 deletion src/test/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export type PythonSettingKeys =
| 'testing.pytestArgs'
| 'testing.unittestArgs'
| 'formatting.provider'
| 'sortImports.args'
| 'testing.pytestEnabled'
| 'testing.unittestEnabled'
| 'envFile'
Expand Down
2 changes: 0 additions & 2 deletions src/test/common/configSettings/configSettings.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
IFormattingSettings,
IInterpreterSettings,
ILintingSettings,
ISortImportSettings,
ITerminalSettings,
} from '../../../client/common/types';
import { noop } from '../../../client/common/utils/misc';
Expand Down Expand Up @@ -118,7 +117,6 @@ suite('Python Settings', async () => {
// complex settings
config.setup((c) => c.get<IInterpreterSettings>('interpreter')).returns(() => sourceSettings.interpreter);
config.setup((c) => c.get<ILintingSettings>('linting')).returns(() => sourceSettings.linting);
config.setup((c) => c.get<ISortImportSettings>('sortImports')).returns(() => sourceSettings.sortImports);
config.setup((c) => c.get<IFormattingSettings>('formatting')).returns(() => sourceSettings.formatting);
config.setup((c) => c.get<IAutoCompleteSettings>('autoComplete')).returns(() => sourceSettings.autoComplete);
config.setup((c) => c.get<ITestingSettings>('testing')).returns(() => sourceSettings.testing);
Expand Down
1 change: 0 additions & 1 deletion src/test/common/productsToTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function getProductsForInstallerTests(): { name: string; value: Product }
'yapf',
'autopep8',
'mypy',
'isort',
'black',
'bandit',
].includes(p.name),
Expand Down
Loading

0 comments on commit 65bfc03

Please sign in to comment.