ZIm/crates/project/src
Thorsten Ball f8959834c4
Add ability to run ESLint (and other non-primary language server) code actions on format (#8496)
This PR does two things to fix
https://github.com/zed-industries/zed/issues/4325:

1. It changes the way `code_actions_on_format` works to send the
possibly configured code actions to _all_ (and not just the primary)
languages servers. That means configured code actions can now be sent to
ESLint, tailwind, ... and other language servers.
2. It enables `codeActionsOnSave` by default for ESLint. That does
**not** mean that by default we will run something on save, but only
that we enable it for ESLint.

Users can then configure their Zed to run the `eslint` code action on
format. Example, for JavaScript:

```json
    {
      "languages": {
        "JavaScript": {
          "code_actions_on_format": {
            "source.fixAll.eslint": true
          }
        },
      }
    }
```

Release Notes:

- Added ability to run ESLint fixes when formatting a buffer. Code
actions configured in
[`code_actions_on_format`](https://zed.dev/docs/configuring-zed#code-actions-on-format)
are now being sent to _all_ language servers connected to a buffer, not
just the primary one. So if a user now sets `"code_actions_on_format": {
"source.fixAll.eslint": true }` in their Zed settings, the
`source.fixAll.eslint` code action will be sent to ESLint, which is not
a primary language server. Since the formatter (prettier, or external
commands, or another language server, ...) still runs, it's important
that these code actions and the formatter don't clash.
([#4325](https://github.com/zed-industries/zed/issues/4325)).

Demo:



https://github.com/zed-industries/zed/assets/1185253/9ef03ad5-1f5c-4d46-b72a-eef611e32f39
2024-02-28 13:55:20 +01:00
..
debounced_delay.rs Add debounce for re-querying completion documentation 2024-01-31 09:50:26 -05:00
lsp_command.rs Add missing wait_for_anchors (#8509) 2024-02-27 16:04:30 -07:00
lsp_ext_command.rs text: Wrap BufferId into a newtype 2024-01-29 20:00:47 +01:00
prettier_support.rs Fix formatting of code in prettier crate (#8526) 2024-02-28 12:51:08 +01:00
project.rs Add ability to run ESLint (and other non-primary language server) code actions on format (#8496) 2024-02-28 13:55:20 +01:00
project_tests.rs CI: Enable clippy on Windows (#8240) 2024-02-23 16:23:42 -08:00
search.rs Add project search in gitignored test 2023-12-05 12:45:44 +02:00
task_inventory.rs Add tests on inventory task sorting 2024-02-28 14:13:40 +02:00
terminals.rs Rename runnables into tasks (#8119) 2024-02-21 14:56:43 +02:00