Skip to content

Commit 65c8ac6

Browse files
authored
Remove formatting settings (#22202)
Closes #22183
1 parent d1e4562 commit 65c8ac6

File tree

14 files changed

+6
-289
lines changed

14 files changed

+6
-289
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/L
6060
| `Python: Select Interpreter` | Switch between Python interpreters, versions, and environments. |
6161
| `Python: Start REPL` | Start an interactive Python REPL using the selected interpreter in the VS Code terminal. |
6262
| `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`. |
63-
| `Format Document` | Formats code using the provided [formatter](https://code.visualstudio.com/docs/python/editing#_formatting) in the `settings.json` file. |
63+
| `Format Document` | Formats code using the provided [formatter](https://code.visualstudio.com/docs/python/formatting) in the `settings.json` file. |
6464
| `Python: Configure Tests` | Select a test framework and configure it to display the Test Explorer. |
6565

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

7272
- [IntelliSense](https://code.visualstudio.com/docs/python/editing#_autocomplete-and-intellisense): Edit your code with auto-completion, code navigation, syntax checking and more
7373
- [Linting](https://code.visualstudio.com/docs/python/linting): Get additional code analysis with Pylint, Flake8 and more
74-
- [Code formatting](https://code.visualstudio.com/docs/python/editing#_formatting): Format your code with black, autopep or yapf
75-
74+
- [Code formatting](https://code.visualstudio.com/docs/python/formatting): Format your code with black, autopep or yapf
7675
- [Debugging](https://code.visualstudio.com/docs/python/debugging): Debug your Python scripts, web apps, remote or multi-threaded processes
77-
7876
- [Testing](https://code.visualstudio.com/docs/python/unit-testing): Run and debug tests through the Test Explorer with unittest or pytest.
79-
8077
- [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
81-
8278
- [Environments](https://code.visualstudio.com/docs/python/environments): Automatically activate and switch between virtualenv, venv, pipenv, conda and pyenv environments
83-
8479
- [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).
8580

8681

build/test-requirements.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
# pin setoptconf to prevent issue with 'use_2to3'
22
setoptconf==0.3.0
33

4-
# Install flake8 first, as both flake8 and autopep8 require pycodestyle,
5-
# but flake8 has a tighter pinning.
64
flake8
7-
autopep8
85
bandit
9-
black
10-
yapf
116
pylint
127
pycodestyle
138
pydocstyle

package.json

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -577,77 +577,6 @@
577577
"type": "array",
578578
"uniqueItems": true
579579
},
580-
"python.formatting.autopep8Args": {
581-
"default": [],
582-
"description": "%python.formatting.autopep8Args.description%",
583-
"items": {
584-
"type": "string"
585-
},
586-
"scope": "resource",
587-
"type": "array",
588-
"markdownDeprecationMessage": "%python.formatting.autopep8Args.markdownDeprecationMessage%",
589-
"deprecationMessage": "%python.formatting.autopep8Args.deprecationMessage%"
590-
},
591-
"python.formatting.autopep8Path": {
592-
"default": "autopep8",
593-
"description": "%python.formatting.autopep8Path.description%",
594-
"scope": "machine-overridable",
595-
"type": "string",
596-
"markdownDeprecationMessage": "%python.formatting.autopep8Path.markdownDeprecationMessage%",
597-
"deprecationMessage": "%python.formatting.autopep8Path.deprecationMessage%"
598-
},
599-
"python.formatting.blackArgs": {
600-
"default": [],
601-
"description": "%python.formatting.blackArgs.description%",
602-
"items": {
603-
"type": "string"
604-
},
605-
"scope": "resource",
606-
"type": "array",
607-
"markdownDeprecationMessage": "%python.formatting.blackArgs.markdownDeprecationMessage%",
608-
"deprecationMessage": "%python.formatting.blackArgs.deprecationMessage%"
609-
},
610-
"python.formatting.blackPath": {
611-
"default": "black",
612-
"description": "%python.formatting.blackPath.description%",
613-
"scope": "machine-overridable",
614-
"type": "string",
615-
"markdownDeprecationMessage": "%python.formatting.blackPath.markdownDeprecationMessage%",
616-
"deprecationMessage": "%python.formatting.blackPath.deprecationMessage%"
617-
},
618-
"python.formatting.provider": {
619-
"default": "autopep8",
620-
"description": "%python.formatting.provider.description%",
621-
"enum": [
622-
"autopep8",
623-
"black",
624-
"none",
625-
"yapf"
626-
],
627-
"scope": "resource",
628-
"type": "string",
629-
"markdownDeprecationMessage": "%python.formatting.provider.markdownDeprecationMessage%",
630-
"deprecationMessage": "%python.formatting.provider.deprecationMessage%"
631-
},
632-
"python.formatting.yapfArgs": {
633-
"default": [],
634-
"description": "%python.formatting.yapfArgs.description%",
635-
"items": {
636-
"type": "string"
637-
},
638-
"scope": "resource",
639-
"type": "array",
640-
"markdownDeprecationMessage": "%python.formatting.yapfArgs.markdownDeprecationMessage%",
641-
"deprecationMessage": "%python.formatting.yapfArgs.deprecationMessage%"
642-
},
643-
"python.formatting.yapfPath": {
644-
"default": "yapf",
645-
"description": "%python.formatting.yapfPath.description%",
646-
"scope": "machine-overridable",
647-
"type": "string",
648-
"markdownDeprecationMessage": "%python.formatting.yapfPath.markdownDeprecationMessage%",
649-
"deprecationMessage": "%python.formatting.yapfPath.deprecationMessage%"
650-
},
651580
"python.globalModuleInstallation": {
652581
"default": false,
653582
"description": "%python.globalModuleInstallation.description%",

package.nls.json

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,6 @@
4242
"python.experiments.pythonTerminalEnvVarActivation.description": "Enables use of environment variables to activate terminals instead of sending activation commands.",
4343
"python.experiments.pythonTestAdapter.description": "Denotes the Python Test Adapter experiment.",
4444
"python.experiments.pythonREPLSmartSend.description": "Denotes the Python REPL Smart Send experiment.",
45-
"python.formatting.autopep8Args.description": "Arguments passed in. Each argument is a separate item in the array.",
46-
"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).",
47-
"python.formatting.autopep8Args.deprecationMessage": "This setting will soon be deprecated. Please use the Autopep8 extension. Learn more here: https://aka.ms/AAlgvkb.",
48-
"python.formatting.autopep8Path.description": "Path to autopep8, you can use a custom version of autopep8 by modifying this setting to include the full path.",
49-
"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).",
50-
"python.formatting.autopep8Path.deprecationMessage": "This setting will soon be deprecated. Please use the Autopep8 extension. Learn more here: https://aka.ms/AAlgvkb.",
51-
"python.formatting.blackArgs.description": "Arguments passed in. Each argument is a separate item in the array.",
52-
"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).",
53-
"python.formatting.blackArgs.deprecationMessage": "This setting will soon be deprecated. Please use the Black Formatter extension. Learn more here: https://aka.ms/AAlgvkb.",
54-
"python.formatting.blackPath.description": "Path to Black, you can use a custom version of Black by modifying this setting to include the full path.",
55-
"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).",
56-
"python.formatting.blackPath.deprecationMessage": "This setting will soon be deprecated. Please use the Black Formatter extension. Learn more here: https://aka.ms/AAlgvkb.",
57-
"python.formatting.provider.description": "Provider for formatting. Possible options include 'autopep8', 'black', and 'yapf'.",
58-
"python.formatting.provider.markdownDeprecationMessage": "This setting will soon be deprecated. Please use a dedicated formatter extension. <br>Learn more [here](https://aka.ms/AAlgvkb).",
59-
"python.formatting.provider.deprecationMessage": "This setting will soon be deprecated. Please use a dedicated formatter extension. Learn more here: https://aka.ms/AAlgvkb.",
60-
"python.formatting.yapfArgs.description": "Arguments passed in. Each argument is a separate item in the array.",
61-
"python.formatting.yapfArgs.markdownDeprecationMessage": "Built-in Yapf support will soon be deprecated. Learn more [here](https://aka.ms/AAlgvkb).",
62-
"python.formatting.yapfArgs.deprecationMessage": "Built-in Yapf support will soon be deprecated. Learn more here: https://aka.ms/AAlgvkb.",
63-
"python.formatting.yapfPath.description": "Path to yapf, you can use a custom version of yapf by modifying this setting to include the full path.",
64-
"python.formatting.yapfPath.markdownDeprecationMessage": "Yapf support will soon be deprecated. <br>Learn more [here](https://aka.ms/AAlgvkb).",
65-
"python.formatting.yapfPath.deprecationMessage": "Built-in Yapf support will soon be deprecated. Learn more here: https://aka.ms/AAlgvkb.",
6645
"python.globalModuleInstallation.description": "Whether to install Python modules globally when not using an environment.",
6746
"python.languageServer.description": "Defines type of the language server.",
6847
"python.languageServer.defaultDescription": "Automatically select a language server: Pylance if installed and available, otherwise fallback to Jedi.",

resources/report_issue_user_settings.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@
6969
"memory": true,
7070
"symbolsHierarchyDepthLimit": false
7171
},
72-
"formatting": {
73-
"autopep8Args": "placeholder",
74-
"autopep8Path": "placeholder",
75-
"provider": true,
76-
"blackArgs": "placeholder",
77-
"blackPath": "placeholder",
78-
"yapfArgs": "placeholder",
79-
"yapfPath": "placeholder"
80-
},
8172
"testing": {
8273
"cwd": "placeholder",
8374
"debugPort": true,

src/client/common/configSettings.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
IAutoCompleteSettings,
2828
IDefaultLanguageServer,
2929
IExperiments,
30-
IFormattingSettings,
3130
IInterpreterPathService,
3231
IInterpreterSettings,
3332
ILintingSettings,
@@ -109,8 +108,6 @@ export class PythonSettings implements IPythonSettings {
109108

110109
public linting!: ILintingSettings;
111110

112-
public formatting!: IFormattingSettings;
113-
114111
public autoComplete!: IAutoCompleteSettings;
115112

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

398-
const formattingSettings = systemVariables.resolveAny(pythonSettings.get<IFormattingSettings>('formatting'))!;
399-
if (this.formatting) {
400-
Object.assign<IFormattingSettings, IFormattingSettings>(this.formatting, formattingSettings);
401-
} else {
402-
this.formatting = formattingSettings;
403-
}
404-
// Support for travis.
405-
this.formatting = this.formatting
406-
? this.formatting
407-
: {
408-
autopep8Args: [],
409-
autopep8Path: 'autopep8',
410-
provider: 'autopep8',
411-
blackArgs: [],
412-
blackPath: 'black',
413-
yapfArgs: [],
414-
yapfPath: 'yapf',
415-
};
416-
this.formatting.autopep8Path = getAbsolutePath(
417-
systemVariables.resolveAny(this.formatting.autopep8Path),
418-
workspaceRoot,
419-
);
420-
this.formatting.yapfPath = getAbsolutePath(systemVariables.resolveAny(this.formatting.yapfPath), workspaceRoot);
421-
this.formatting.blackPath = getAbsolutePath(
422-
systemVariables.resolveAny(this.formatting.blackPath),
423-
workspaceRoot,
424-
);
425-
426395
const testSettings = systemVariables.resolveAny(pythonSettings.get<ITestingSettings>('testing'))!;
427396
if (this.testing) {
428397
Object.assign<ITestingSettings, ITestingSettings>(this.testing, testSettings);

src/client/common/types.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,6 @@ export interface ILintingSettings {
258258
banditArgs: string[];
259259
banditPath: string;
260260
}
261-
export interface IFormattingSettings {
262-
readonly provider: string;
263-
autopep8Path: string;
264-
readonly autopep8Args: string[];
265-
blackPath: string;
266-
readonly blackArgs: string[];
267-
yapfPath: string;
268-
readonly yapfArgs: string[];
269-
}
270261

271262
export interface ITerminalSettings {
272263
readonly executeInFileDir: boolean;

src/client/common/utils/localize.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -516,24 +516,4 @@ export namespace ToolsExtensions {
516516
);
517517
export const installPylintExtension = l10n.t('Install Pylint extension');
518518
export const installFlake8Extension = l10n.t('Install Flake8 extension');
519-
520-
export const selectBlackFormatterPrompt = l10n.t(
521-
'You have the Black formatter extension installed, would you like to use that as the default formatter?',
522-
);
523-
524-
export const selectAutopep8FormatterPrompt = l10n.t(
525-
'You have the Autopep8 formatter extension installed, would you like to use that as the default formatter?',
526-
);
527-
528-
export const selectMultipleFormattersPrompt = l10n.t(
529-
'You have multiple formatters installed, would you like to select one as the default formatter?',
530-
);
531-
532-
export const installBlackFormatterPrompt = l10n.t(
533-
'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.',
534-
);
535-
536-
export const installAutopep8FormatterPrompt = l10n.t(
537-
'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.',
538-
);
539519
}

src/client/telemetry/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
'use strict';
55

66
export enum EventName {
7-
FORMAT_SORT_IMPORTS = 'FORMAT.SORT_IMPORTS',
8-
FORMAT = 'FORMAT.FORMAT',
97
FORMAT_ON_TYPE = 'FORMAT.FORMAT_ON_TYPE',
108
EDITOR_LOAD = 'EDITOR.LOAD',
119
LINTING = 'LINTING',

src/client/telemetry/index.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -859,33 +859,7 @@ export interface IEventNamePropertyMapping {
859859
*/
860860
scope: 'file' | 'selection';
861861
};
862-
/**
863-
* Telemetry event sent with details when formatting a document
864-
*/
865-
/* __GDPR__
866-
"format.format" : {
867-
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karthiknadig" },
868-
"errorname" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
869-
"errorstack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
870-
"tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
871-
"hascustomargs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" },
872-
"formatselection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
873-
}
874-
*/
875-
[EventName.FORMAT]: {
876-
/**
877-
* Tool being used to format
878-
*/
879-
tool: 'autopep8' | 'black' | 'yapf';
880-
/**
881-
* If arguments for formatter is provided in resource settings
882-
*/
883-
hasCustomArgs: boolean;
884-
/**
885-
* Carries `true` when formatting a selection of text, `false` otherwise
886-
*/
887-
formatSelection: boolean;
888-
};
862+
889863
/**
890864
* Telemetry event sent with the value of setting 'Format on type'
891865
*/
@@ -902,16 +876,6 @@ export interface IEventNamePropertyMapping {
902876
*/
903877
enabled: boolean;
904878
};
905-
/**
906-
* Telemetry event sent when sorting imports using formatter
907-
*/
908-
/* __GDPR__
909-
"format.sort_imports" : {
910-
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "owner": "karthiknadig" },
911-
"originaleventname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" }
912-
}
913-
*/
914-
[EventName.FORMAT_SORT_IMPORTS]: never | undefined;
915879

916880
/**
917881
* Telemetry event sent with details when tracking imports
@@ -921,7 +885,6 @@ export interface IEventNamePropertyMapping {
921885
"hashedname" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "luabud" }
922886
}
923887
*/
924-
925888
[EventName.HASHED_PACKAGE_NAME]: {
926889
/**
927890
* Hash of the package name

src/test/.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"python.linting.pylamaEnabled": false,
1212
"python.linting.mypyEnabled": false,
1313
"python.linting.banditEnabled": false,
14-
"python.formatting.provider": "yapf",
1514
// Don't set this to `Pylance`, for CI we want to use the LS that ships with the extension.
1615
"python.languageServer": "Jedi",
1716
"python.pythonPath": "C:\\GIT\\s p\\vscode-python\\.venv\\Scripts\\python.exe"

0 commit comments

Comments
 (0)