Skip to content
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

Provide context to format provider so it knows whether a format came from a save request/manual invocation #59953

Closed
DanTup opened this issue Oct 4, 2018 · 5 comments
Assignees
Labels
config VS Code configuration, set up issues *duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Oct 4, 2018

I have users that need to disable format-on-save for some sub-tree within their project. Since they can't put settings in sub-folders (without making them workspace folders, which duplicates them at the top - see #45470) my plan is to implement a setting where they can configure a list of files (patterns, like files.exclude) to exclude from formatting.

However, it'd be bette if we could exclude them from automatic formatting without making explicit format requests silently fail. Currently it doesn't seem like the format provider is given enough information for this.

@RMacfarlane RMacfarlane added formatting Source formatter issues api feature-request Request for new features or functionality labels Oct 5, 2018
@jrieken jrieken added under-discussion Issue is under discussion for relevance, priority, approach and removed feature-request Request for new features or functionality labels Oct 8, 2018
@jrieken
Copy link
Member

jrieken commented Oct 8, 2018

This sounds just like workarounds. what you want is settings in sub folders.

@jrieken jrieken removed api formatting Source formatter issues labels Oct 8, 2018
@jrieken jrieken assigned sandy081 and unassigned jrieken and mjbvz Oct 8, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Oct 8, 2018

what you want is settings in sub folders

Yes, that's true! Is it on the cards? (I assumed not, but that would be waaay better)

@sandy081 sandy081 added config VS Code configuration, set up issues feature-request Request for new features or functionality and removed under-discussion Issue is under discussion for relevance, priority, approach labels Oct 12, 2018
@sandy081 sandy081 added this to the Backlog milestone Oct 12, 2018
@sandy081
Copy link
Member

/duplicate

#32693

@DanTup
Copy link
Contributor Author

DanTup commented Nov 16, 2020

I think there's actually another reason to have this that settings don't provide.

If a formatter refuses to format invalid code (which seems valid as a misplaced brace could mess everything up), it may be confusing to a user if the formatting request just "doesn't work" without giving some indication of why. Displaying a message seems reasonable.

However, if the format is being run on-save, then showing an error may be somewhat spammy.

The same is true for other commands (I opened microsoft/language-server-protocol#1018 in LSP about this.. right now all my commands tha may be useful to run on-save just fail "silently").

@github-actions github-actions bot locked and limited conversation to collaborators Jan 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
config VS Code configuration, set up issues *duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

6 participants
@DanTup @jrieken @RMacfarlane @sandy081 @mjbvz and others