-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add code_actions
as formatter
type
#10121
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cla-bot
bot
added
the
cla-signed
The user has signed the Contributor License Agreement
label
Apr 3, 2024
maxdeviant
reviewed
Apr 3, 2024
maxdeviant
reviewed
Apr 3, 2024
maxdeviant
reviewed
Apr 3, 2024
This fixes #8992 and solves a problem that ESLint/Prettier/... users have been running into: They want to format _only_ with ESLint, which is *not* a primary language server (so `formatter: language server` does not help) and it is not a formatter. What they want to use is what they get when they have configured something like this: ```json { "languages": { "JavaScript": { "code_actions_on_format": { "source.fixAll.eslint": true } } } } ``` BUT they don't want to run the formatter. So what this PR does is to add a new formatter type: `code_actions`. With that, users can only use code actions to format: ```json { "languages": { "JavaScript": { "formatter": { "code_actions": { "source.fixAll.eslint": true } } } } } ``` This means that when formatting (via `editor: format` or on-save) only the code actions that are specified are being executed, no formatter. Co-authored-by: JH Chabran <jh@chabran.fr>
mrnugget
force-pushed
the
code-actions-formatter
branch
from
April 3, 2024 13:51
b04733f
to
5afbcc6
Compare
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This was referenced Apr 3, 2024
mrnugget
added a commit
that referenced
this pull request
Apr 4, 2024
Love this! Tysm |
This is awesome! I have been inching my way towards Zed from VsCode and I think this is what I needed to do my Typescript development on Zed full time (I almost exclusively use it for Python outside of Jupyter notebooks). Keep up the great work :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #8992 and solves a problem that ESLint/Prettier/... users have been running into:
They want to format only with ESLint, which is not a primary language server (so
formatter: language server
does not help) and it is not a formatter.What they want to use is what they get when they have configured something like this:
BUT they don't want to run the formatter.
So what this PR does is to add a new formatter type:
code_actions
.With that, users can only use code actions to format:
This means that when formatting (via
editor: format
or on-save) only the code actions that are specified are being executed, no formatter.Release Notes:
formatter
/format_on_save
option:code_actions
. When configured, this uses language server code actions to format a buffer. This can be used if one wants to, for example, format a buffer with ESLint and not run prettier or another formatter afterwards. Example configuration:{"languages": {"JavaScript": {"formatter": {"code_actions": {"source.fixAll.eslint": true}}}}}
(#8992).