Skip to content

Commit

Permalink
Remove formatting settings (microsoft#22202)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Oct 12, 2023
1 parent d1e4562 commit 65c8ac6
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 289 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/L
| `Python: Select Interpreter` | Switch between Python interpreters, versions, and environments. |
| `Python: Start REPL` | Start an interactive Python REPL using the selected interpreter in the VS Code terminal. |
| `Python: Run Python File in Terminal` | Runs the active Python file in the VS Code terminal. You can also run a Python file by right-clicking on the file and selecting `Run Python File in Terminal`. |
| `Format Document` | Formats code using the provided [formatter](https://code.visualstudio.com/docs/python/editing#_formatting) in the `settings.json` file. |
| `Format Document` | Formats code using the provided [formatter](https://code.visualstudio.com/docs/python/formatting) in the `settings.json` file. |
| `Python: Configure Tests` | Select a test framework and configure it to display the Test Explorer. |

To see all available Python commands, open the Command Palette and type `Python`. For Jupyter extension commands, just type `Jupyter`.
Expand All @@ -71,16 +71,11 @@ Learn more about the rich features of the Python extension:

- [IntelliSense](https://code.visualstudio.com/docs/python/editing#_autocomplete-and-intellisense): Edit your code with auto-completion, code navigation, syntax checking and more
- [Linting](https://code.visualstudio.com/docs/python/linting): Get additional code analysis with Pylint, Flake8 and more
- [Code formatting](https://code.visualstudio.com/docs/python/editing#_formatting): Format your code with black, autopep or yapf

- [Code formatting](https://code.visualstudio.com/docs/python/formatting): Format your code with black, autopep or yapf
- [Debugging](https://code.visualstudio.com/docs/python/debugging): Debug your Python scripts, web apps, remote or multi-threaded processes

- [Testing](https://code.visualstudio.com/docs/python/unit-testing): Run and debug tests through the Test Explorer with unittest or pytest.

- [Jupyter Notebooks](https://code.visualstudio.com/docs/python/jupyter-support): Create and edit Jupyter Notebooks, add and run code cells, render plots, visualize variables through the variable explorer, visualize dataframes with the data viewer, and more

- [Environments](https://code.visualstudio.com/docs/python/environments): Automatically activate and switch between virtualenv, venv, pipenv, conda and pyenv environments

- [Refactoring](https://code.visualstudio.com/docs/python/editing#_refactoring): Restructure your Python code with variable extraction and method extraction. Additionally, there is componentized support to enable additional refactoring, such as import sorting, through extensions including [isort](https://marketplace.visualstudio.com/items?itemName=ms-python.isort) and [Ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff).


Expand Down
5 changes: 0 additions & 5 deletions build/test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# pin setoptconf to prevent issue with 'use_2to3'
setoptconf==0.3.0

# Install flake8 first, as both flake8 and autopep8 require pycodestyle,
# but flake8 has a tighter pinning.
flake8
autopep8
bandit
black
yapf
pylint
pycodestyle
pydocstyle
Expand Down
71 changes: 0 additions & 71 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,77 +577,6 @@
"type": "array",
"uniqueItems": true
},
"python.formatting.autopep8Args": {
"default": [],
"description": "%python.formatting.autopep8Args.description%",
"items": {
"type": "string"
},
"scope": "resource",
"type": "array",
"markdownDeprecationMessage": "%python.formatting.autopep8Args.markdownDeprecationMessage%",
"deprecationMessage": "%python.formatting.autopep8Args.deprecationMessage%"
},
"python.formatting.autopep8Path": {
"default": "autopep8",
"description": "%python.formatting.autopep8Path.description%",
"scope": "machine-overridable",
"type": "string",
"markdownDeprecationMessage": "%python.formatting.autopep8Path.markdownDeprecationMessage%",
"deprecationMessage": "%python.formatting.autopep8Path.deprecationMessage%"
},
"python.formatting.blackArgs": {
"default": [],
"description": "%python.formatting.blackArgs.description%",
"items": {
"type": "string"
},
"scope": "resource",
"type": "array",
"markdownDeprecationMessage": "%python.formatting.blackArgs.markdownDeprecationMessage%",
"deprecationMessage": "%python.formatting.blackArgs.deprecationMessage%"
},
"python.formatting.blackPath": {
"default": "black",
"description": "%python.formatting.blackPath.description%",
"scope": "machine-overridable",
"type": "string",
"markdownDeprecationMessage": "%python.formatting.blackPath.markdownDeprecationMessage%",
"deprecationMessage": "%python.formatting.blackPath.deprecationMessage%"
},
"python.formatting.provider": {
"default": "autopep8",
"description": "%python.formatting.provider.description%",
"enum": [
"autopep8",
"black",
"none",
"yapf"
],
"scope": "resource",
"type": "string",
"markdownDeprecationMessage": "%python.formatting.provider.markdownDeprecationMessage%",
"deprecationMessage": "%python.formatting.provider.deprecationMessage%"
},
"python.formatting.yapfArgs": {
"default": [],
"description": "%python.formatting.yapfArgs.description%",
"items": {
"type": "string"
},
"scope": "resource",
"type": "array",
"markdownDeprecationMessage": "%python.formatting.yapfArgs.markdownDeprecationMessage%",
"deprecationMessage": "%python.formatting.yapfArgs.deprecationMessage%"
},
"python.formatting.yapfPath": {
"default": "yapf",
"description": "%python.formatting.yapfPath.description%",
"scope": "machine-overridable",
"type": "string",
"markdownDeprecationMessage": "%python.formatting.yapfPath.markdownDeprecationMessage%",
"deprecationMessage": "%python.formatting.yapfPath.deprecationMessage%"
},
"python.globalModuleInstallation": {
"default": false,
"description": "%python.globalModuleInstallation.description%",
Expand Down
21 changes: 0 additions & 21 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,6 @@
"python.experiments.pythonTerminalEnvVarActivation.description": "Enables use of environment variables to activate terminals instead of sending activation commands.",
"python.experiments.pythonTestAdapter.description": "Denotes the Python Test Adapter experiment.",
"python.experiments.pythonREPLSmartSend.description": "Denotes the Python REPL Smart Send experiment.",
"python.formatting.autopep8Args.description": "Arguments passed in. Each argument is a separate item in the array.",
"python.formatting.autopep8Args.markdownDeprecationMessage": "This setting will soon be deprecated. Please use the [Autopep8 extension](https://marketplace.visualstudio.com/items?itemName=ms-python.autopep8). <br>Learn more [here](https://aka.ms/AAlgvkb).",
"python.formatting.autopep8Args.deprecationMessage": "This setting will soon be deprecated. Please use the Autopep8 extension. Learn more here: https://aka.ms/AAlgvkb.",
"python.formatting.autopep8Path.description": "Path to autopep8, you can use a custom version of autopep8 by modifying this setting to include the full path.",
"python.formatting.autopep8Path.markdownDeprecationMessage": "This setting will soon be deprecated. Please use the [Autopep8 extension](https://marketplace.visualstudio.com/items?itemName=ms-python.autopep8). <br>Learn more [here](https://aka.ms/AAlgvkb).",
"python.formatting.autopep8Path.deprecationMessage": "This setting will soon be deprecated. Please use the Autopep8 extension. Learn more here: https://aka.ms/AAlgvkb.",
"python.formatting.blackArgs.description": "Arguments passed in. Each argument is a separate item in the array.",
"python.formatting.blackArgs.markdownDeprecationMessage": "This setting will soon be deprecated. Please use the [Black Formatter extension](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter). <br>Learn more [here](https://aka.ms/AAlgvkb).",
"python.formatting.blackArgs.deprecationMessage": "This setting will soon be deprecated. Please use the Black Formatter extension. Learn more here: https://aka.ms/AAlgvkb.",
"python.formatting.blackPath.description": "Path to Black, you can use a custom version of Black by modifying this setting to include the full path.",
"python.formatting.blackPath.markdownDeprecationMessage": "This setting will soon be deprecated. Please use the [Black Formatter extension](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter). <br>Learn more [here](https://aka.ms/AAlgvkb).",
"python.formatting.blackPath.deprecationMessage": "This setting will soon be deprecated. Please use the Black Formatter extension. Learn more here: https://aka.ms/AAlgvkb.",
"python.formatting.provider.description": "Provider for formatting. Possible options include 'autopep8', 'black', and 'yapf'.",
"python.formatting.provider.markdownDeprecationMessage": "This setting will soon be deprecated. Please use a dedicated formatter extension. <br>Learn more [here](https://aka.ms/AAlgvkb).",
"python.formatting.provider.deprecationMessage": "This setting will soon be deprecated. Please use a dedicated formatter extension. Learn more here: https://aka.ms/AAlgvkb.",
"python.formatting.yapfArgs.description": "Arguments passed in. Each argument is a separate item in the array.",
"python.formatting.yapfArgs.markdownDeprecationMessage": "Built-in Yapf support will soon be deprecated. Learn more [here](https://aka.ms/AAlgvkb).",
"python.formatting.yapfArgs.deprecationMessage": "Built-in Yapf support will soon be deprecated. Learn more here: https://aka.ms/AAlgvkb.",
"python.formatting.yapfPath.description": "Path to yapf, you can use a custom version of yapf by modifying this setting to include the full path.",
"python.formatting.yapfPath.markdownDeprecationMessage": "Yapf support will soon be deprecated. <br>Learn more [here](https://aka.ms/AAlgvkb).",
"python.formatting.yapfPath.deprecationMessage": "Built-in Yapf support will soon be deprecated. Learn more here: https://aka.ms/AAlgvkb.",
"python.globalModuleInstallation.description": "Whether to install Python modules globally when not using an environment.",
"python.languageServer.description": "Defines type of the language server.",
"python.languageServer.defaultDescription": "Automatically select a language server: Pylance if installed and available, otherwise fallback to Jedi.",
Expand Down
9 changes: 0 additions & 9 deletions resources/report_issue_user_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@
"memory": true,
"symbolsHierarchyDepthLimit": false
},
"formatting": {
"autopep8Args": "placeholder",
"autopep8Path": "placeholder",
"provider": true,
"blackArgs": "placeholder",
"blackPath": "placeholder",
"yapfArgs": "placeholder",
"yapfPath": "placeholder"
},
"testing": {
"cwd": "placeholder",
"debugPort": true,
Expand Down
31 changes: 0 additions & 31 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
IAutoCompleteSettings,
IDefaultLanguageServer,
IExperiments,
IFormattingSettings,
IInterpreterPathService,
IInterpreterSettings,
ILintingSettings,
Expand Down Expand Up @@ -109,8 +108,6 @@ export class PythonSettings implements IPythonSettings {

public linting!: ILintingSettings;

public formatting!: IFormattingSettings;

public autoComplete!: IAutoCompleteSettings;

public tensorBoard: ITensorBoardSettings | undefined;
Expand Down Expand Up @@ -395,34 +392,6 @@ export class PythonSettings implements IPythonSettings {
this.linting.cwd = getAbsolutePath(systemVariables.resolveAny(this.linting.cwd), workspaceRoot);
}

const formattingSettings = systemVariables.resolveAny(pythonSettings.get<IFormattingSettings>('formatting'))!;
if (this.formatting) {
Object.assign<IFormattingSettings, IFormattingSettings>(this.formatting, formattingSettings);
} else {
this.formatting = formattingSettings;
}
// Support for travis.
this.formatting = this.formatting
? this.formatting
: {
autopep8Args: [],
autopep8Path: 'autopep8',
provider: 'autopep8',
blackArgs: [],
blackPath: 'black',
yapfArgs: [],
yapfPath: 'yapf',
};
this.formatting.autopep8Path = getAbsolutePath(
systemVariables.resolveAny(this.formatting.autopep8Path),
workspaceRoot,
);
this.formatting.yapfPath = getAbsolutePath(systemVariables.resolveAny(this.formatting.yapfPath), workspaceRoot);
this.formatting.blackPath = getAbsolutePath(
systemVariables.resolveAny(this.formatting.blackPath),
workspaceRoot,
);

const testSettings = systemVariables.resolveAny(pythonSettings.get<ITestingSettings>('testing'))!;
if (this.testing) {
Object.assign<ITestingSettings, ITestingSettings>(this.testing, testSettings);
Expand Down
9 changes: 0 additions & 9 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,6 @@ export interface ILintingSettings {
banditArgs: string[];
banditPath: string;
}
export interface IFormattingSettings {
readonly provider: string;
autopep8Path: string;
readonly autopep8Args: string[];
blackPath: string;
readonly blackArgs: string[];
yapfPath: string;
readonly yapfArgs: string[];
}

export interface ITerminalSettings {
readonly executeInFileDir: boolean;
Expand Down
20 changes: 0 additions & 20 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,24 +516,4 @@ export namespace ToolsExtensions {
);
export const installPylintExtension = l10n.t('Install Pylint extension');
export const installFlake8Extension = l10n.t('Install Flake8 extension');

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

export const selectAutopep8FormatterPrompt = l10n.t(
'You have the Autopep8 formatter extension installed, would you like to use that as the default formatter?',
);

export const selectMultipleFormattersPrompt = l10n.t(
'You have multiple formatters installed, would you like to select one as the default formatter?',
);

export const installBlackFormatterPrompt = l10n.t(
'You triggered formatting with Black, would you like to install one of our new formatter extensions? This will also set it as the default formatter for Python.',
);

export const installAutopep8FormatterPrompt = l10n.t(
'You triggered formatting with Autopep8, would you like to install one of our new formatter extension? This will also set it as the default formatter for Python.',
);
}
2 changes: 0 additions & 2 deletions src/client/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
'use strict';

export enum EventName {
FORMAT_SORT_IMPORTS = 'FORMAT.SORT_IMPORTS',
FORMAT = 'FORMAT.FORMAT',
FORMAT_ON_TYPE = 'FORMAT.FORMAT_ON_TYPE',
EDITOR_LOAD = 'EDITOR.LOAD',
LINTING = 'LINTING',
Expand Down
39 changes: 1 addition & 38 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,33 +859,7 @@ export interface IEventNamePropertyMapping {
*/
scope: 'file' | 'selection';
};
/**
* Telemetry event sent with details when formatting a document
*/
/* __GDPR__
"format.format" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karthiknadig" },
"errorname" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
"errorstack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
"tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"hascustomargs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
"formatselection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.FORMAT]: {
/**
* Tool being used to format
*/
tool: 'autopep8' | 'black' | 'yapf';
/**
* If arguments for formatter is provided in resource settings
*/
hasCustomArgs: boolean;
/**
* Carries `true` when formatting a selection of text, `false` otherwise
*/
formatSelection: boolean;
};

/**
* Telemetry event sent with the value of setting 'Format on type'
*/
Expand All @@ -902,16 +876,6 @@ export interface IEventNamePropertyMapping {
*/
enabled: boolean;
};
/**
* Telemetry event sent when sorting imports using formatter
*/
/* __GDPR__
"format.sort_imports" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karthiknadig" },
"originaleventname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
}
*/
[EventName.FORMAT_SORT_IMPORTS]: never | undefined;

/**
* Telemetry event sent with details when tracking imports
Expand All @@ -921,7 +885,6 @@ export interface IEventNamePropertyMapping {
"hashedname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" }
}
*/

[EventName.HASHED_PACKAGE_NAME]: {
/**
* Hash of the package name
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 @@ -11,7 +11,6 @@
"python.linting.pylamaEnabled": false,
"python.linting.mypyEnabled": false,
"python.linting.banditEnabled": false,
"python.formatting.provider": "yapf",
// Don't set this to `Pylance`, for CI we want to use the LS that ships with the extension.
"python.languageServer": "Jedi",
"python.pythonPath": "C:\\GIT\\s p\\vscode-python\\.venv\\Scripts\\python.exe"
Expand Down
Loading

0 comments on commit 65c8ac6

Please sign in to comment.