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>
This PR removes the `basic.conf` file.
In #10099 we suppressed some typo warnings that had cropped up in this
file, but it turns out we don't need the file at all.
Release Notes:
- N/A
Refs #9647
Fixes https://github.com/zed-industries/zed/issues/9792
This pull request moves the computation of scrollbar markers off the
main thread, to prevent them from grinding the editor to a halt when we
have a lot of them (e.g., when there are lots of search results on a
large file). With these changes we also avoid generating multiple quads
for adjacent markers, thus fixing an issue where we stop drawing other
primitives because we've drawn too many quads in the scrollbar.
Release Notes:
- Improved editor performance when displaying lots of search results,
diagnostics, or symbol highlights in the scrollbar
([#9792](https://github.com/zed-industries/zed/issues/9792)).
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan <nathan@zed.dev>
Previously this code would run the changed commend, take its output,
remove the `marker` from the front and then split on `0` byte.
Problem was that `echo` adds a newline, which we did *NOT* skip. So
whatever `env` printed as the first environment variable would have a
`\n` in front of it.
Instead of setting, say, `HOME`, Zed would set `\nHOME`.
This change fixes the issue by switching to `printf '%s' marker`, which
is more portable than using `echo -n`.
This is related to https://github.com/zed-industries/zed/issues/9786 but
I'm not sure yet whether that fixes it.
Release Notes:
- Fixed Zed sometimes missing environment variables from shell in case
they were the first environment variable listed by `/usr/bin/env`.
Presently the only available setting under `problems` is
`shortenToSingleLine`, which defaults to `false`.
Example Zed `settings.json` to shorten eslint error squiggles to only
show on the first line of the problem:
```json
{
"lsp": {
"eslint": {
"settings": {
"problems": {
"shortenToSingleLine": true
}
}
}
}
}
```
Release Notes:
- Added support for configuring ESLint `problems` settings, ie. `{"lsp":
{"eslint": {"settings": {"problems": {"shortenToSingleLine": true}}}}}`
Demo:
https://github.com/zed-industries/zed/assets/2072378/379faa75-1f37-4fd1-85da-1510f1397d07
@ConradIrwin This is a followup for #9035 as agreed.
Release Notes:
- Fixed mention notifications are updated when channel message is
updated. And mention notifications are removed when message is removed.
---------
Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
This PR updates the `typos` configuration to suppress some typos in
`basic.conf`.
AFAICT there must have been an update to `typos` that caused this new
warning to appear.
Release Notes:
- N/A
This PR reverts #6924, for the reasons stated in
https://github.com/zed-industries/zed/pull/6924#issuecomment-2033076300.
It also fixes an issue were the `find_all_references_task_sources`
wasn't cleaned up in all cases.
Release Notes:
- N/A
---------
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
span! statically determines which fields are available, and record
silently fails if you write to a field that is not available :/
Release Notes:
- N/A
Due to: https://github.com/zed-industries/zed/issues/9985 and an
abundance of caution, I'm reverting the image and svg rendering updates
for now until we can debug the issue. cc: @niklaswimmer
Release Notes:
- N/A
This PR extracts Clojure support into an extension and removes the
built-in Clojure support from Zed.
Release Notes:
- Removed built-in support for Clojure, in favor of making it available
as an extension. The Clojure extension will be suggested for download
when you open a `.clj` or other Clojure-related files.
---------
Co-authored-by: Max <max@zed.dev>
This reverts https://github.com/zed-industries/zed/pull/8327
That PR introduced a regression where completions' syntax highlighting
would be corrupted in a non-deterministic way, such that it varied from
frame to frame:
In the screenshot below, many of the field names (e.g. `cursor`,
`depth`) are incorrectly colored as types instead of fields. The
`finished_states` field has highlighting that changes at the wrong
offset. All of these values changed from frame to frame, creating a
strange flickering effect:
<img width="599" alt="Screenshot 2024-04-01 at 5 56 36 PM"
src="https://github.com/zed-industries/zed/assets/326587/b6a48f02-f146-4f76-92e6-32fb417d86c0">
Release Notes:
- N/A
This PR refactors the conversions to `wasmtime::Result` to use a trait
so that we can perform the conversions in a postfix-friendly way.
Release Notes:
- N/A
This fixes#9928 by invalidating the tooltip on mouse scroll.
I think _ideally_ we'd have a solution that only invalidates it if,
after mouse scroll, we're not hovering over the element. But I tried
that (by essentially duplicating the code for `MouseMoveEvent` but that
lead to some inconsistencies. I think we don't redraw when we finish
scrolling.
This now behaves exactly like tooltips in Chrome: invalidate on scroll,
move mouse again to trigger the tooltip.
It also behaves like the hover tooltips in the editor.
https://github.com/zed-industries/zed/assets/1185253/05b9170e-414c-4453-84e5-90510b943c15
Release Notes:
- N/A
In 9970 @JosephTLyons noticed that tab + tab_prev action sequence leaves
a buffer in the dirty state, whereas "similar" indent-outdent does not.
I've tracked it down to the fact that tabs are always inserted at the
start of the line, regardless of the cursor position, whereas tab-prevs
act from cursor position.
This PR adjust tab/tab-prev actions (and indent-outdent) to act from
cursor position if possible. That way we can correctly report buffer
dirty state for these event sequences.
Fixes#9970
Release Notes:
- Fixed buffer being marked as dirty when using tab/tab-prev actions.
Partially implements #9717, persistence between restarts is currently
missing, but I would like to get feedback on the implementation first.
Previously the search history was not saved across different project
searches. As the `SearchHistory` is now maintained inside of the
project, it can be persisted across different project searches.
I also removed the behavior that a new query replaces the previous
search query, if it contains the text of the previous query.
I believe this was only intended to make buffer search work, therefore I
disabled this behavior but only for the project search.
Currently when you navigated through the queries the tab title changed
even if the search was not started, which doesn't make sense to me.
Current behavior:
https://github.com/zed-industries/zed/assets/53836821/1c365702-e93c-4cab-a1eb-0af3fef95476
With this PR the tab header will actually keep the search name until you
start another search again.
---
Showcase:
https://github.com/zed-industries/zed/assets/53836821/c0d6e496-915f-44bc-be16-12d7c3cda2d7
Release Notes:
- Added support for persisting project search history across a session
- Fixed tab header of project search changing when cycling through
search history, even when there is no search submitted
Replace the test that tested with
`chrono::offset::Local::now().naive_local()` taken, failing the
formatting once per year at least.
Release Notes:
- N/A
Release Notes:
- Fixes#4502
Notes:
I removed this line of code which removes the vim keymap contexts when
an editor is blurred.
16e6f5643c/crates/vim/src/vim.rs (L703-L705)
I tried whether the editor context would be poisoned when switching
between two editors and disabling vim mode and switching back but the
context looked normal. If this change is wrong, please advise. I could
not find why this piece of code was required.
This fixes#4502 as the reason why keybinds did not show up was because
the vim context was removed from the editor's keymap contexts. Other
paths for a fix could be to filter out vim predicates when finding
keybinds for actions but I believe that'd add unnecessary complexity.
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This PR modifies the extension installation and update process to
respect version constraints (schema version and Wasm API version) to
ensure only compatible versions of extensions are able to be installed.
To achieve this there is a new `GET /extensions/updates` endpoint that
will return extension versions based on the provided constraints.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
This PR makes it so extensions can provide values for the `language_ids`
method on the `LspAdapter` trait.
These are provided as data in the `language_servers` section of the
`extension.toml`, like so:
```toml
[language_servers.intelephense]
name = "Intelephense"
language = "PHP"
language_ids = { PHP = "php"}
```
Release Notes:
- N/A
Co-authored-by: Max <max@zed.dev>
This PR adds a new function, `make-file-executable`, to the Zed
extension API that can be used to mark a given file as executable
(typically the language server binary).
This is available in v0.0.5 of the `zed_extension_api` crate.
We also reworked how we represent the various WIT versions on disk to
make it a bit clearer what the version number entails.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
Reverts zed-industries/zed#9768
That change didn't seem necessary and it made symbols that need a key
shortcut to be written (e.g. SHIFT + 2 for a quote) infinitely repeat.
Release Notes:
- N/A
This PR makes it so `.DS_Store` files are skipped when trying to load
extension directories.
Previously it would fail and log an error.
Release Notes:
- Fixed an issue where the presence of a `.DS_Store` file in the
extensions directory would produce an error in the logs.
If you use soft tabs by default, editing Makefiles will be broken as
they require tab indentation to parse correctly.
Release Notes;
- Changed default settings for `Makefile`s to use hard tabs.
This PR adds the `pane_group.border` theme attribute that defines the
color of the borders between pane groups.
- Defaults to the `border` color, so nothing changes in the existing
themes.
- VSCode theme converter takes it from the `editorGroup.border`.
The borders marked by red are affected:
<img width="878" alt="pane_group_borders"
src="https://github.com/zed-industries/zed/assets/2101250/54b9fd39-b3e1-4898-a047-ee0b6ec953ed">
Release Notes:
- Added `pane_group.border` to the theme for modifying the border color
for panes within a pane group.
Related Issues:
- First discussed in
https://github.com/zed-industries/zed/pull/9754#issuecomment-2026497213
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR hoists the `profile.dev.package` settings for compiling the
`resvg` crate with optimizations up to the workspace level, since Cargo
was complaining:
```
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /Users/maxdeviant/projects/zed/crates/gpui/Cargo.toml
workspace: /Users/maxdeviant/projects/zed/Cargo.toml
```
Release Notes:
- N/A
This PR updates the color of the label used for Git-aware items to use
the `ignored` color from the theme when the item is ignored by Git.
The built-in themes have had their `ignored` color updated to match
`text.disabled`, as the existing `ignored` color did not sufficiently
differentiate from non-ignored items.
Fixes#9976.
Release Notes:
- Updated items in the project panel to use the `ignored` color from the
theme when they are ignored by Git
([#9976](https://github.com/zed-industries/zed/issues/9976)).
Closes https://github.com/zed-industries/zed/issues/4730
![image](https://github.com/zed-industries/zed/assets/2690773/d3c5317f-8120-45b5-b57c-c0fb5d8c066d)
To the left is a symlink, to the right — the real file.
The issue was due to the fact, that symlinks files contain the file path
to the real file, and git (properly) treats that symlink file contents
as diff base, returning in `load_index_text` (via `let content =
repo.find_blob(oid)?.content().to_owned();`) the contents of that
symlink file — the path.
The fix checks for FS metadata before fetching the git diff base, and
skips it entirely for symlinks: Zed opens the symlink file contents
instead, fully obscuring the git symlink diff hunks.
Interesting, that VSCode behaves as Zed before the fix; while the fix
makes Zed behave like Intellij* IDEs now.
Release Notes:
- Fixed git diff hunks appearing in the symlinked files
([4730](https://github.com/zed-industries/zed/issues/4730))