question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More gracefully handle the fact that Black does not support "Format Selection"

See original GitHub issue

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.5.0
  • OS and version: Windows 10 x64
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.6.3 x64
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): n/a
  • Relevant/affected Python packages and their versions: black 18.6b1

Actual behavior

Every single time a paste a piece of code, I get the error message: “Black does not support the “Format Selection” command”

Expected behavior

No error message pop-ups.

    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.tabSize": 3,
    "python.formatting.autopep8Args": [
        "--indent_size=3"
    ],
    //"python.formatting.blackArgs": [
    //    "--indent_size=3"
    //],
    "python.formatting.provider": "black",
    "python.linting.pep8Enabled": false,
    "python.linting.pep8Args": [
        "--ignore=E111,E114,E121,E126,E127,E128,E265,E231,E303,E501,W291,W293,W503",
        "--max-line-length=89"
    ],
    //"python.linting.pylintArgs" If you don't use the pylintrc config file:
    //"python.linting.pylintArgs": ["--disable=C0303,W0311,E1101"],
    "python.linting.pylintEnabled": true,
    "python.linting.pydocstyleEnabled": false,

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:52
  • Comments:43 (16 by maintainers)

github_iconTop GitHub Comments

125reactions
brettcannoncommented, Jun 6, 2018

I should also mention that to turn off any feature in VS Code just for Python, you can do:

"[python]": {
    "editor.formatOnPaste": false
}
66reactions
egabrumcommented, Jun 6, 2018

@brettcannon Thanks for your answer but, please note that my original issue was not what this ticket has become now. I can see why Black does not want to do partial formatting. It would be nice if it allowed the option, but I can live with it.

My issue is with the Python Extension popping up an error window every single time I do a paste.

Also, the issue ticket is currently closed, so the re-orientation won’t lead to anything. Maybe either one of us should open a new ticket to address our respective problem.

Read more comments on GitHub >

github_iconTop 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 >
MapSource Updates & Downloads - Garmin
Fixed selection issue (waypoints were not de-selected when selecting a track before). Fixed an issue where MapSource did not remember the grid setting ......
Read more >
IO tools (text, CSV, HDF5, …) - Pandas - PyData |
Some formats which encode all characters as multiple bytes, like UTF-16, won't parse correctly at all without specifying the encoding. Full list of...
Read more >
Changelog - Cypress Documentation
Fixed a regression introduced in the Electron browser in Cypress 10.8.0 where the CYPRESS_EVERY_NTH_FRAME environment variable was not being set ...
Read more >
RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)
RFC 7540 HTTP/2 May 2015 A server that does not support HTTP/2 can respond ... The "h2c" protocol identifier MUST NOT be sent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found