Commit Graph

15004 Commits

Author SHA1 Message Date
Nate Butler
03d853d344
Introduce TextField by adding the ui_text_field crate (#10361)
There hasn't been a componentized way to create inputs or text fields
thus far due to the innate circular dependency between the `ui` and
`editor` crates. To bypass this issue we are introducing a new
`ui_text_field` crate to specifically handle this component.

`TextField` provides the ability to add stacked or inline labels, as
well as applies a standard visual style to inputs.

Example:

![CleanShot - 2024-04-10 at 11 22
13@2x](https://github.com/zed-industries/zed/assets/1714999/9bf5fc40-5024-4d01-9a8b-fb76f67d7e6e)

We'll continue to evolve this component in the near future and start
using it in the app once we've built out the needed functionality.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-10 11:53:25 -04:00
Joseph T. Lyons
d03f1c4cab v0.132.x dev 2024-04-10 11:45:05 -04:00
Conrad Irwin
fc10201ce2
Remove occasionally incorrect expectation (#10358)
This panic has occured a handful of times, I think it must be the case
that:

1. Item is dropped outside of an update loop
2. The next update is this one

In that case no flush effects will have called the release observers
yet, but we cannot upgrade the WeakModel because the ref count is 0



Release Notes:

- Fixed a (rare) panic while collaborating
2024-04-10 11:34:54 -04:00
Nathan Sobo
7abb63cfda
Improve the ergonomics of creating local buffers (#10347)
This PR renames `language::Buffer::new` to `language::Buffer::local` and
simplifies its interface. Instead of taking a replica id (which should
always be 0 for the local case) and a `BufferId`, which was awkward and
verbose to construct, it simply takes text and a `cx`.

It uses the `cx` to derive a `BufferId` from the `EntityId` associated
with the `cx`, which should always be positive based on the following
analysis...

We convert the entity id to a u64 using this method on `EntityId`, which
is defined by macros in the `slotmap` crate:

```rust
    pub fn as_ffi(self) -> u64 {
        (u64::from(self.version.get()) << 32) | u64::from(self.idx)
    }
```

If you look at the type of `version` in `KeyData`, it is non-zero:

```rust
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct KeyData {
    idx: u32,
    version: NonZeroU32,
}
```

This commit also adds `Context::reserve_model` and
`Context::insert_model` to determine a model's entity ID before it is
created, which we need in order to assign a `BufferId` in the background
when loading a buffer asynchronously.

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-04-10 08:32:51 -06:00
Hans
664efef76b
Remove line breaks when displaying file names in the project panel (#10231)
- Fixed #8603 

For the label title of the project panel, I find that there is no place
to use to get the title of the label to do some operations, it should be
safe to modify it, but I'm not sure how we need to modify the problem, I
can think of two scenarios:
1. Modify every place where you don't want multiple lines to appear
2. Make the label only display a single line (e.g. provide a new
parameter, or a new label type?)
2024-04-10 08:30:13 -06:00
Bennet Bo Fenner
26299fb8c9
chat panel: Fix new messages indicator appearing when message was deleted (#10278)
Release Notes:

Fixed an issue where the "New messages" indicator in the channel chat
would be shown even if the message was deleted
2024-04-10 12:21:45 +02:00
Piotr Osiewicz
39e0e26d1d
Line numbers short mode (#10354)
Followup to #10327 
It can be enabled with the following setting:

"line_indicator_format": "short"

No release note, as the original change didn't go out to Preview yet.

/cc @bartekpacia @0x2CA

Release Notes:

- N/A
2024-04-10 12:08:07 +02:00
Kamal Ahmad
4151ba13a1
X11: Don't emit keypress events for modifiers (#10271)
This fixes certain shortcuts/motions on X11 like in vim mode "v i )",
where previously zed would interpret it as "v i SHIFT )" due to the x11
backend emitting key press events for modifier keys even though other
platforms like Wayland don't. This also adds support for
ModifiersChanged events to X11

Release Notes:

- Fixed vim motions like "v i )" not working on X11
([#10199](https://github.com/zed-industries/zed/issues/10199)).
2024-04-09 18:46:23 -07:00
CharlesChen0823
6ac343123d
Windows: Fix render resource not being released (#10233)
Release Notes:
- N/A
2024-04-09 18:46:09 -07:00
张小白
c763c8c64b
windows: Implement restart action (#10234)
Release Notes:

- N/A
2024-04-09 18:35:10 -07:00
Ezekiel Warren
bfd9bb8a7c
Use shared text system on Linux and Windows (#10098)
closes #10129
closes #10269

Release Notes:

- N/A
2024-04-09 17:25:16 -07:00
Dzmitry Malyshau
8f69eac402
Update blade to a version that can run GLES for Zed (#10243)
Release Notes:
- N/A

Picks up https://github.com/kvark/blade/pull/105,
https://github.com/kvark/blade/pull/97, and more

Switches the presentation to be non-blocking, which will improve the
latency slightly.

Allows to start playing with GLES backend, e.g.
```bash
cd crates/gpui
RUSTFLAGS="--cfg gles" CARGO_TARGET_DIR=./target-gl cargo run --example hello_world
```

It doesn't currently render properly due to an issue that needs
investigation, see
https://github.com/kvark/blade/pull/105#issuecomment-2041006542
But at least it's a start

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-04-09 17:16:35 -07:00
Mikayla Maki
3fc08a0610
Fix a bug from the Linux rewrite where Wayland windows would not render properly (#10343)
Release Notes:

- N/A
2024-04-09 17:16:09 -07:00
Piotr Osiewicz
fff197b227
Show lines selected & selection quantity in status bar (#10327)
Fixes #4204 

![image](https://github.com/zed-industries/zed/assets/24362066/dac093e7-d8ba-4bf9-8936-748a93dbcecf)

![image](https://github.com/zed-industries/zed/assets/24362066/f836948c-a4ad-455c-a343-8bb3ce62d467)

![image](https://github.com/zed-industries/zed/assets/24362066/54310b2a-db00-4b87-9f96-a55a81be99ed)

![image](https://github.com/zed-industries/zed/assets/24362066/dd6ef78c-2bde-4808-856b-adaa28dd00d2)

Release Notes:

- Line number indicator now shows number of lines selected and a number
of selections.
2024-04-09 23:40:19 +02:00
Max Brunsfeld
6b320b9efe
Fix cleanup of LSP request status messages (#10336)
This fixes a bug in https://github.com/zed-industries/zed/pull/9818,
where the status was not removed if the request failed. It also adds
replication of these new status messages to guests when collaborating.

Release Notes:

- Fixed an issue where the status of failed LSP actions was left in the
status bar

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-09 17:34:51 -04:00
Max Brunsfeld
a0ee29a806
Use first line comment prefix when toggling comments (#10335)
This fixed an issue introduced in
https://github.com/zed-industries/zed/pull/10126, where, when toggling
comments in a language with multiple line comment prefixes (e.g. Gleam,
Erlang) Zed would insert the *last* prefix instead of the first.

Release Notes:

- Fixed an issue where the `toggle comments` command inserted the wrong
line comment prefix in some languages (preview only).

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-09 17:22:47 -04:00
Kirill Bulatov
0331fdebd3
Parse human readable module name for Rust tasks (#10337)
Part of https://github.com/zed-industries/zed/issues/10132 extracted out
of a bigger PR that refactors tasks and shows labels that look more like
commands (ergo needs better readable package names)

Release Notes:

- N/A
2024-04-10 00:18:09 +03:00
Kirill Bulatov
7dfc7184b1
Use task icons for all kinds of tasks (#10333)
<img width="565" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/cbb59154-1153-459a-978c-8c125e879d27">
<img width="562" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/d3f65a09-2f75-4db8-85c2-1abb591e609c">


Release Notes:

- Added more icons to task modal
2024-04-09 23:51:59 +03:00
Conrad Irwin
759c65d4bd
Show errors when failing to create directories on startup (#10326)
Release Notes:

- Improved error reporting on startup
([#9036](https://github.com/zed-industries/zed/issues/9036)).
2024-04-09 13:26:16 -06:00
Thorsten Ball
0533923f91
Reduce memory usage to represent buffers by up to 50% (#10321)
This should help with some of the memory problems reported in
https://github.com/zed-industries/zed/issues/8436, especially the ones
related to large files (see:
https://github.com/zed-industries/zed/issues/8436#issuecomment2037442695),
by **reducing the memory required to represent a buffer in Zed by
~50%.**

### How?

Zed's memory consumption is dominated by the in-memory representation of
buffer contents.

On the lowest level, the buffer is represented as a
[Rope](https://en.wikipedia.org/wiki/Rope_(data_structure)) and that's
where the most memory is used. The layers above — buffer, syntax map,
fold map, display map, ... — basically use "no memory" compared to the
Rope.

Zed's `Rope` data structure is itself implemented as [a `SumTree` of
`Chunks`](8205c52d2b/crates/rope/src/rope.rs (L35-L38)).

An important constant at play here is `CHUNK_BASE`:

`CHUNK_BASE` is the maximum length of a single text `Chunk` in the
`SumTree` underlying the `Rope`. In other words: It determines into how
many pieces a given buffer is split up.

By changing `CHUNK_BASE` we can adjust the level of granularity
withwhich we index a given piece of text. Theoretical maximum is the
length of the text, theoretical minimum is 1. Sweet spot is somewhere
inbetween, where memory use and performance of write & read access are
optimal.

We started with `16` as the `CHUNK_BASE`, but that wasn't the result of
extensive benchmarks, more the first reasonable number that came to
mind.

### What

This changes `CHUNK_BASE` from `16` to `64`. That reduces the memory
usage, trading it in for slight reduction in performance in certain
benchmarks.

### Benchmarks

I added a benchmark suite for `Rope` to determine whether we'd regress
in performance as `CHUNK_BASE` goes up. I went from `16` to `32` and
then to `64`. While `32` increased performance and reduced memory usage,
`64` had one slight drop in performance, increases in other benchmarks
and substantial memory savings.

| `CHUNK_BASE` from `16` to `32` | `CHUNK_BASE` from `16` to `64` |
|-------------------|--------------------|
|
![chunk_base_16_to_32](https://github.com/zed-industries/zed/assets/1185253/fcf1f9c6-4f43-4e44-8ef5-29c1e5d8e2b9)
|
![chunk_base_16_to_64](https://github.com/zed-industries/zed/assets/1185253/d82a0478-eeef-43d0-9240-e0aa9df8d946)
|

### Real World Results

We tested this by loading a 138 MB `*.tex` file (parsed as plain text)
into Zed and measuring in `Instruments.app` the allocation.

#### standard allocator
Before, with `CHUNK_BASE: 16`, the memory usage was ~827MB after loading
the buffer.

| `CHUNK_BASE: 16` |
|---------------------|
|
![memory_consumption_chunk_base_16_std_alloc](https://github.com/zed-industries/zed/assets/1185253/c1e04c34-7d1a-49fa-bb3c-6ad10aec6e26)
|


After, with `CHUNK_BASE: 64`, the memory usage was ~396MB after loading
the buffer.

| `CHUNK_BASE: 64` |
|---------------------|
|
![memory_consumption_chunk_base_64_std_alloc](https://github.com/zed-industries/zed/assets/1185253/c728e134-1846-467f-b20f-114a582c7b5a)
|


#### `mimalloc`

`MiMalloc` by default and that seems to be pretty aggressive when it
comes to growing memory. Whereas the std allocator would go up to
~800mb, MiMalloc would jump straight to 1024MB.

I also can't get `MiMalloc` to work properly with `Instruments.app` (it
always shows 15MB of memory usage) so I had to use these `Activity
Monitor` screenshots:

| `CHUNK_BASE: 16` |
|---------------------|
|
![memory_consumption_chunk_base_16_mimalloc](https://github.com/zed-industries/zed/assets/1185253/1e6e05e9-80c2-4ec7-9b0e-8a6fa78836eb)
|

| `CHUNK_BASE: 64` |
|---------------------|
|
![memory_consumption_chunk_base_64_mimalloc](https://github.com/zed-industries/zed/assets/1185253/8a47e982-a675-4db0-b690-d60f1ff9acc8)
|

### Release Notes

Release Notes:

- Reduced memory usage for files by up to 50%.

---------

Co-authored-by: Antonio <antonio@zed.dev>
2024-04-09 18:07:53 +02:00
Marshall Bowers
132b8aa5c7
Improve extension API documentation (#10322)
This PR adds some more documentation to symbols exported from the
`zed_extension_api` crate.

Release Notes:

- N/A
2024-04-09 10:38:29 -04:00
Nathan Sobo
414058379b
Switch to the system UI font on macOS (#10317)
To reference the system font, use the special ".SystemUIFont" family
name.

/cc @PixelJanitor 

Release Notes:

- Switched to the system UI  font for user interface elements on macOS.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2024-04-09 07:44:57 -06:00
Marshall Bowers
8205c52d2b
Only apply host-side executable fix to binaries downloaded by the extension (#10318)
This PR makes it so our temporary host-side workaround for setting
certain language server binaries as executable only applies to binaries
that are downloaded by the extension.

Previously we would do this for any binary, including ones that could
have been sourced from the $PATH.

Release Notes:

- Fixed a file permissions issue when trying to use a Zig language
server (`zls`) present on the $PATH.
2024-04-09 09:13:36 -04:00
Piotr Osiewicz
4fb9f41e69
gpui/metal: Clamp max texture width/height to 16kB (#10314)
Fixed #10149
A user had Zed crash due to invalid font size in settings. It turned out
the width/height of glyphs does not pass validation in Metal texture
initialization with a large enough font size.

All modern Macs have a max texture width/height of 16kB (barring Apple
A8, used by iPhone 6 back in 2014, which uses 8kB). This commit clamps
texture size at 16kB. Note that while it fixes Zed crash, using a font
size that hits the limit is still pretty unusable - the users will still
have a pretty unusable editor, but at least it won't crash for them.



Release Notes:

- Fixed crashes with huge `buffer_font_size` values.
2024-04-09 14:09:09 +02:00
Andrew Lygin
935e0d547e
Improve Find/Replace shortcuts (#10297)
This PR changes ways the Find/Replace functionality in the
Buffer/Project Search is accessible via shortcuts. It makes those panels
work the same way as in VS Code and Sublime Text.

The details are described in the issue: [Make Find/Replace easier to
use](https://github.com/zed-industries/zed/issues/9142)

There's a difficulty with the Linux keybindings:

VS Code uses on MacOS (this PR replicates it):

| Action | Buffer Search | Project Search |
| --- | --- | --- |
| Find | `cmd-f` | `cmd-shift-f` |
| Replace | `cmd-alt-f` | `cmd-shift-h` |

VS Code uses on Linux (this PR replicates all but one):

| Action | Buffer Search | Project Search |
| --- | --- | --- |
| Find | `ctrl-f` | `ctrl-shift-f` |
| Replace | `ctrl-h`  | `ctrl-shift-h` |

The problem is that `ctrl-h` is already taken by the `editor::Backspace`
action in Zed on Linux.

There's two options here:

1. Change keybinding for `editor::Backspace` on Linux to something else,
and use `ctrl-h` for the "replace in buffer" action.
2. Use some other keybinding on Linux in Zed. This PR introduces
`ctrl-r` for this purpose, though I'm not sure it's the best choice.

What do you think?

fixes #9142

Release Notes:

- Improved access to "Find/Replace in Buffer" and "Find/Replace in
Files" via shortcuts (#9142).

Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.

- N/A
2024-04-08 22:07:59 -07:00
Max Brunsfeld
cc367d43d6
Sanitize ranges in code labels coming from extensions (#10307)
Without any sanitization, extensions would be able to crash zed, because
the editor code assumes these ranges are valid.

Release Notes:

- N/A
2024-04-08 19:53:25 -07:00
Marshall Bowers
843aad80c6
Flip the optionality of the auto_update setting (#10302)
This PR flips the optionality of the `AutoUpdateSettingContent` to make
it a bit easier to work with.

#### Before

```rs
struct AutoUpdateSettingContent(Option<bool>);

type FileContent = AutoUpdateSettingContent;
```

#### After

```rs
struct AutoUpdateSettingContent(bool);

type FileContent = Option<AutoUpdateSettingContent>;
```

Release Notes:

- N/A
2024-04-08 20:16:05 -04:00
Mikayla Maki
def87a8d76
WIP: Refactor Linux platform implementation (#10227)
This puts the Linux platform implementation at a similar code style and
quality to the macOS platform. The largest change is that I collapsed
the `LinuxPlatform` -> `[Backend]` -> `[Backend]State` ->
`[Backend]StateInner` to just `[Backend]` and `[Backend]State`, and in
the process removed most of the `Rc`s and `RefCell`s.

TODO:
- [x] Make sure that this is on-par with the existing implementation
- [x] Review in detail, now that the large changes are done.
- [ ] Update the roadmap

Release Notes:

- N/A
2024-04-08 16:40:35 -07:00
Marshall Bowers
ee1642a50f
Fix broken loading of auto_update setting (#10301)
This PR fixes a panic when attempting to load the `auto_update` setting.

This was leftover from #10296.

I'm going to see if there's a better way we can handle these cases so
they're more obviously correct.

Release Notes:

- N/A
2024-04-08 19:30:47 -04:00
Marshall Bowers
7c5bc3c26f
Add the ability for extensions to provide language settings (#10296)
This PR adds the ability for extensions to provide certain language
settings via the language `config.toml`.

These settings are then merged in with the rest of the settings when the
language is loaded from the extension.

The language settings that are available are:

- `tab_size`
- `hard_tabs`
- `soft_wrap`

Additionally, for bundled languages we moved these settings out of the
`settings/default.json` and into their respective `config.toml`s .

For languages currently provided by extensions, we are leaving the
values in the `settings/default.json` temporarily until all released
versions of Zed are able to load these settings from the extension.

---

Along the way we ended up refactoring the `Settings::load` method
slightly, introducing a new `SettingsSources` struct to better convey
where the settings are being loaded from.

This makes it easier to load settings from specific locations/sets of
locations in an explicit way.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-04-08 19:17:12 -04:00
Kirill Bulatov
4a3032c5e5
Append -- --nocapture to Rust function-level tests (#10299)
Release Notes:

- N/A
2024-04-09 01:36:24 +03:00
Conrad Irwin
f327118e06
vim: Allow search with operators & visual mode (#10226)
Fixes: #4346

Release Notes:

- vim: Add search motions (`/,?,n,N,*,#`) in visual modes and as targets
for operators like `d`,`c`,`y`
([#4346](https://github.com/zed-industries/zed/issues/4346)).
2024-04-08 15:20:14 -06:00
joaquin30
f9bf60f017
vim: Fix cgn backwards movement when there is no matches (#10237)
Release Notes:

- Fixed `cgn` backwards movement problem in #9982

There are two issues:

- When there are no more matches, the next repetition still moves the
cursor to the left. After that, the recording is cleared. For this I
simply move the cursor to the right, but it doesn't work when the cursor
is at the end of the line.
- If `cgn` is used when there are no matches, it cleans the previous
recorded actions. Maybe there should be a way to revert the recording.
This also happens when using `c` and `esc`

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-08 14:51:36 -06:00
Hans
0390df27d4
Fix block cursor does not render italic for vim (#10249)
Release Notes:

- Fixed #8799
2024-04-08 14:50:50 -06:00
Mikayla Maki
cf5a113751
Don't panic when multiple Zed instances are open (#10295)
This stops an annoying panic that can occur when developing Zed 

Release Notes:

- N/A
2024-04-08 12:26:38 -07:00
Bennet Bo Fenner
7dccbd8e3b
markdown preview: Improve live preview (#10205)
This PR contains various improvements for the markdown preview (some of
which were originally part of #7601).
Some improvements can be seen in the video (see also release notes down
below):


https://github.com/zed-industries/zed/assets/53836821/93324ee8-d366-464a-9728-981eddbfdaf7

Release Notes:
- Added action to open markdown preview in the same pane
- Added support for displaying channel notes in markdown preview
- Added support for displaying the current active editor when opening
markdown preview
- Added support for scrolling the editor to the corresponding block when
double clicking an element in markdown preview
- Improved pane creation handling when opening markdown preview
- Fixed markdown preview displaying non-markdown files
2024-04-08 21:17:40 +02:00
Marshall Bowers
d009d84ead
Add support for using a language server with multiple languages (#10293)
This PR updates the `extension.toml` to allow specifying multiple
languages for a language server to work with.

The `languages` field takes precedence over `language`. In the future
the `language` field will be removed.

As part of this, the Emmet extension has been extended with support for
PHP and ERB.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-04-08 14:24:56 -04:00
Hans
5e44748677
Adjust string splitting function (#10221)
- Fixed #9729 and #10193

This commit fixes an issue where the string splitting function was
handling characters in the input string improperly. We adjusted the use
of the `take_while` function to calculate the length of the numeric
prefix, rather than directly splitting the string, thus correctly
splitting the string into a numeric prefix part and the remaining part
2024-04-08 11:05:03 -07:00
Mikayla Maki
d2bf80ca3d
Make search context larger (#10289)
This increases search context from 1 above, 2 below, to 2 above and 2
below, matching the Sublime Text search results.

Release Notes:

- Increased search result context from 3 lines to 4 lines
2024-04-08 10:57:36 -07:00
Hans
44aed4a0cb
Add surrounds support for vim (#9400)
For #4965

There are still some minor issues: 
1. When change the surround and delete the surround, we should also
decide whether there are spaces inside after deleting/replacing
according to whether it is open parentheses, and replace them
accordingly, but at present, delete and change, haven't done this
adaptation for current pr, I'm not sure if I can fit it in the back or
if it needs to be fitted together.
2. In the selection mode, pressing s plus brackets should also trigger
the Add Surrounds function, but this MR has not adapted the selection
mode for the time being, I think we need to support different add
behaviors for the three selection modes.(Currently in select mode, s is
used for Substitute)
3. For the current change surrounds, if the user does not find the
bracket that needs to be matched after entering cs, but it is a valid
bracket, and will wait for the second input before failing, the better
practice here should be to return to normal mode if the first bracket is
not found
4. I reused BracketPair in language, but two of its properties weren't
used in this mr, so I'm not sure if I should create a new struct with
only start and end, which would have less code

I'm not sure which ones need to be changed in the first issue, and which
ones can be revised in the future, and it seems that they can be solved

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-08 11:41:06 -06:00
Conrad Irwin
e826ef83e2
Fix panic in visual line mode with folds (#10284)
Fixes: #10266



Release Notes:

- Added/Fixed/Improved ...
([#<public_issue_number_if_exists>](https://github.com/zed-industries/zed/issues/<public_issue_number_if_exists>)).

Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.

**or**

- N/A
2024-04-08 11:39:06 -06:00
Marshall Bowers
56c0345cf3
Respect language server's capabilities when calling GetReferences (#10285)
This PR makes Zed respect the language server's capabilities when
calling the `GetReferences` command (used in "Find All References",
etc.).

This fixes a crash that could occur when using Zed with Gleam v1.0.

Release Notes:

- Made "Find All References" respect the language server's capabilities.
This fixes some instances where certain language servers would stop
working after receiving a "Find All References" request.

---------

Co-authored-by: Max <max@zed.dev>
2024-04-08 13:38:32 -04:00
Andrew Lygin
f1428fea4e
Make scrollbar a bit wider (#10248)
At the moment, the editor scrollbar is 12px wide. One pixel is allocated
for the left border, so we have 11 pixels to display markers. It's not
enough to make three even marker columns (git, highlights, diagnostics)
that fully fill the scrollbar, so the current implementation allocates 3
pixels to each column.

As the result, we have 2 spare pixels on the right (before #10080 they
were occupied by the diagnostics column). Making the scrollbar just one
pixel wider allows us to give one additional pixel to each marker column
and make markers more pronounced ("as is" on the left, "to be" on the
right):

<img width="115" alt="zed-scrollbar-markers-1px"
src="https://github.com/zed-industries/zed/assets/2101250/4bdf0107-c0f1-4c9c-9063-d2ff461e1c32">

Other options:
- Remove scrollbar thumb border. That'll give us one missing pixel to
make markers wide and even. I, personally, prefer this option, but
themes now have `scrollbar.thumb.border` colors that differ from
`scrollbar.thumb.background` for some reason. This theme setting becomes
deprecated in this case. For the reference: VS Code doesn't have
scrollbar slider borders, IntelliJ IDEA does have them.
- Don't try to make markers evenly wide. For instance, IntelliJ uses
very narrow git-diff markers that are separated from other markers. But
it requires much wider scrollbar (it's 20px in IDEA).
- Use the spare two pixels to make diagnostic markers wider (it's the
pre #10080 approach), or split them between the highlight and diagnostic
markers (have 3px+4px+4px marker columns).
- Do nothing. It leaves us with two unused pixels :(

Release Notes:

- N/A

Related Issues:

- The previous discussion:
https://github.com/zed-industries/zed/pull/9080#issuecomment-1997979968
2024-04-08 10:32:09 -07:00
Conrad Irwin
9b88259b1f
Fix panic in drag entered (#10277)
Co-Authored-By: Kirill <kirill@zed.dev>

Release Notes:

- Fixed panic when dragging into Zed.

Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.

**or**

- N/A

Co-authored-by: Kirill <kirill@zed.dev>
2024-04-08 11:18:10 -06:00
Thorsten Ball
4d68bf2fa6
Fix panic when deleting just-generated text (#10282)
We ran into a panic when deleting text that was just generated by a code
action.

This fixes it by ensuring we don't run into a 0-minus-1 panic when a
buffer_range is empty.

Release Notes:

- Fixed panic that could occur when deleting generated-by-unsaved text.

Co-authored-by: Conrad <conrad@zed.dev>
2024-04-08 17:59:25 +02:00
Thorsten Ball
87c282d8f1
Send along diagnostics when requesting code actions (#10281)
This fixes #10177 by sending along the correct diagnostics when querying
the language server for diagnostics for a given cursor location.

Turns out that `gopls` takes the `range`, `source`, `message` of the
diagnostics sent along to check whether it has any code actions for the
given location.

Release Notes:

- Fixed "quickfix" code actions that were based on diagnostics not
showing up in Go files.
([#10177](https://github.com/zed-industries/zed/issues/10177)).

Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2024-04-08 17:54:06 +02:00
Marshall Bowers
134decb75e
Add compatibility table between Zed and zed_extension_api versions (#10279)
This PR updates the README of the `zed_extension_api` crate to show the
compatibility between different versions of `zed_extension_api` and Zed.

Release Notes:

- N/A
2024-04-08 11:15:35 -04:00
Piotr Osiewicz
f0d4d71e97
pane: Always notify status bar items on Pane::Focused events (#10275)
Due to peculiarities in handling of terminal panes (namely the fact that
they are not actually tracked by the Workspace::active_pane member), it
was possible to get into a state where status bar items "lost track" of
an active pane item; one way to reproduce it was to open a new terminal
via "workspace: new terminal" with a pane open in a central view; once a
new terminal is opened, the language selector and line number indicator
lose track of an active item. Focusing central view does nothing - it
will only go away after switching a tab in the central view.

To remedy this, we now always notify the status bar items of a pane
focus change, even if Workspace::active_pane points to the same pane.

Release Notes:

- Fixed status bar focus issues when spawning a terminal via `workspace:
new terminal` action.
2024-04-08 17:03:25 +02:00
Mike Sun
bcdae9fefa
Add settings to hide/show navigation history buttons (#10240)
This is another variant for this [original
PR](https://github.com/zed-industries/zed/pull/10091) to add settings to
show/hide navigation history buttons that puts the settings under a new
section called `tab_bar`:

```
  "tab_bar": {
    // Whether or not to show the navigation history buttons.
    "show_nav_history_buttons": true
  }
```

<img width="314" alt="Screenshot 2024-04-02 at 3 00 53 PM"
src="https://github.com/zed-industries/zed/assets/1253505/23c4fa19-5a63-4160-b3b7-1b5e976c36bf">
<img width="329" alt="Screenshot 2024-04-02 at 3 01 03 PM"
src="https://github.com/zed-industries/zed/assets/1253505/64c2ebd2-9311-4589-a4e8-bd149c6c4ece">
2024-04-08 10:46:36 -04:00
Max Brunsfeld
4bdfc12b79
Remove duplicated code for unchanged parts of different extension API versions (#10218)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-08 10:16:12 -04:00
Piotr Osiewicz
4ce5b22989
tasks: Add status indicator to the status bar (#10267)
Release Notes:

- Added task status indicator to the status bar.
2024-04-08 14:43:00 +02:00
Ben Hamment
ce5bc399df
Improve Ruby Syntax (#10255)
Release Notes:

fixes #9995  being able to target constants
<img width="336" alt="image"
src="https://github.com/zed-industries/zed/assets/7274458/9e8cc438-10c4-441f-9140-3f4b418bd3bd">

Adds highlighting for parameters In blocks
<img width="318" alt="image"
src="https://github.com/zed-industries/zed/assets/7274458/4fa45fbe-104b-4778-994b-3b6d6ba930d4">
2024-04-08 13:12:24 +02:00
Piotr Osiewicz
4f9ad300a7
tasks: Use icons instead of secondary text in a modal (#10264)
Before:

![image](https://github.com/zed-industries/zed/assets/24362066/feae9c98-37d4-437d-965a-047d2e089a7b)
After:

![image](https://github.com/zed-industries/zed/assets/24362066/43e48985-5aba-44d9-9128-cfafb9b61fd4)

Release Notes:

- N/A
2024-04-08 11:41:54 +02:00
Daniel Zhu
4944dc9d78
Show status of LSP actions (#9818)
Fixes #4380

Parts im still unsure about:
- [x] where exactly I should call `on_lsp_start`/`on_lsp_end`
- [x] how to handle things better than `let is_references =
TypeId::of::<R>() == TypeId::of::<GetReferences>();`, which feels very
janky
- [x] I want to have the message be something like `"Finding references
to [...]"` instead of just `textDocument/references`, but I'm not sure
how to retrieve the name of the symbol that's being queried
- [ ] I think the bulk of the runtime is occupied by `let result =
language_server.request::<R::LspRequest>(lsp_params).await;`, but since
`ModelContext` isn't passed into it, I'm not sure how to update progress
from within that function
- [x] A good way to disambiguate between multiple calls to the same lsp
function; im currently using the function name itself as the unique
identifier for that request, which could create issues if multiple
`textDocument/references` requests are sent in parallel

Any help with these would be deeply appreciated!

Release Notes:

- Adds a status indicator for LSP actions

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-04-06 19:48:11 -07:00
Kyle Kelley
c7961b9054
Implement ObjectFit::ScaleDown for images (#10063)
While working towards fixes for the image viewer, @mikayla-maki and I
discovered that we didn't have `object-fit: scale-down` implemented.
This doesn't _fully_ solve the image issues as there is some issue where
only the bounds width is updating on layout change that I haven't fully
chased down.

Co-Authored-By: @mikayla-maki 

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-04-06 15:20:30 -07:00
Conrad Irwin
0325bda89a
Improve lsp notifications (#10220)
1. They now will not go off-screen
2. You can scroll long messages.
3. Only one notification per language server is shown at a time
4. The title/text are now distinguished visually
5. You can copy the error message to the clipboard

Fixes: #10217
Fixes: #10190
Fixes: #10090

Release Notes:

- Fixed language server notifications being too large
([#10090](https://github.com/zed-industries/zed/issues/10090)).
2024-04-06 10:17:18 -06:00
Mikayla Maki
518cfdbd56
Adjust env parsing to account for multiline env values (#10216)
fixes https://github.com/zed-industries/zed/issues/6012

Release Notes:

- N/A
2024-04-05 19:24:46 -07:00
joaquin30
bf9b443b4a
vim: Support gn command and remap gn to gl (#9982)
Release Notes:

- Resolves #4273

@algora-pbc /claim #4273

This is a work-in-progress. The process for `gn` command is:

- maintain updated vim.workspace_state.search.initial_query
- modify editor.select_next_state with
vim.workspace_state.search.initial_query
- use editor.select_next()
- merge selections
- set editor.select_next_state to previous state

To make this possible, several private members and editor structures are
made public. `gN` is not yet implemented and the cursor still does not
jump to the next selection in the first use.

Maybe there is an better way to do this?

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-05 20:23:37 -06:00
Mikayla Maki
fe4b345603
Fix interpretation of \n in hovers (#10214)
I ran into this specifically when looking at the documentation of
https://crates.io/crates/wayland-client

Release Notes:

- Fixed a bug where some hover popovers would render `\n` instead of a
new line.
2024-04-05 15:59:37 -07:00
Kirill Bulatov
7b636d9774
Limit the extension tasks in the modal to current language only (#10207)
Release Notes:

- N/A
2024-04-06 00:18:32 +03:00
Marshall Bowers
c851e6edba
Add language_server_workspace_configuration to extension API (#10212)
This PR adds the ability for extensions to implement
`language_server_workspace_configuration` to provide workspace
configuration to the language server.

We've used the Dart extension as a motivating example for this, pulling
it out into an extension in the process.

Release Notes:

- Removed built-in support for Dart, in favor of making it available as
an extension. The Dart extension will be suggested for download when you
open a `.dart` file.

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-04-05 17:04:07 -04:00
Marshall Bowers
4aaf3459c4
Improve extension API documentation (#10210)
This PR adds more documentation for various constructs in the
`zed_extension_api` crate.

`wit_bindgen` is able to generate doc comments on the Rust constructs
using the the doc comments in the WIT files, so we're able to leverage
that for the majority of the constructs that we expose.

Release Notes:

- N/A
2024-04-05 13:00:24 -04:00
Thorsten Ball
b05aa381aa
Handle old versions of /usr/bin/env when loading shell env (#10202)
This fixes #9786 by using an invocation of `/usr/bin/env` that's
supported by macOS 12.

As it turns out, on macOS 12 (and maybe 13?) `/usr/bin/env` doesn't
support the `-0` flag. In our case it would silently fail, since we
`exit 0` in our shell invocation and because the program we run and
whose exit code we check is the `$SHELL` and not `/usr/bin/env`.

What this change does is to drop the `-0` and instead split the
environment on `\n`. This works even if an environment variable contains
a newline character because that would then be escaped.

Release Notes:

- Fixed Zed not picking up shell environments correctly when running on
macOS 12. ([#9786](https://github.com/zed-industries/zed/issues/9786)).

Co-authored-by: Dave Smith <davesmithsemail@gmail.com>
2024-04-05 15:46:56 +02:00
Hans
ec6efe262f
Fix crash when joining two consecutive lines (#10000)
Release notes:

- Fixed a crash when joining two consecutive lines
([#9692](https://github.com/zed-industries/zed/pull/9692)).


This crash is not caused by `vim` or `editor`'s code logic, `join_line`
logic is okay, I found that the crash is caused by a refresh of git
`diff` after every update, hhen git diff generates hunks, it will look
for the cursor to the beginning of a line, and judge that if the cursor
result column is greater than 0, that is, it is not the beginning of a
line, it will correct the row to the next line, I think before we forgot
here that I need to adjust the column to 0 at the same time, otherwise
it is easy to go out of bounds, I am not sure if I need to add more
tests for this method, I can add if I need to, but I feel that this case
is a bit extreme

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-04-05 15:45:29 +02:00
Andrew Lygin
3ae6463869
Fix scrollbar markers in large files (#10181)
#10080 introduced a minor change in how the min marker height is
enforced. Before the change, it was applied to the aggregated marker,
but after the change it's applied to each individual marker before
aggregation.

The difference is not noticeable on small files, where even single row
markers are higher than `MIN_MARKER_HEIGHT`, but it leads to visible
differences in large files with repeating blocks of highlighted and
not-highlighted blocks, like in [this
case](https://github.com/zed-industries/zed/pull/9080#issuecomment-2006796376).

This PR fixes how the `MIN_MARKER_HEIGHT` is applied.

Before the fix:

<img width="727" alt="zed-scroll-markers-before"
src="https://github.com/zed-industries/zed/assets/2101250/a1c34746-af4f-4054-8de2-edabf3db7cee">

After the fix:

<img width="736" alt="zed-scroll-markers-after"
src="https://github.com/zed-industries/zed/assets/2101250/b9ee843d-055e-42a6-af26-e7fd4f7729f8">


Release Notes:

- N/A

/cc @mrnugget
2024-04-05 10:17:39 +02:00
Drazen
cedbfac844
Fix typo (#10183)
Release Notes:

- N/A
2024-04-05 01:07:19 +02:00
Conrad Irwin
73d8a43c81
vim: Allow : in empty panes and screen shares (#10171)
Release Notes:

- vim: Fixed `:` when no files are open
2024-04-04 14:24:49 -06:00
Marshall Bowers
4a325614f0
Add label_for_symbol to extension API (#10179)
This PR adds `label_for_symbol` to the extension API.

As a motivating example, we implemented `label_for_symbol` for the
Haskell extension.

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
2024-04-04 15:38:38 -04:00
Bennet Bo Fenner
5d88d9c0d7
markdown preview: Add link tooltips (#10161)
Adds tooltips to the markdown preview, similar to how its done for
`RichText`


https://github.com/zed-industries/zed/assets/53836821/523519d4-e392-46ef-9fe0-6692871b317d

Release Notes:

- Added tooltips when hovering over links inside the markdown preview
2024-04-04 21:06:30 +02:00
Bennet Bo Fenner
dde87f6468
markdown preview: Auto detect raw links (#10162)
Similar to the work done in `rich_text`, raw links now get picked up in
the markdown preview.


https://github.com/zed-industries/zed/assets/53836821/3c5173fd-cf8b-4819-ad7f-3127c158acaa

Release Notes:

- Added support for detecting and highlighting links in markdown preview
2024-04-04 21:05:35 +02:00
Marshall Bowers
d306b531c7
Add label_for_completion to extension API (#10175)
This PR adds the ability for extensions to implement
`label_for_completion` to customize completions coming back from the
language server.

We've used the Gleam extension as a motivating example, adding
`label_for_completion` support to it.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-04-04 13:56:04 -04:00
Kirill Bulatov
0f1c2e6f2b
Return back the ability to save non-dirty singleton buffers (#10174) 2024-04-04 18:06:47 +02:00
Jason Lee
0861ceaac2
Add yield keyword highlight for Rust (#10104)
Release Notes:

- Added `yield` keyword highlight for Rust


Ref:

- https://github.com/rust-lang/rust-analyzer/pull/7209
-
https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/syntax_highlighting/highlight.rs#L177
-
https://doc.rust-lang.org/reference/keywords.html?highlight=yield#reserved-keywords


In VS Code:
 

![SCR-20240403-hrb](https://github.com/zed-industries/zed/assets/5518/ec3e84ce-ea9d-4b2d-832d-ecdfec0def91)

docs.rs:
https://docs.rs/async-stream/latest/async_stream/macro.try_stream.html


![SCR-20240403-gpk](https://github.com/zed-industries/zed/assets/5518/07010c2c-341d-4ae2-ba80-5f4eab4dbf60)

## Before

<img width="644" alt="image"
src="https://github.com/zed-industries/zed/assets/5518/da349187-57e6-4cea-b3e3-f628ce6a99e8">


## After update in Zed

![SCR-20240403-hqk](https://github.com/zed-industries/zed/assets/5518/44f1687b-ec38-42c2-984d-15177bed7e5b)
2024-04-04 17:56:33 +02:00
Piotr Osiewicz
1c485a0d05
tasks: change placeholder text in a modal (#10166)
Related to: #10132

Release Notes:

- N/A
2024-04-04 15:37:53 +02:00
Bennet Bo Fenner
27165e9927
channel chat: Set first loaded message ID when sending a message (#10034)
Discovered while looking into #10024.

When clicking on a reply message text, the original message should be
highlighted accordingly. However this would not work when the channel
was just created and the user is the only one that sent messages.
 
Release Notes:

- Fixed highlighting of messages when clicking on the reply message text
in the chat and there were no other messages from other users
2024-04-04 15:12:35 +02:00
Kirill Bulatov
1085642c88
Stricten Zed Task variable API (#10163)
Introduce `VariableName` enum to simplify Zed task templating
management: now all the variables can be looked up statically and can be
checked/modified in a centralized way: e.g. `ZED_` prefix is now added
for all such custom vars.

Release Notes:

- N/A
2024-04-04 16:02:24 +03:00
Bennet Bo Fenner
5b4ff74dca
collab ui: Dismiss project shared notifications when leaving room (#10160)
When leaving a call/room in which a project was shared, the shared
project notification was not getting dismissed when the person that
shared the project left the room.
Although there was a `cx.emit(Event::Left)` call inside room, the event
was never received in the `project_shared_notification` module, because
the room is dropped before the event can be dispatched. Moving the
`cx.emit(Event::Left)` to the active call fixed the problem. Also
renamed `Event::Left` to `Event::RoomLeft` because the room join
equivalent is also called `Event::RoomJoined`.


Release Notes:

- Fixed project shared notification staying open, when the user that
shared the project left the room
2024-04-04 13:43:14 +02:00
Thorsten Ball
8e9543aefe
Improve handling of prettier errors on format (#10156)
When no formatter for a language is specified, Zed has the default
behaviour:

1. Attempt to format the buffer with `prettier`
2. If that doesn't work, use the language server.

The problem was that if `prettier` failed to format a buffer due to
legitimate syntax errors, we simply did a fallback to the language
server, which would then format over the syntax errors.

With JavaScript/React/TypeScript projects this could lead to a situation
where

1. Syntax error was introduced
2. Prettier fails
3. Zed ignores the error
4. typescript-language-server formats the buffer despite syntax errors

This would lead to some very weird formatting issues.

What this PR does is to fix the issue by handling `prettier` errors and
results in two user facing changes:

1. When no formatter is set (or set to `auto`) and if we attempted to
start a prettier instance to format, we will now display that error and
*not* fall back to language server formatting.
2. If the formatter is explicitly set to `prettier`, we will now show
errors if we failed to spawn prettier or failed to format with it.

This means that we now might show *more* errors than previously, but I
think that's better than not showing anything to the user at all.

And, of course, it also fixes the issue of invalid syntax being
formatted by the language server even though `prettier` failed with an
error.

Release Notes:

- Improved error handling when formatting buffers with `prettier`.
Previously `prettier` errors would be logged but ignored. Now `prettier`
errors are shown in the UI, just like language server errors when
formatting. And if no formatter is specified (or set to `"auto"`) and
Zed attempts to use `prettier` for formatting, then `prettier` errors
are no longer skipped. That fixes the issue of `prettier` not formatting
invalid syntax, but its error being skipped, leading to
`typescript-language-server` or another language server formatting
invalid syntax.
2024-04-04 11:41:55 +02:00
Remco Smits
c0d117182f
Fix clear reply to message and edit message state when you switch state (#10044)
This pull request fixes the following issue #10042.

Release Notes:
- Fixed clear chat state when switching edit/reply message state.
([#10042](https://github.com/zed-industries/zed/issues/10042)).
2024-04-04 08:36:27 +02:00
Hans
9cbde74274
Refactor selection expansion logic into a separate method (#10117)
Release Notes:

- N/A

This commit introduces a new method `range` to calculate the target
range for selection expansion based on the current selection, movement
times, and other parameters. The `expand_selection` method is refactored
to use this new `range` method, simplifying the logic for expanding a
selection and making the code more modular and reusable. The `range`
method encapsulates the logic for calculating the new selection range,
including handling linewise selection and adjustments for surrounding
newlines, making it easier to understand and maintain the selection
expansion functionality.

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-04-04 08:35:26 +02:00
Piotr Osiewicz
879f361966
tasks: fix panic in render_match (#10137)
Release Notes:

- Fixed panic in tasks modal (Preview only).
2024-04-03 22:09:36 +02:00
Conrad Irwin
ccb2d02ce0
Remove datadog (#10133)
Release Notes:

- N/A
2024-04-03 11:35:23 -06:00
Conrad Irwin
fc08ea9b0d
Fix undo in replace mode (#10086)
Fixes: #10031

Co-Authored-By: Petros <petros@amignosis.com>

Release Notes:

- vim: Fix undo grouping in Replace mode
([#10031](https://github.com/zed-industries/zed/issues/10031)).

---------

Co-authored-by: Petros <petros@amignosis.com>
2024-04-03 11:35:04 -06:00
Marshall Bowers
49c53bc0ec
Extract HTML support into an extension (#10130)
This PR extracts HTML support into an extension and removes the built-in
HTML support from Zed.

Release Notes:

- Removed built-in support for HTML, in favor of making it available as
an extension. The HTML extension will be suggested for download when you
open a `.html`, `.htm`, or `.shtml` file.
2024-04-03 12:42:36 -04:00
Max Brunsfeld
256b446bdf
Refactor LSP adapter methods to compute labels in batches (#10097)
Once we enable extensions to customize the labels of completions and
symbols, this new structure will allow this to be done with a single
WASM call, instead of one WASM call per completion / symbol.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
2024-04-03 09:22:56 -07:00
Joseph T. Lyons
ef3d04efe6 v0.131.x dev 2024-04-03 12:11:28 -04:00
Marshall Bowers
469be39a32
file_icons: Add license file (#10128)
This PR adds a missing license file to the `file_icons` crate.

Release Notes:

- N/A
2024-04-03 12:07:53 -04:00
Piotr Osiewicz
b118b76272
editor: Fix "Toggle comments" not respecting multiple line_comments in language config (#10126)
This does not try to heuristically pick a comment style based on
surroundings anyhow. It does improve our story around uncommenting
though.

Fixes #10113.

Release Notes:

- Fixed "Toggle comment" action not working in presence of non-default
line comments such as doc comments in Rust
([#10113](https://github.com/zed-industries/zed/issues/10113)).
2024-04-03 17:34:59 +02:00
Andrew Lygin
57a1b9b2cd
tab_switcher: Add tab close buttons (#9968)
Support for closing tabs from Tab Switcher:

- Close button color matches the indicator color to preserve the
information that the buffer is dirty (as in SublimeText).
- `ctrl-backspace` closes the currently selected item.


https://github.com/zed-industries/zed/assets/2101250/8ea33911-2f62-4199-826d-c17556db8e9a

Release Notes:

- N/A
2024-04-03 17:28:51 +02:00
Jason Lee
8eeecdafec
Add crate keyword to Rust (#10110)
Release Notes:

- Fixed `crate` keyword not being highlighted in Rust files.

Ref: #10104 

And I make a sort for them.
2024-04-03 17:27:22 +02:00
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
Marshall Bowers
654504d5ee
Remove basic.conf (#10120)
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
2024-04-03 09:38:36 -04:00
Kirill Bulatov
027897e003
Do not spawn oneshot tasks from blank prompts (#10115) 2024-04-03 13:54:16 +02:00
Thorsten Ball
c4ceeb715a
Fix git blame not working correctly with submodules (#10114)
This fixes #9958 by using the correct working directory in which to run
`git blame`.

This wasn't an issue for a single repository, because we could go from
`.git` one directory up, but it doesn't work for submodules.

Luckily there's a `workdir()` method on `self.repository` that does
exactly what we need.

In submodule:

![screenshot-2024-04-03-12 37
18@2x](https://github.com/zed-industries/zed/assets/1185253/67e89abb-d04c-4e9d-802f-5b8468e0962e)

Not in submodule:

![screenshot-2024-04-03-12 37
36@2x](https://github.com/zed-industries/zed/assets/1185253/cfe59f59-798b-43e1-980d-2225db4c0302)

Release Notes:

- N/A
2024-04-03 13:49:12 +02:00
Kirill Bulatov
58aec1de75
Do not push invisible local worktrees into recent documents (#10112)
Follow-up of https://github.com/zed-industries/zed/pull/9919 that
removes invisible worktrees from the list, to avoid things like

![image](https://github.com/zed-industries/zed/assets/2690773/90ce1c29-a1dd-4a03-b09a-effdba620c8f)

Release Notes:

- N/A
2024-04-03 13:47:01 +03:00
Kirill Bulatov
9aad30a559
Query code actions and hovers from all related local language servers (from remote clients) (#10111)
Supersedes https://github.com/zed-industries/zed/pull/8634
Fixes https://github.com/zed-industries/zed/issues/7947 by continuing
https://github.com/zed-industries/zed/pull/9943 with the remote part.

Now, clients are able to issue collab requests, that query all related
language servers, not only the primary one.
Such mode is enabled for GetHover and GetCodeActions LSP requests only.

Release Notes:

- Added Tailwind CSS hover popovers for Zed in multi player mode
([7947](https://github.com/zed-industries/zed/issues/7947))
2024-04-03 13:34:56 +03:00
Thorsten Ball
3a0d3cee87
Compute scrollbar markers asynchronously (#10080)
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>
2024-04-03 12:21:17 +02:00
Thorsten Ball
7dbcace839
Fix accidentally dropping shell environment variable (#10105)
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`.
2024-04-03 09:34:17 +02:00
William Villeneuve
463c16a402
Allow users to configure ESLint's problems settings (#9981)
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
2024-04-03 09:29:07 +02:00
Conrad Irwin
5a2a85a7db
Fix vim code working on display map chars (#10103)
Release Notes:

- vim: Fixed motion bugs when softwrap, folds or inlay hints were used.
2024-04-02 22:16:52 -06:00
Remco Smits
754547f349
Fix mention notifications are not updated after message change and not removed after a message is deleted (#9847)
@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>
2024-04-02 20:40:00 -06:00
Conrad Irwin
fe7b12c444
fix rejoin after quit (#10100)
Release Notes:

- collab: Fixed rejoining channels quickly after a restart
2024-04-02 20:35:14 -06:00
Max Brunsfeld
7d5048e909
Revert PR #6924 - go to reference when there's only one (#10094)
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>
2024-04-02 14:31:58 -07:00
Conrad Irwin
65cde17063
Fix collab logging (#10095)
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
2024-04-02 15:31:30 -06:00
Conrad Irwin
9317fe46af Revert "Revert "Revert dependency updates in #9836 (#10089)""
This reverts commit c8b14ee2cb.
2024-04-02 13:12:38 -06:00
Conrad Irwin
c8b14ee2cb Revert "Revert dependency updates in #9836 (#10089)"
This reverts commit 55c897d993.
2024-04-02 12:59:10 -06:00
Mikayla Maki
55c897d993
Revert dependency updates in #9836 (#10089)
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
2024-04-02 12:27:48 -06:00
Marshall Bowers
6121bfc5a4
Extract Clojure support into an extension (#10088)
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>
2024-04-02 13:47:03 -04:00
Max Brunsfeld
46544d7354
Revert PR #8327 - Fix autocomplete completions being cut in half (#10084)
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
2024-04-02 09:24:55 -07:00
Piotr Osiewicz
8df888e5b1
task: Add "remove" button next to oneshot tasks (#10083)
Release Notes:

- Added a "remove" button next to oneshot tasks in tasks modal.
2024-04-02 17:59:22 +02:00
Marshall Bowers
a1cb6772bf
Make conversions to wasmtime::Result postfix-friendly (#10082)
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
2024-04-02 11:38:15 -04:00
moshyfawn
c62239e9f0
Include commit hash in Nightly & Dev builds (#10054)
Release Notes:

- N/A

<img width="1338" alt="image"
src="https://github.com/zed-industries/zed/assets/16290753/c8442dbe-d293-46ef-abb1-ed8a6d9bf37d">

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-02 11:19:19 -04:00
René
15ef3f3017
Add Tailwind autocomplete for Vue (#10078)
This fixes #4403 by adding TailwindLsp to .vue files too and
autocomplete aswell


![image](https://github.com/zed-industries/zed/assets/49145060/8b06a478-cade-4cbc-9da7-f31f5197f304)

Release Notes:

- Added Tailwind support in `.vue` files
([#4403](https://github.com/zed-industries/zed/issues/4403)).
2024-04-02 10:34:41 -04:00
Thorsten Ball
ad03a7e72c
Remove tooltips on scroll wheel events (#10069)
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
2024-04-02 14:10:51 +02:00
Thorsten Ball
84cca62b2e
Fix alignment in git blame gutter (#10067)
Fixes #9977.

Instead of doing nasty string alignment, this now uses the layout
engine.

![screenshot-2024-04-02-10 13
20@2x](https://github.com/zed-industries/zed/assets/1185253/ef167f9d-50de-4cc9-8a93-659a676c7855)


Release Notes:

- N/A
2024-04-02 13:36:28 +02:00
Piotr Osiewicz
b43602f21b
editor: indent from cursor position with a single selection (#10073)
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.
2024-04-02 13:33:11 +02:00
Bennet Bo Fenner
1dbd520cc9
project search: Persist search history across session (#9932)
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
2024-04-02 11:13:18 +02:00
Kirill Bulatov
c15b9d4e1c
Avoid failing format test with current date (#10068)
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
2024-04-02 10:37:14 +02:00
Mikayla Maki
1da2441e7b
Fix assorted linux issues (#10061)
- Fix a bug where modifiers would be dispatched before they changed
- Add a secondary modifier
- Improve keybindings

Release Notes:

- N/A
2024-04-01 17:22:59 -07:00
Marshall Bowers
e0cd96db7b
Fix up comments and remove some commented-out code (#10059)
Release Notes:

- N/A
2024-04-01 19:47:48 -04:00
Marshall Bowers
f19e84dc22
Fix doc comments for StyledText (#10058)
This PR fixes some doc comments for `StyledText` to better reflect Rust
doc comment conventions.

Release Notes:

- N/A
2024-04-01 19:25:17 -04:00
Mehmet Efe Akça
dde27483a4
vim: Avoid removing keymap context when blurred (#9960)
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>
2024-04-01 16:43:14 -06:00
Conrad Irwin
499887d931
fix 9766 (#10055)
Release Notes:

- Fixed a panic in editor::SelectPrevious (`gN` in vim)
([#9766](https://github.com/zed-industries/zed/issues/9766)).
2024-04-01 16:30:14 -06:00
moshyfawn
fbf3e1d79d
Use "install" to refer to extension installation process (#10049)
Release Notes:

- Improved discoverability of dev extension installation action
([#10048](https://github.com/zed-industries/zed/issues/10048)).
2024-04-01 15:27:03 -07:00
Marshall Bowers
83ce783856
Respect version constraints when installing extensions (#10052)
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>
2024-04-01 17:10:30 -04:00
Marshall Bowers
39cc3c0778
Allow extensions to provide data for language_ids (#10053)
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>
2024-04-01 17:01:11 -04:00
Conrad Irwin
65f0712713
vim: fix v$% (#10051)
Release Notes:

- vim: Fixed `%` in visual mode when at the end of a line.
2024-04-01 14:18:09 -06:00
Marshall Bowers
8b586ef8e7
Add new make-file-executable API for extensions (#10047)
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>
2024-04-01 15:28:24 -04:00
Ephram
6e49a2460e
Fix autocomplete completions being cut in half (#8327)
Release Notes:

- Fixed LSP completions being cut in half
([#8126](https://github.com/zed-industries/zed/issues/8126)).

Previously, autocomplete suggestions were covered by autocomplete
documentation, which only appeared after a short delay.

Now, when an autocomplete suggestion is too long to fit, the name is
truncated with ellipses like how VSCode does it:

![image](https://github.com/zed-industries/zed/assets/50590465/bf3c6271-7d7a-44b1-ab76-647df5620fcd)

Additionally `completion_documentation_secondary_query_debounce`'s
default was changed from 300ms to 0ms, which makes the editor feel
significantly faster (in my opinion).

Before:


https://github.com/zed-industries/zed/assets/50590465/6443670b-fe25-4428-9a39-54405d9a7cec

After:


https://github.com/zed-industries/zed/assets/50590465/72572487-3eb4-4a96-a2f9-608e563a1f05

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-01 13:20:51 -06:00
apricotbucket28
d1d4f83722
Revert "Fix key repeat after releasing a different key on Wayland" (#10039)
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
2024-04-01 11:43:52 -07:00
Marshall Bowers
aa76182ca7
Skip .DS_Store files when looking for extension directories (#10046)
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.
2024-04-01 13:34:00 -04:00
Andrew Lygin
a0f236af5d
themes: Add pane_group.border color (#9986)
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>
2024-04-01 12:07:26 -04:00
Marshall Bowers
65840b3633
Hoist profile.dev.package setting to workspace-level (#10041)
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
2024-04-01 11:56:17 -04:00
Marshall Bowers
954c772e29
Use ignored color from theme for items ignored by Git (#10038)
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)).
2024-04-01 11:34:49 -04:00
Kirill Bulatov
63e566e56e
Remove git diff base from symlinked files (#10037)
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))
2024-04-01 18:22:25 +03:00
Bennet Bo Fenner
c126fdb616
Fix panel drag leaking through overlay (#10035)
Closes #10017. While reworking the `overlay` element in #9911, I did not
realize that all overlay elements called `defer_draw` with a priority of
`1`.

/cc @as-cii 

Not including release notes, since it was only present in nightly.

Release Notes:

- N/A
2024-04-01 12:31:19 +02:00
Kirill Bulatov
5602593089
Check license generation for every PR to avoid license-less crate additions (#10033)
Also fix `anthropic` crate and make it AGPL-licensed, as it's used in
the AGPL-licensed collab part only.

Release Notes:

- N/A
2024-04-01 12:16:16 +03:00
Nathan Sobo
9b673089db
Enable Claude 3 models to be used via the Zed server if "language-models" feature flag is enabled for user (#10015)
Release Notes:

- N/A
2024-03-31 15:57:57 -06:00
Matthias Grandl
b1ccead0f6
gpui: fix #9931 img object-fit regression (#10006)
PR: #9931 broke image scaling, such that it ignores the object-fit
parameter and instead always scales the image to fit the bounds. This
fixes the regression.
2024-03-31 08:17:09 -07:00
Petros Amoiridis
3c8b376764
Fix broken character (#9992)
This is extremely minor but I couldn't help it.


![broken-character](https://github.com/zed-industries/zed/assets/28818/1b598b53-2a6a-4fd7-8857-a43e682db35e)

Release Notes:

- N/A
2024-03-30 14:39:45 -04:00
Joseph T. Lyons
480e3c9daf
Fix test name (#9979)
This must've come about from copying and pasting another test and
forgetting to update the name.

Release Notes:

- N/A
2024-03-29 21:12:47 -04:00
Matthias Grandl
f9becbd3d1
gpui: Add SVG rendering to img element and generic asset cache (#9931)
This is a follow up to #9436 . It has a cleaner API and generalized the
image_cache to be a generic asset cache, that all GPUI elements can make
use off. The changes have been discussed with @mikayla-maki on Discord.

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-03-29 17:09:49 -07:00
Piotr Osiewicz
ed5bfcdddc
tab_switcher: Add support for tab switcher in terminal panel (#9963)
tab switcher retrieves active pane from workspace, but that function is
not aware of Terminal Panel's pane. Thus in this PR we retrieve it
manually and use it as the active pane if terminal panel has focus.

Release Notes:

- Fixed tab switcher not working in terminal panel.
2024-03-30 00:19:02 +01:00
Marshall Bowers
b0fb02e4be
Extract Erlang support into an extension (#9974)
This PR extracts Erlang support into an extension and removes the
built-in Erlang support from Zed.

Tested using a Nix shell:

```
nix-shell -p erlang-ls
```

Release Notes:

- Removed built-in support for Erlang, in favor of making it available
as an extension. The Erlang extension will be suggested for download
when you open a `.erl` or `.hrl` file.
2024-03-29 18:03:38 -04:00
Daniel Zhu
30193647f3
Fix Recent Documents List (continues #8952) (#9919)
@SomeoneToIgnore This code should 100% work for future Zed users, but
for current Zed users, Zed's internal list of recents may not be synced
w/ macOS' Recent Documents at first. If needed this can be fixed by
calling `cx.refresh_recent_documents` on startup, but that feels a bit
unnecessary.

Release Notes:

- Fixes behavior of Recent Documents list on macOS
2024-03-29 23:17:25 +02:00
Kyle Kelley
d77e553466
File context for assistant panel (#9712)
Introducing the Active File Context portion of #9705. When someone is in
the assistant panel it now includes the active file as a system message
on send while showing them a nice little display in the lower right:


![image](https://github.com/zed-industries/zed/assets/836375/9abc56e0-e8f2-45ee-9e7e-b83b28b483ea)

For this iteration, I'd love to see the following before we land this:

* [x] Toggle-able context - user should be able to disable sending this
context
* [x] Show nothing if there is no context coming in
* [x] Update token count as we change items
* [x] Listen for a more finely scoped event for when the active item
changes
* [x] Create a global for pulling a file icon based on a path. Zed's
main way to do this is nested within project panel's `FileAssociation`s.
* [x] Get the code fence name for a Language for the system prompt
* [x] Update the token count when the buffer content changes

I'm seeing this PR as the foundation for providing other kinds of
context -- diagnostic summaries, failing tests, additional files, etc.

Release Notes:

- Added file context to assistant chat panel
([#9705](https://github.com/zed-industries/zed/issues/9705)).

<img width="1558" alt="image"
src="https://github.com/zed-industries/zed/assets/836375/86eb7e50-3e28-4754-9c3f-895be588616d">

---------

Co-authored-by: Conrad Irwin <conrad@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-29 13:55:01 -07:00
Marshall Bowers
df3050dac1
Extract C# support into an extension (#9971)
This PR extracts C# support into an extension and removes the built-in
C# support from Zed.

Tested using a Nix shell:

```
nix-shell -p dotnet-sdk omnisharp-roslyn
```

Release Notes:

- Removed built-in support for C#, in favor of making it available as an
extension. The C# extension will be suggested for download when you open
a `.cs` file.
2024-03-29 16:38:27 -04:00
Kirill Bulatov
5d531037c4
Omit empty hovers (#9967)
Closes https://github.com/zed-industries/zed/issues/9962

Release Notes:

- N/A
2024-03-29 21:59:01 +02:00
Marshall Bowers
e252f90e30
Extract PHP support into an extension (#9966)
This PR extracts PHP support into an extension and removes the built-in
PHP support from Zed.

There's a small workaround necessary in order for us to provide the
`language_ids` on the `LspAdapter` that are needed for the language
server to run properly. Eventually we'll want to build this into the
extension API, but for now we're just hard-coding it on the host side.

Release Notes:

- Removed built-in support for PHP, in favor of making it available as
an extension. The PHP extension will be suggested for download when you
open a `.php` file.
2024-03-29 14:51:54 -04:00
Marshall Bowers
764e256755
Add support for building a Tree-sitter grammar at a given path (#9965)
This PR extends the extension builder—and by extension, the
`zed-extension` CLI—with support for building a Tree-sitter grammar at a
given path within the grammar repository.

Some Tree-sitter grammar repos contain multiple grammars inside of them.
For instance,
[`tree-sitter-php`](29838ad107)
has subfolders for `php` and `php_only`.

The grammar entries in `extension.toml` can now have an optional `path`
field that will be interpreted relative to the root of the grammar
repository:

```toml
[grammars.php]
repository = "https://github.com/tree-sitter/tree-sitter-php"
commit = "8ab93274065cbaf529ea15c24360cfa3348ec9e4"
path = "php"
```

This was something we supported in the old extension packaging script,
but hadn't yet carried it over when we built the new extension builder.

Release Notes:

- N/A
2024-03-29 14:30:10 -04:00
Piotr Osiewicz
cff9ad19f8
Add spawning of tasks without saving them in the task stack (#9951)
These tasks are not considered for reruns with `task::Rerun`. 
This PR tears a bunch of stuff up around tasks:
- `menu::SecondaryConfirm` for tasks is gonna spawn a task without
storing it in history instead of being occupied by oneshot tasks. This
is done so that cmd-clicking on the menu item actually does something
meaningful.
- `menu::UseSelectedQuery` got moved into picker, as tasks are it's only
user (and it doesn't really make sense as a menu action).

TODO:
- [x] add release note
- [x] Actually implement the core of this feature, which is spawning a
task without saving it in history, lol.

Fixes #9804 
Release Notes:

- Added "fire-and-forget" task spawning; `menu::SecondaryConfirm` in
tasks modal now spawns a task without registering it as the last spawned
task for the purposes of `task::Rerun`. By default you can spawn a task
in this fashion with cmd+enter or by holding cmd and clicking on a task
entry in a list. Spawning oneshots has been rebound to `option-enter`
(under a `picker::ConfirmInput` name). Fixes #9804 (breaking change)
- Moved `menu::UseSelectedQuery` action to `picker` namespace (breaking
change).
2024-03-29 18:41:14 +01:00
Marshall Bowers
a4b55b9924
Fix GitHub commit permalinks (#9961)
This PR fixes an issue where GitHub commit permalinks were being
constructed with the wrong URL segment.

This would result in clicking on a commit from the Git blame view taking
you to the wrong page on GitHub.

### Before

```
a3d985028c
```

<img width="1654" alt="Screenshot 2024-03-29 at 12 59 51 PM"
src="https://github.com/zed-industries/zed/assets/1486634/122fd678-de56-42cb-a0c5-1ce1b9b104b5">

### After

```
a3d985028c
```

<img width="1654" alt="Screenshot 2024-03-29 at 12 59 56 PM"
src="https://github.com/zed-industries/zed/assets/1486634/1c92b2ef-7925-46bc-aebf-b739be1eae74">

Release Notes:

- N/A
2024-03-29 13:17:48 -04:00
Marshall Bowers
64ea74d1db
Fix vertical alignment of labels in file tree (#9959)
This PR fixes the vertical alignment of the labels in the file tree in
the project panel.

This appears to have been introduced in
https://github.com/zed-industries/zed/pull/8988 through the addition of
the `.h_6` in conjunction with a `div`, causing the contents to not be
vertically aligned.

### Before

<img width="287" alt="Screenshot 2024-03-29 at 12 44 15 PM"
src="https://github.com/zed-industries/zed/assets/1486634/b275b66c-55eb-4980-95b9-6751d0b4998a">

### After

<img width="259" alt="Screenshot 2024-03-29 at 12 44 42 PM"
src="https://github.com/zed-industries/zed/assets/1486634/8d7c1799-255f-4e01-8980-ccb19f49279a">


Release Notes:

- Fixed the vertical alignment of labels in the file tree to better
align with the file icons.
2024-03-29 12:55:31 -04:00
Marshall Bowers
16e6f5643c
Extract SemanticVersion into its own crate (#9956)
This PR extracts the `SemanticVersion` out of `util` and into its own
`SemanticVersion` crate.

This allows for making use of `SemanticVersion` without needing to pull
in some of the heavier dependencies included in the `util` crate.

As part of this the public API for `SemanticVersion` has been tidied up
a bit.

Release Notes:

- N/A
2024-03-29 12:11:57 -04:00
Bennet Bo Fenner
77f1cc95b8
gpui: Rework overlay element (#9911)
There was a problem using deferred draws with `overlay` and tooltips at
the same time.

The `overlay` element was removed and was split up into two separate
elements
- `deferred`
- `anchored` - Mimics the `overlay` behavior but does not render its
children as deferred

`tooltip_container` does not defer its drawing anymore and only uses
`anchored`.

/cc @as-cii 


Release Notes:
- Fixed tooltip for the recent projects popover not showing anymore

---------

Co-authored-by: Antonio <antonio@zed.dev>
2024-03-29 16:26:16 +01:00
jansol
49144d94bf
gpui: Add support for window transparency & blur on macOS (#9610)
This PR adds support for transparent and blurred window backgrounds on
macOS.

Release Notes:

- Added support for transparent and blurred window backgrounds on macOS
([#5040](https://github.com/zed-industries/zed/issues/5040)).
- This requires themes to specify a new `background.appearance` key
("opaque", "transparent" or "blurred") and to include an alpha value in
colors that should be transparent.

<img width="913" alt="image"
src="https://github.com/zed-industries/zed/assets/2588851/7547ee2a-e376-4d55-9114-e6fc2f5110bc">
<img width="994" alt="image"
src="https://github.com/zed-industries/zed/assets/2588851/b36fbc14-6e4d-4140-9448-69cad803c45a">
<img width="1020" alt="image"
src="https://github.com/zed-industries/zed/assets/2588851/d70e2005-54fd-4991-a211-ed484ccf26ef">

---------

Co-authored-by: Luiz Marcondes <luizgustavodevergennes@gmail.com>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-29 11:10:47 -04:00
Piotr Osiewicz
1360dffead
task: Make UseSelectedQuery modal action expand to full command (#9947)
Previously it expanded to a label, which was correct for oneshots, but
wrong for everything else.

Release Notes:

- Improved UseSelectedQuery (shift-enter) action for tasks modal by
making it substitute a full command and not the task label.
- Fixed one-shot tasks having duplicates in tasks modal.
2024-03-29 11:45:50 +01:00
Kirill Bulatov
c7f04691d9
Query code actions and hovers from all related local language servers (#9943)
<img width="1122" alt="Screenshot 2024-03-28 at 21 51 18"
src="https://github.com/zed-industries/zed/assets/2690773/37ef7202-f10f-462f-a2fa-044b2d806191">


Part of https://github.com/zed-industries/zed/issues/7947 and
https://github.com/zed-industries/zed/issues/9912 that adds makes Zed
query all related language servers instead of the primary one.

Collab clients are still querying the primary one only, but this is
quite hard to solve, https://github.com/zed-industries/zed/pull/8634
drafts a part of it.
The local part is useful per se, as many people use Zed & Tailwind but
do not use collab features.

Unfortunately, eslint still returns empty actions list when queried, but
querying actions for all related language servers looks reasonable and
rare enough to be dangerous.

Release Notes:

- Added Tailwind CSS hover popovers for Zed in single player mode
([7947](https://github.com/zed-industries/zed/issues/7947))
2024-03-29 12:18:38 +02:00
Marshall Bowers
c4bc172850
Improve extension suggestions (#9941)
This PR improves the behavior for suggesting extensions.

Previously if the file had an extension, it would only look for
suggestions based on that extension. This prevented us from making
suggestions for files like `Cargo.lock`.

Suggestions are now made in the following order:

1. Check for any suggestions based on the entire file name
2. Check for any suggestions based on the file extension (if present)

This PR also fixes a bug where file name-based suggestions were looking
at the entire path, not just the file name.

Finally, the suggestion notification has been updated to include the ID
of the extension, to make it clearer which extension will be installed.

Release Notes:

- Improved extension suggestions.
2024-03-28 19:15:40 -04:00
Marshall Bowers
d074586fbf
Extract TOML support into an extension (#9940)
This PR extracts TOML support into an extension and removes the built-in
TOML support from Zed.

There's a small workaround necessary in order for us to set the file
permissions on the `taplo` binary so that it can be run. Eventually
we'll want to build this into the extension API, but for now we're just
hard-coding it on the host side.

Release Notes:

- Removed built-in support for TOML, in favor of making it available as
an extension. The TOML extension will be suggested for download when you
open a `.toml` or `Cargo.lock` file.
2024-03-28 18:40:12 -04:00
Marshall Bowers
0d7f5f49e6
Disable incompatible extension versions in extension view (#9938)
This PR makes it so extension versions that are incompatible with what
the current Zed instance supports are disabled in the UI, to prevent
attempting to install them.

Here's what it looks like in the extension version picker:

<img width="589" alt="Screenshot 2024-03-28 at 4 21 15 PM"
src="https://github.com/zed-industries/zed/assets/1486634/8ef11c72-c8f0-4de8-a73b-5c82e96f6bfe">

Release Notes:

- N/A
2024-03-28 16:49:26 -04:00
Max Brunsfeld
95fd426eff
Add auto-update system for extensions (#9890)
* [x] auto update extensions on startup
* [ ] add a manual way of updating all?
* [x] add a way to opt out of auto-updates for a particular extension

We don't believe that there should be any background polling for
extension auto-updates, because it could be disruptive to the user.

Release Notes:

- Added an auto-update system for extensions.

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-28 15:41:22 -04:00
Thorsten Ball
3a36b10e3a
Truncate commit messages in blame tooltip (#9937)
This truncates git commit messages to 15 lines.


Before:
![screenshot-2024-03-28-20 10
17@2x](https://github.com/zed-industries/zed/assets/1185253/03bea6bb-2ead-4bf6-bb12-22338c8745fd)

After:

![screenshot-2024-03-28-20 10
02@2x](https://github.com/zed-industries/zed/assets/1185253/0bd655ee-57ce-424f-b471-b7ce01e5fbf7)




Release Notes:

- N/A
2024-03-28 20:19:04 +01:00
Thorsten Ball
98adc7b108
Use correct font family and line_height in git blame sidebar (#9935)
This fixes the git blame sidebar looking wrong if the buffer font size
is higher than the UI font size (which is what was previously used).

It fixes this:

![screenshot-2024-03-28-19 46
48@2x](https://github.com/zed-industries/zed/assets/1185253/eca360ac-c8e8-41e0-85a1-52bdd05b9413)

To now look like this:

![screenshot-2024-03-28-19 47
42@2x](https://github.com/zed-industries/zed/assets/1185253/1fe93370-b7a2-44d4-a505-6368d72e2659)


Release Notes:

- N/A
2024-03-28 20:05:29 +01:00
Marshall Bowers
50fc54c321
Extend extension API to support auto-updating extensions (#9929)
This PR extends the extension API with some additional features to
support auto-updating extensions:

- The `GET /extensions` endpoint now accepts an optional `ids` parameter
that can be used to filter the results down to just the extensions with
the specified IDs.
- This should be a comma-delimited list of extension IDs (e.g.,
`wgsl,gleam,tokyo-night`).
- A new `GET /extensions/:extension_id` endpoint that returns all of the
extension versions for a particular extension.

Extracted from #9890, as these changes can be landed and deployed
independently.

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
2024-03-28 14:20:57 -04:00
Maksim Bondarenkov
eaf65ab704
windows: Support compiling with MinGW toolchain (part 2) (#9843)
crates/languages and extensions/gleam: handle different target envs (a
new variant of os: `pc-windows-gnu`)
crates/storybook: compile manifest for all windows targets (same as
#9815)
looks like fixes #9807, but there are still errors presented

<details>

```
[2024-03-27T12:07:25+03:00 INFO  Zed] ========== starting zed ==========
[2024-03-27T12:07:26+03:00 INFO  cosmic_text::font::system] Parsed 398 font faces in 60ms.
[2024-03-27T12:07:26+03:00 INFO  db] Opening main db
[2024-03-27T12:07:26+03:00 ERROR util] crates\settings\src\settings_file.rs:76: EOF while parsing a value at line 1 column 0
[2024-03-27T12:07:26+03:00 ERROR util] crates\settings\src\keymap_file.rs:89: invalid binding value for keystroke escape, context Some("ChatPanel > MessageEditor")

Caused by:
    no action type registered for chat_panel::CloseReplyPreview
[2024-03-27T12:07:26+03:00 INFO  gpui::platform::windows::platform] use DCompositionWaitForCompositorClock for vsync
[2024-03-27T12:07:26+03:00 ERROR util] crates\zed\src\zed.rs:629: EOF while parsing a value at line 1 column 0
[2024-03-27T12:07:26+03:00 ERROR util] crates\zed\src/main.rs:720: Системе не удается найти указанный путь. (os error 3)
[2024-03-27T12:07:26+03:00 INFO  db] Opening main db
[2024-03-27T12:07:26+03:00 INFO  node_runtime] Node runtime install_if_needed
[2024-03-27T12:07:26+03:00 ERROR util] crates\workspace\src/workspace.rs:912: Error in last_window, select_row_bound expected single row result but found none for: SELECT
  display,
  window_state,
  window_x,
  window_y,
  window_width,
  window_height,
  fullscreen
FROM
  workspaces
WHERE
  workspace_location IS NOT NULL
ORDER BY
  timestamp DESC
LIMIT
  1
[2024-03-27T12:07:26+03:00 INFO  blade_graphics::hal::init] Adapter "NVIDIA GeForce RTX 3050 Ti Laptop GPU"
[2024-03-27T12:07:26+03:00 INFO  blade_graphics::hal::init] Ray tracing is supported
[2024-03-27T12:07:27+03:00 WARN  blade_graphics::hal::init] Requested size 1x1 is outside of surface capabilities
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_impl")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_device_position_transformed")
[2024-03-27T12:07:27+03:00 INFO  naga:🔙:spv::writer] Skip function Some("to_tile_position")
[2024-03-27T12:07:27+03:00 INFO  blade_graphics::hal::resource] Creating texture 0x2b2528fec20 of size 1024x1024x1 and format R8Unorm, name 'atlas', handle 0
[2024-03-27T12:07:27+03:00 INFO  blade_graphics::hal::resource] Creating buffer 0x2b2524762a0 of size 65536, name 'chunk-0', handle 1
[2024-03-27T12:07:27+03:00 INFO  blade_graphics::hal::resource] Creating buffer 0x2b252477ba0 of size 4096, name 'chunk-0', handle 2
[2024-03-27T12:07:27+03:00 INFO  blade_graphics::hal::resource] Creating buffer 0x2b2524765c0 of size 9184, name 'chunk-1', handle 3
[2024-03-27T12:07:27+03:00 ERROR util] crates\copilot_ui\src\copilot_completion_provider.rs:207: copilot is still starting
error: process didn't exit successfully: `target\release\Zed.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
fish: Job 1, 'RUST_BACKTRACE=full RUST_LOG=in…' terminated by signal SIGSEGV (Address boundary error)
```

</details>

Release Notes:

- N/A
2024-03-28 10:40:07 -07:00
Piotr Osiewicz
fcaf4383e9
editor: Preserve scroll position when jumping from multibuffer (#9921)
This is a best-effort attempt, as the target offset from the top is just
an estimate; furthermore, this does not account for things like project
search header (which adds a bit of vertical offset by itself and is
removed once we jump into a buffer), but it still should improve the
situation quite a bit.

Fixes: #5296

Release Notes:

- Improved target selection when jumping from multibuffer; final
position in the buffer should more closely match the original position
of the cursor in the multibuffer.
2024-03-28 18:33:57 +01:00
Thorsten Ball
7f54935324
Add git blame (#8889)
This adds a new action to the editor: `editor: toggle git blame`. When
used it turns on a sidebar containing `git blame` information for the
currently open buffer.

The git blame information is updated when the buffer changes. It handles
additions, deletions, modifications, changes to the underlying git data
(new commits, changed commits, ...), file saves. It also handles folding
and wrapping lines correctly.

When the user hovers over a commit, a tooltip displays information for
the commit that introduced the line. If the repository has a remote with
the name `origin` configured, then clicking on a blame entry opens the
permalink to the commit on the code host.

Users can right-click on a blame entry to get a context menu which
allows them to copy the SHA of the commit.

The feature also works on shared projects, e.g. when collaborating a
peer can request `git blame` data.

As of this PR, Zed now comes bundled with a `git` binary so that users
don't have to have `git` installed locally to use this feature.

### Screenshots

![screenshot-2024-03-28-13 57
43@2x](https://github.com/zed-industries/zed/assets/1185253/ee8ec55d-3b5e-4d63-a85a-852da914f5ba)

![screenshot-2024-03-28-14 01
23@2x](https://github.com/zed-industries/zed/assets/1185253/2ba8efd7-e887-4076-a87a-587a732b9e9a)
![screenshot-2024-03-28-14 01
32@2x](https://github.com/zed-industries/zed/assets/1185253/496f4a06-b189-4881-b427-2289ae6e6075)

### TODOs

- [x] Bundling `git` binary

### Release Notes

Release Notes:

- Added `editor: toggle git blame` command that toggles a sidebar with
git blame information for the current buffer.

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-03-28 18:32:11 +01:00
Niklas Wimmer
e2d6b0deba
gpui: Update dependencies (second attempt) (#9836)
Updated version of #9741 with fixes for the problems raised in #9774. I
only verified that the images no longer look blueish on Linux, because I
don't have a Mac.

cc @osiewicz

Release Notes:

- N/A

---------

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
2024-03-28 10:22:31 -07:00
白山風露
94c51c6ac9
Windows: Enable clippy deny warnings (#9920)
~Waiting #9918~

Release Notes:

- N/A
2024-03-28 11:55:35 -04:00
Hans
659ea7054a
Adjust image viewer tab title font (#9903)
Fix #9895 

Release notes:

- Changed the tab title of the image preview to be the same as the other
tabs ([#9895](https://github.com/zed-industries/zed/issues/9895)).

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-28 11:44:15 -04:00
白山風露
403b912767
Windows: Implement signal in collab (#9918)
Only `CtrlC` and `CtrlBreak` signals are supported. `CtrlLogoff` and
`CtrlShutdown` is service only signal and I have not tried these yet.
`CtrlClose` occurs when terminal window is closed, but I found tokio's
`ctrl_close` does not work well, so I put comment in code.

Release Notes:

- N/A
2024-03-28 11:36:28 -04:00
Thorsten Ball
5da951ce29
Revert "Add working directories for eslint (#9738)" (#9914)
This reverts commit 96a1af7b0f from
https://github.com/zed-industries/zed/pull/9738 since it doesn't seem to
do anything. See:
https://github.com/zed-industries/zed/issues/9648#issuecomment-2025132087



Release Notes:

- N/A
2024-03-28 15:09:05 +01:00
Piotr Osiewicz
cb7c53bc52
workspace: Fix panel resize handles leaking through zoomed panels (#9909)
Fixes #9501 

Release Notes:

- Fixed panel resize handle "leaking through" into a zoomed panel or
pane.
2024-03-28 12:18:51 +01:00
Daniel Zhu
f5823f9942
Split DuplicateLine into DuplicateLineUp and DuplicateLineDown (#9715)
Fixes #9601

Release Notes:
- `DuplicateLine` is now split into `DuplicateLineUp` and
`DuplicateLineDown`
2024-03-28 12:52:08 +02:00
Antonio Scandurra
c33ee52046
Don't update active completion for editors that are not focused (#9904)
Release Notes:

- N/A
2024-03-28 10:51:55 +01:00
Hans
eaec04632a
vim: Fix t operand not working correctly when cursor is on tag (#9899)
Fix #8994 and #9844 

Release notes:
* Fixed the `t` object in Vim mode not working correctly when cursor was
on a tag. #9844 and #8994

This mr fixes the above two problems, for #9844, because our previous
logic is to only think that the minimum html tag containing the current
cursor is qualified, but the approach of nvim is to get the tag after
the current cursor first, followed by the tag around the current cursor,
so I modified the corresponding condition

For #8994, the situation is a bit more complicated, in our previous
implementation, we could only get the range of the object by a `cursor
position`, but there are two possible cases for the html tag:
When the current cursor length is 1, nvim will return the first tag
after the current cursor, as described above
When the current cursor length is greater than 1, nvim will return just
the smallest tag that can cover the current selection

So we may need to pass the current selection to the inside of the
method, and the point alone is not enough to support us in calculating
these conditions
2024-03-28 10:16:54 +01:00
Hans
96a1af7b0f
Add working directories for eslint (#9738)
Fix #9648 

Release notes:

- Added ability to configure ESLint's `workingDirectories` in settings.
Example:
`{"lsp":{"eslint":{"settings":{"workingDirectories":["./client","./server"]}}}}`.
#9648

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-03-28 07:01:19 +01:00
Hans
2f2f236afe
vim: Make cc and S auto-indent (#9731)
Fix #9612 

Release notes:

* Changed `cc` and `S` in Vim mode to only change the current line after
its indentation. #9612
2024-03-28 07:01:00 +01:00
Marshall Bowers
ff685b299d
Extract Zig support into an extension (#9893)
This PR extracts Zig support into an extension and removes the built-in
Zig support from Zed.

There's a small workaround necessary in order for us to set the file
permissions on the `zls` binary so that it can be run. Eventually we'll
want to build this into the extension API, but for now we're just
hard-coding it on the host side.

Release Notes:

- Removed built-in support for Zig, in favor of making it available as
an extension. The Zig extension will be suggested for download when you
open a `.zig` file.
2024-03-27 20:56:30 -04:00
Mikayla Maki
9bce5e8b82
Improve diagnostic header UI (#9888)
This PR rearranges the diagnostics to put the headers to the left of the
diagnostic messages and adds an additional button to close the
diagnostics.

<img width="394" alt="Screenshot 2024-03-27 at 2 01 19 PM"
src="https://github.com/zed-industries/zed/assets/2280405/83be4051-6441-47c6-9b48-77c75ce9c8eb">

<img width="326" alt="Screenshot 2024-03-27 at 2 01 56 PM"
src="https://github.com/zed-industries/zed/assets/2280405/d849ca34-91e9-4de6-9d9c-503b75e97d60">

As a drive by, I also quieted a useless but loud log message.

Release Notes:

- Added a close button to the `f8` diagnostics.
2024-03-27 14:30:27 -07:00
Kirill Bulatov
80242584e7
Prepare editor to display multiple LSP hover responses for the same place (#9868) 2024-03-27 20:49:26 +01:00
Kirill Bulatov
ce37885f49
Use different icons for terminal tasks (#9876) 2024-03-27 20:49:10 +01:00
Jason Wen
3046ef6471
windows: Prevent command line from opening in release mode (#9839)
Release Notes:

- Prevents the terminal from opening on release mode on Windows

Note: this also prevents Zed from logging to the terminal when it is
launched from the terminal. Is this expected behaviour on other
platforms?

---------

Co-authored-by: 白山風露 <shirayama.kazatsuyu@gmail.com>
2024-03-27 11:30:23 -07:00
Andrew Lygin
894b39a918
Add tab switcher (#7987)
The Tab Switcher implementation (#7653):
- `ctrl-tab` opens the Tab Switcher and moves selection to the
previously selcted tab. It also cycles selection forward.
- `ctrl-shift-tab` opens the Tab Switcher and moves selection to the
last tab in the list. It also cycles selection backward.
- Tab is selected and the Tab Switcher is closed on the shortcut
modifier key (`ctrl` by default) release.
- List items are in reverse activation history order.
- The list reacts to the item changes in background (new tab, tab
closed, tab title changed etc.)

Intentionally not in scope of this PR:
- File icons
- Close buttons

I will come back to these features. I think they need to be implemented
in separate PRs, and be synchronized with changes in how tabs are
rendered, to reuse the code as it's done in the current implementation.
The Tab Switcher looks usable even without them.

Known Issues:

Tab Switcher doesn't react to mouse click on a list item. It's not a tab
switcher specific problem, it looks like ctrl-clicks are not handled the
same way in Zed as cmd-clicks. For instance, menu items can be activated
with cmd-click, but don't react to ctrl-click. Since the Tab Switcher's
default keybinding is `ctrl-tab`, the user can only click an item with
`ctrl` pushed down, thus preventing `on_click()` from firing.

fixes #7653, #7321

Release Notes:

- Added Tab Switcher which is accessible via `ctrl-tab` and
`ctrl-shift-tab` (#7653) (#7321)

Related issues:

- Unblocks #7356, I hope 😄

How it looks and works (it's only `ctrl-tab`'s and `ctrl-shift-tab`'s,
no `enter`'s or mouse clicks):


https://github.com/zed-industries/zed/assets/2101250/4ad4ec6a-5314-481b-8b35-7ac85e43eb92

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-27 11:15:08 -07:00
Marshall Bowers
9c22009e7b
Look up extensions in the new index when reporting extension events (#9879)
This PR fixes a bug that was causing extension telemetry events to not
be reported.

We need to look up the extensions in the new index, as the extensions to
load won't be found in the old index.

Release Notes:

- N/A
2024-03-27 13:45:19 -04:00
Piotr Osiewicz
044b516d98
typescript: Highlight variables and enums in completions, add details (#9873)
This partially fixes #5287 by surfacing origin of a completion.

Before:

![image](https://github.com/zed-industries/zed/assets/24362066/7cae421d-9523-43c5-bfc3-eed613a21ac4)

After:

![image](https://github.com/zed-industries/zed/assets/24362066/3d5e360c-c496-4542-82b5-a22d5d00113d)

Release Notes:

- Improved typescript-language-server integration by surfacing more
information about completion items.
2024-03-27 17:55:22 +01:00
Marshall Bowers
b1ad60a2ef
Log when events are written to Clickhouse (#9875)
This PR adds some logging when we write events to Clickhouse in `POST
/telemetry/events`, for observability purposes.

Release Notes:

- N/A
2024-03-27 12:33:34 -04:00
Marshall Bowers
3f5f64a044
Wrap extension schema version in a newtype (#9872)
This PR wraps the extension schema version in a newtype, for some
additional type safety.

Release Notes:

- N/A
2024-03-27 12:11:12 -04:00
Joseph T. Lyons
8c56a4b305 v0.130.x dev 2024-03-27 10:53:09 -04:00
Dunqing
96b812b2c4
Pin Vue language server to 1.8 (#9846)
After `@vue/language-server` release 2.0, vue lsp doesn't work. I tried
to support 2.0, but since I'm not familiar with `@vue/language-server`
and `zed` I was unsuccessful. To avoid long-term unavailability, I
temporarily fixed the version to 1.8 until we have 2.0 support.

Release Notes:

- Pinned `@vue/language-server` to version `1.8` until Zed supports
`2.x`. ([#9388](https://github.com/zed-industries/zed/issues/9388) &
[#9329](https://github.com/zed-industries/zed/issues/9329)).

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-03-27 14:23:10 +01:00
Conrad Irwin
140b8418c1
Stop reading deserialize_fingerprint (#9668)
Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-03-27 11:24:31 +01:00
Mikayla Maki
40f60ebe2d
Fix the linux keymap (#9829)
Earlier versions where a simple find-replace of `cmd` => `ctrl`. In this
PR, I've gone over every keybinding individually and checked them.

Release Notes:

- Removed the `ShowContextMenu` action, it's only usage was in the
collab panel and it's been rebound to `SecondaryConfirm`
2024-03-26 16:10:09 -07:00
Marshall Bowers
3676ca879b
Extract Astro support into an extension (#9835)
This PR extracts Astro support into an extension and removes the
built-in Astro support from Zed.

Release Notes:

- Removed built-in support for Astro, in favor of making it available as
an extension. The Astro extension will be suggested for download when
you open a `.astro` file.
2024-03-26 18:50:08 -04:00
Marshall Bowers
7807f23e2a
Extract Dockerfile extension (#9832)
This PR extracts Dockerfile support into an extension and removes the
built-in Dockerfile support from Zed.

There's already an existing [Dockerfile
extension](https://github.com/d1y/dockerfile.zed) that was just missing
language server support. Language server support is being added to that
extension in https://github.com/d1y/dockerfile.zed/pull/2.

Release Notes:

- Removed built-in support for Dockerfile, in favor of making it
available as an extension. The Dockerfile extension will be suggested
for download when you open a `Dockerfile`.
2024-03-26 16:38:21 -04:00
Bennet Bo Fenner
e272acd1bc
collab ui: Fix notification windows on external monitors (#9817)
Sharing a project displays a notification (window) on every screen.
Previously there was an issue with the positioning of windows on all
screens except the primary screen.

As you can see here:


![image](https://github.com/zed-industries/zed/assets/53836821/314cf367-8c70-4e8e-bc4a-dcbb99cb4f71)

Now:


![image](https://github.com/zed-industries/zed/assets/53836821/42af9ef3-8af9-453a-ad95-147b5f9d90ba)

@mikayla-maki and I also decided to refactor the `WindowOptions` a bit. 
Previously you could specify bounds which controlled the positioning and
size of the window in the global coordinate space, while also providing
a display id (which screen to show the window on). This can lead to
unusual behavior because you could theoretically specify a global bound
which does not even belong to the display id which was provided.

Therefore we changed the api to this:
```rust
struct WindowOptions {
    /// The bounds of the window in screen coordinates
    /// None -> inherit, Some(bounds) -> set bounds.
    pub bounds: Option<Bounds<DevicePixels>>,

    /// The display to create the window on, if this is None,
    /// the window will be created on the main display
    pub display_id: Option<DisplayId>,
}
```

This lets you specify a display id, which maps to the screen where the
window should be created and bounds relative to the upper left of the
screen.

Release Notes:

- Fixed positioning of popup windows (e.g. when sharing a project) when
using multiple external displays.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-03-26 13:07:38 -07:00
Marshall Bowers
ffd698be14
Remove lingering uiua.rs file (#9828)
This PR removes a lingering file related to Uiua support.

This file was no longer being referenced after #9085, but just hadn't
been removed.

Release Notes:

- N/A
2024-03-26 16:07:23 -04:00
Remco Smits
0fd91652de
Fixed channel chat notifications are not working anymore (#9827)
This PR will fix the following issues that were introduced by the
following pull request #9557.

- Cannot create messages with a mention inside it
- Cannot invite a user
- Cannot accept an invitation

Release Notes:

- Fixed channel chat notifications are not working anymore.

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
2024-03-26 20:25:09 +01:00
Marshall Bowers
9604b22d98
Suppress error logs from CopilotCompletionProvider when Copilot is disabled (#9826)
This PR fixes some noisy error logs from the `CopilotCompletionProvider`
when Copilot is disabled entirely via the settings.

I have the following in my settings file:

```json
{
  "features": {
    "copilot": false
  },
}
```

After #9777 I started seeing my Zed logs getting filled up with messages
like this:

```
[2024-03-26T14:33:09-04:00 ERROR util] crates/copilot_ui/src/copilot_completion_provider.rs:206: copilot is disabled
```

Release Notes:

- N/A
2024-03-26 15:14:44 -04:00
Marshall Bowers
cd32ef64ff
Use correct file extension for Haskell suggestions (#9825)
This PR fixes the file extension used for suggesting the Haskell
extension.

Release Notes:

- N/A
2024-03-26 14:21:03 -04:00