Format selection doesn't use user's choice
See original GitHub issueBug: Notebook Editor, Interactive Window, Editor cells
Steps to cause the bug to occur
- Select black as formatting provider
- Change to autopep8 (or any other provider) (Code->Preferences->“python formatting provider”)
- Try auto-formatting a selection
Actual behavior
The extension throws an error saying that black can’t format selections, which is true, except the formatter was explicitly set to autopep8
Expected behavior
The extension should use the selected formatting provider.
Your Jupyter and/or Python environment
VS Code details:
Version: 1.47.1
Commit: 485c41f9460bdb830c4da12c102daff275415b53
Date: 2020-07-13T22:43:02.577Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.5.0
- Jupyter server running: Local
- Extension version: 2020.7.96456
- VS Code version: 1.47.1
- Setting python.jediEnabled: N/A
- Setting python.languageServer: Jedi
- Python and/or Anaconda version: conda version : 4.8.4 || python version : 3.7.7.final.0
- OS: Windows | Mac | Linux (distro): Mac 10.15.5 (19F101)
- Virtual environment: conda
active environment : CHMO
active env location : /Users/shaunak.de/opt/anaconda3/envs/CHMO
shell level : 2
user config file : /Users/shaunak.de/.condarc
populated config files : /Users/shaunak.de/.condarc
conda version : 4.8.2
conda-build version : 3.18.11
python version : 3.7.6.final.0
virtual packages : __osx=10.15.5
base environment : /Users/shaunak.de/opt/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /Users/shaunak.de/opt/anaconda3/pkgs
/Users/shaunak.de/.conda/pkgs
envs directories : /Users/shaunak.de/opt/anaconda3/envs
/Users/shaunak.de/.conda/envs
platform : osx-64
user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Darwin/19.5.0 OSX/10.15.5
UID:GID : 503:20
netrc file : None
offline mode : False
Developer Tools Console Output
INFO Setting search error: XHR timeout: 5000ms
workbench.desktop.main.js:sourcemap:1670 ERR TreeError [MarkersView] Tree element not found: [object Object]: Error: TreeError [MarkersView] Tree element not found: [object Object]
at t.ObjectTreeModel.getElementLocation (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:114:613)
at t.ObjectTreeModel.setCollapsed (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:113:855)
at H.expand (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1106:277)
at K.autoReveal (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:7069:818)
at K.onActiveEditorChanged (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:7066:842)
at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:7065:715
at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:92:235
at c.fire (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:95:801)
at F.doHandleActiveEditorChangeEvent (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6057:491)
at F.handleActiveEditorChange (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6057:289)
at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6057:601
at c.fire (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:95:801)
at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6290:665
at async e.openEditor (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6289:121)
workbench.desktop.main.js:sourcemap:2947 Black does not support the "Format Selection" command
Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Black does not support "Format Selection" command
In my situation (select black as the Python Formatting Provider in VS Code Settings), I encountered this warning everytime when I pasting ...
Read more >Basic Editing in Visual Studio Code
Learn about the basic editing features of Visual Studio Code. Search, multiple selection, code formatting.
Read more >ClangFormat — Clang 16.0.0git documentation
clang-format --help OVERVIEW: A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code. If no arguments are specified, it formats the code ...
Read more >Add a check box or option button (Form controls)
In the Format Control dialog box, on the Control tab, you can modify any of the available options: Checked: Displays an option button...
Read more >How To Format Code with Prettier in Visual Studio Code
You may then be prompted to choose which format to use. ... Note: If you do not see a prompt for selecting a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Dear Eric, Yes, I was able to simply delete that key and it works as expected! Hopefully this page serves as a reference for someone searching! SDe
On Thu, Aug 13, 2020 at 10:25 AM Eric Snow notifications@github.com wrote:
– Shaunak De http://shaunak.de/ https://mailtrack.io/trace/link/c0929390ce7fb688511eb96d9c4a6e3238564567?url=http%3A%2F%2Fshaunak.de%2F&userId=3142140&signature=52a0a69ba6a7701c
That’s great to hear. Thanks for following up!