Skip to content

Support ignore patterns for formatters #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iutlu opened this issue Nov 18, 2019 · 5 comments
Closed

Support ignore patterns for formatters #359

iutlu opened this issue Nov 18, 2019 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality triage-needed Issue is not triaged.

Comments

@iutlu
Copy link

iutlu commented Nov 18, 2019

Currently there's an option for linters that allows files to be excluded (python.linting.ignorePatterns), but there's not a similar option for formatters as far as I can see.

Would it be possible to implement a similar python.formatting.ignorePatterns, so that we can configure VSCode to not format, e.g., files from the standard library, or 3rd party packages? In my experiments, the Python extension does invoke the formatter for files in site-packages. I think it's more valuable to protect those kinds of files against accidental formatting, rather than accidental linting.

There's a similar issue at microsoft/vscode-python#7047, but that one's about black's inability to hard-exclude files (including files passed on the command line). I'm interested in not invoking the formatter in the first place.

@iutlu iutlu added triage-needed Issue is not triaged. feature-request Request for new features or functionality labels Nov 18, 2019
@brettcannon
Copy link
Member

Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision.

@limonkufu
Copy link

I also need this, I think this would be very useful

@mathieucaroff
Copy link

It would be useful to me to be able formatting-ignore the files under /site-packages/, as I put breakpoints there and I don't want these files formatted when I save.

@luabud luabud assigned luabud and unassigned luabud May 12, 2022
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Oct 31, 2023
@github-actions github-actions bot added the triage-needed Issue is not triaged. label Oct 31, 2023
@brettcannon
Copy link
Member

Black supports # fmt: off markers to turn formatting off. It also supports --exclude and --extend-exclude options to control what files to format. And you can turn off the extension per-workspace or use profiles if you don't want to use it in other situations if you have configured Black as your formatter and turned on format-on-save universally instead of per-project.

@karthiknadig
Copy link
Member

Black extension works with --force-exclude black option, closing this in favor of that CLI option.
related: #360

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

7 participants