ZIm/crates/project/src
Thorsten Ball eb231d0449
Add code_actions as formatter type (#10121)
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.


Release Notes:

- Added a new `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](https://github.com/zed-industries/zed/issues/8992)).

---------

Co-authored-by: JH Chabran <jh@chabran.fr>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-03 16:16:03 +02:00
..
debounced_delay.rs Add debounce for re-querying completion documentation 2024-01-31 09:50:26 -05:00
lsp_command.rs Query code actions and hovers from all related local language servers (from remote clients) (#10111) 2024-04-03 13:34:56 +03:00
lsp_ext_command.rs text: Wrap BufferId into a newtype 2024-01-29 20:00:47 +01:00
prettier_support.rs Add code_actions as formatter type (#10121) 2024-04-03 16:16:03 +02:00
project.rs Add code_actions as formatter type (#10121) 2024-04-03 16:16:03 +02:00
project_settings.rs Add ability to specify binary path/args for rust-analyzer (#9293) 2024-03-13 18:42:03 +01:00
project_tests.rs Query code actions and hovers from all related local language servers (from remote clients) (#10111) 2024-04-03 13:34:56 +03:00
search.rs Support newline and tab literals in regex search-and-replace operations (#9609) 2024-03-25 12:21:04 +01:00
search_history.rs project search: Persist search history across session (#9932) 2024-04-02 11:13:18 +02:00
task_inventory.rs Extensions registering tasks (#9572) 2024-03-22 16:18:33 +01:00
terminals.rs Use different icons for terminal tasks (#9876) 2024-03-27 20:49:10 +01:00