Commit Graph

14464 Commits

Author SHA1 Message Date
Conrad Irwin
60044a5f56
Fix panic by preventing opening local files in a remote project (#9304)
Release Notes:

- Fixed a panic caused by allowing the CLI to re-use workspaces

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-14 13:51:33 -04:00
张小白
cbf960e979
Windows: make fs to use workspace windows crate (#9350)
Release Notes:

- N/A
2024-03-14 10:43:06 -07:00
Marshall Bowers
a183c33367
Prevent long extension descriptions from overflowing (#9348)
This PR fixes an issue where long extension descriptions could take up
more room than intended, pushing the GitHub repository icon off the
screen.

<img width="901" alt="Screenshot 2024-03-14 at 12 54 14 PM"
src="https://github.com/zed-industries/zed/assets/1486634/befce468-f8df-4183-b3cc-9d088dd53b4e">

Fixes #9331.

Release Notes:

- Fixed an issue where long extension descriptions could push the GitHub
repository icon off the screen
([#9331](https://github.com/zed-industries/zed/issues/9331)).
2024-03-14 13:06:42 -04:00
Marshall Bowers
3610b076a0
Restore --all-targets for clippy (#9346)
This PR restores the `--all-targets` flag when running `cargo clippy`.

Without it, there are areas that Clippy does not check, as evidenced by
the violations that were caught once the flag was re-added.

Release Notes:

- N/A
2024-03-14 12:39:45 -04:00
Piotr Osiewicz
5f02ef701d
fs: Remove unused import (#9344)
Followup to #9341 as I've noticed a CI failure on bundling step of my
other PR
(https://github.com/zed-industries/zed/actions/runs/8283419386/job/22666698264)
Release Notes:

- N/A
2024-03-14 16:55:32 +01:00
Antonio Scandurra
fab55486f5
Fix project search filtering on projects with multiple worktrees (#9337)
Fixes #9285

Release Notes:

- Fixed a bug that broke search filtering when searching a project with
multiple worktrees
([#9285](https://github.com/zed-industries/zed/issues/9285)).

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-03-14 16:40:48 +01:00
Thorsten Ball
7629c16162
Always read files to string on a background thread (#9341)
We noticed that when you open a lot of files (i.e. project-wide search
with multi-buffer) that the main thread can become unresponsive, because
while we are async, we still load these files on the main thread.

What this change does is it uses `smol::unblock` to load files on a
different thread.

Release Notes:

- Improved responsiveness when loading files into memory.

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Kirill <kirill@zed.dev>
2024-03-14 16:17:12 +01:00
Thorsten Ball
c015baa638
Do not start searching if query is empty (#9333)
This avoids the problem of a search being kicked off involuntarily and
potentially using a large amount of CPU when toggling on the `Search
Ignored Files` option.

What would happen is that someone would turn the option on, we'd kick
off a search, and go through all of the files in, say, `node_modules`.
Even if no query was given.

This avoids that.

Release Notes:

- Fixed an empty search being kicked off involuntarily if no query was
typed in yet but an option was toggled.
2024-03-14 15:06:00 +01:00
Kirill Bulatov
f142568172
Allow navigating back to multibuffers (#9334)
Fixes
https://github.com/orgs/zed-industries/projects/14/views/1?pane=issue&itemId=56263346

Fixes a state where Zed multi buffers were not reachable after going to
an excerpt inside it (with alt-enter).
I suspect, we will have to come back to multi buffer history and check
the way it behaves on inner excerpts clicking, but now this change seems
to restore the main thing: multi buffers not being shown in the history
at all.



Release Notes:

- Fixes "go backwards" not considering multibuffers in history
2024-03-14 15:05:08 +02:00
Piotr Osiewicz
b795b0eb77
editor: Do not autoindent on line removals in vim mode. (#9332)
Fixes #8942

Release Notes:

- Fixed overeager auto-indentation on line removals in Vim mode.
2024-03-14 13:23:33 +01:00
Antonio Scandurra
51261c553f
Fix double-clicking titlebar to zoom (#9323)
Fixes https://github.com/zed-industries/zed/issues/9300

This was a regression caused by not inserting a hitbox when a div only
had click listeners on it.

Release Notes:

- Fixed a regression that disabled double-clicking on the titlebar to
zoom the window.
([#9300](https://github.com/zed-industries/zed/issues/9300))
(preview-only)
2024-03-14 09:37:31 +01:00
Conrad Irwin
bffde43c12
Improve vim undo (#9317)
The important change here is to ensure that undo never lands you in
visual mode; but we also take care to restore the selection the same way
vim does (visual line goes to beginning of line, visual block to the top
left, etc.).

To help make this behaviour feel right we also group any deletions that
started insert mode with the first text inserted.

Fixes: #7521

Release Notes:

- vim: Improved undo. It will now restore you to normal mode in the same
position as vim, and group deletions caused by `c` or `s` with the
concomitant insert.
([#7521](https://github.com/zed-industries/zed/issues/7521)).
2024-03-13 23:12:12 -06:00
Andrew Lygin
6ae5274954
Scrollbar markers enhancements (#9080)
Several improvements in how various markers are displayed in the editor
scrollbar, as described in #9070, if you're ok with the proposal:
- Scrollbar has three columns:
  - 1st is for git markers
  - 2nd is for selections and search resulta highlightings
  - 3rd is for diagnostics
- Height of all markers is scaled, but there's a minimal allowed height
of 2px.
- Right border removed from both the scrollbar and thumb to make more
room for markers.

Release Notes:

- Improved scrollbar markers visualization (#9070).
2024-03-13 23:05:43 +02:00
Conrad Irwin
b65aa7e2a7
Fix accidental leak of text stack between frames (#9297)
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Marshall <marshall@zed.dev>

Release Notes:

- Fixed a bug where text styles could leak between frames (preview only)

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2024-03-13 15:03:45 -06:00
张小白
3274cc93df
Windows: impl WindowsDisplay (#9287)
Tested on my laptop, and I've noticed that when I move the window,
`WindowsPlatform::displays()` is being continuously called. Is this
intended?

Release Notes:

- N/A
2024-03-13 13:08:11 -07:00
张小白
36cbfbfb94
windows: Better keyboard input support (#9180)
### Description

Currently, there are some issues with input handling on Windows:

#### 1. Direct crash when encountering IME input.



https://github.com/zed-industries/zed/assets/14981363/598f7272-1948-4a42-99c5-2ef7b9162a1e


#### 2. Handling messages every 1/60 seconds in the main thread. Despite
being named "immediate_handle," it's not exactly immediate.

```rust
// actually halt here
let wait_result =
    unsafe { DCompositionWaitForCompositorClock(Some(&[self.inner.event]), INFINITE) };

// compositor clock ticked so we should draw a frame
if wait_result == 1 {
    unsafe { invalidate_thread_windows(GetCurrentThreadId()) };

    while unsafe { PeekMessageW(&mut msg, HWND::default(), 0, 0, PM_REMOVE) }.as_bool()
```

#### 3. According to Windows recommendations, character input should be
obtained using `WM_CHAR` instead of `WM_KEYDOWN`. Additionally, there
are problems with the handling within `WM_CHAR`.

```rust
fn handle_char_msg(&self, wparam: WPARAM) -> LRESULT {
        let mut callbacks = self.callbacks.borrow_mut();
        if let Some(callback) = callbacks.input.as_mut() {
            let modifiers = self.current_modifiers();
            let msg_char = wparam.0 as u8 as char; // these are u16 chars, cant treat them as u8
```

And, we don't handle `WM_SYSKEYDOWN` properly, which leads to `Alt + F4`
not working.

Release Notes:

- N/A
2024-03-13 12:10:22 -07:00
张小白
2abb5aeaf2
Fix crash when launching Zed.exe directly from target/debug dir (#9112)
As I described in #9111 , the PR fixs this crash.


Release Notes:

- N/A
2024-03-13 12:08:00 -07:00
Thorsten Ball
a56a260778
Add ability to specify binary path/args for rust-analyzer (#9293)
This fixes #9292 by adding a section to the language server settings
that allows users to specify the binary path and arguments with which to
start up a language server.

Example user settings for `rust-analyzer`:

```json
{
  "lsp": {
    "rust-analyzer": {
      "binary": {
        "path": "/Users/thorstenball/tmp/rust-analyzer-aarch64-apple-darwin",
        "arguments": ["--no-log-buffering"]
      }
    }
  }
}
```

Constraints:

* Right now this only allows ABSOLUTE paths.
* This is only used by `rust-analyzer` integration right now, but the
setting can be used for other language servers. We just need to update
the adapters to also respect that setting.



Release Notes:

- Added ability to specify `rust-analyzer` binary `path` (must be
absolute) and `arguments` in user settings. Example: `{"lsp":
{"rust-analyzer": {"binary": {"path": "/my/abs/path/rust-analyzer",
"arguments": ["--no-log-buffering"] }}}}`
([#9292](https://github.com/zed-industries/zed/issues/9292)).

Co-authored-by: Ricard Mallafre <rikitzzz@gmail.com>
2024-03-13 18:42:03 +01:00
Conrad Irwin
6655b964ab k8s syntax 2024-03-13 11:28:17 -06:00
Max Brunsfeld
724c19a223
Add a setting for custom associations between languages and files (#9290)
Closes #5178

Release Notes:

- Added a `file_types` setting that can be used to associate languages
with file names and file extensions. For example, to interpret all `.c`
files as C++, and files called `MyLockFile` as TOML, add the following
to `settings.json`:

    ```json
    {
      "file_types": {
        "C++": ["c"],
        "TOML": ["MyLockFile"]
      }
    }
    ```

As with most zed settings, this can be configured on a per-directory
basis by including a local `.zed/settings.json` file in that directory.

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-13 10:23:30 -07:00
Conrad Irwin
77de5689a3
Allow setting a channel for new users to auto-join (#9291)
Release Notes:

- Automatically add new users to the #zed channel
2024-03-13 11:11:31 -06:00
Julia
88e33a1dbe
Account for all hover heights & prevent un-hover between popovers (#9257)
Fixes https://github.com/zed-industries/zed/issues/5227
Fixes https://github.com/zed-industries/zed/issues/7304

Release Notes:

- Fixed an issue where not all editor hover popovers would be accounted
for when choosing to hover above or below the mouse cursor
([#5227](https://github.com/zed-industries/zed/issues/5227)).
- Fixed an issue where editor hover could be dismissed by moving the
mouse between hover popovers
([#7304](https://github.com/zed-industries/zed/issues/7304)).

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2024-03-13 12:55:15 -04:00
Antonio Scandurra
139bb3275a
Automatically reset cursor style when hit test changes (#9289)
Release Notes:

- N/A

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-03-13 17:21:25 +01:00
Joseph T. Lyons
7f0e373358 v0.128.x dev 2024-03-13 11:57:44 -04:00
Igal Tabachnik
6286d86262
Set the correct dispatch action for the double-click handler for the pane tab bar (#9221)
Fixes #9003

Release Notes:

- Fixed the double-click action on the terminal tab bar opening a new
buffer instead of a new terminal
([#9003](https://github.com/zed-industries/zed/issues/9003)).
2024-03-13 17:30:10 +02:00
Antonio Scandurra
fc9f84446a
Always stop propagation in div's scroll wheel listener (#9282)
Fixes #9274

This fixes a bug that was preventing the editor hover popovers from
being scrolled with the trackpad.

Release Notes:

- N/A
2024-03-13 15:48:22 +01:00
Kirill Bulatov
109482761b
Omit .git worktree indexing (#9281)
Closes https://github.com/zed-industries/zed/issues/9174

Release Notes:

- Fixed panics when `.git` was opened as a Zed worktree
([9174](https://github.com/zed-industries/zed/issues/9174))
2024-03-13 16:35:44 +02:00
Kirill Bulatov
572ba3f93b
Fall back to FindAllReferences if cmd-click did not preform GoToDefinition elsewhere (#9243) 2024-03-13 13:00:04 +02:00
Piotr Osiewicz
427d66990c
gpui: Do not emit MouseUpEvent when exiting drag & drop (#9273)
Fixes #9198

Release Notes:

- Fixed a bug where empty panes could be created during drag & drop.
2024-03-13 11:37:34 +01:00
Thorsten Ball
ac4bbb6135
Correctly re-render mouse cursor when hovering over pane group divider (#9270)
Before this change, the hitbox felt one-sided because the cursor didn't
consistently change into the drag-handle cursor.

The reason was that we didn't trigger a redraw on hover, so we'd only
change the cursor if we detected hover AND something else caused a
redraw.

Release Notes:

- Fixed the pane resize handler not consistently triggering on mouse
hover.

Co-authored-by: Antonio <antonio@zed.dev>
2024-03-13 10:57:10 +01:00
Thorsten Ball
754df9356d
Fix segfault when dropping MacWindow (#9267)
This avoids calling `window.setDelegate(nil)` when the window was
already closed.

Release Notes:

- Fixed a segfault that could show up when closing windows.

Co-authored-by: Antonio <antonio@zed.dev>
2024-03-13 10:41:25 +01:00
Thorsten Ball
3c28282108
Redraw when toggling between windows (#9236)
Before this change we didn't consistently trigger focus events when
toggling between with windows `Cmd-backtick`. We only triggered them
when the OS decided to trigger a redraw.

That lead to a nasty bug that showed up in Vim mode where a cursor would
still be active in the hidden window, even though it was deactivated.

One then had to manually try to trigger a focus event in the new window
to activate the cursor.

With this change, we call `cx.refresh` when the window activation status
changed which triggers focus events consistently and fixes this bug.

With logging we can observe this:

**BEFORE**:


https://github.com/zed-industries/zed/assets/1185253/e1ad8878-129c-44ba-9d8b-c720f9dca5b6


**AFTER**:


https://github.com/zed-industries/zed/assets/1185253/733fdadb-d1ea-47fe-a2c1-7b50af299cc0


Release Notes:

- Fixed focus not being consistently changed when switching between
multiple Zed windows via `Cmd-backtick`.

---------

Co-authored-by: Manu Raj <git@manuraj.dev>
Co-authored-by: Antonio <antonio@zed.dev>
2024-03-13 10:15:22 +01:00
Rajesh Malviya
80b80dfa78
gpui: Switch to x11rb (#9113)
Switch to using `x11rb` crate instead of current `xcb` crate for gpui's
x11 platform.

Also fixes the crash on resize, and white flashing on resize.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-12 21:47:08 -07:00
Joseph T. Lyons
47afc70979
Update Lua config.toml (#9260)
Release Notes:

- Added autoclosing of `(` and `'` in Lua.
2024-03-13 00:32:45 -04:00
Conrad Irwin
646f69583a
Allow opening non-extant files (#9256)
Fixes #7400



Release Notes:

- Improved the `zed` command to not create files until you save them in
the editor ([#7400](https://github.com/zed-industries/zed/issues/7400)).
2024-03-12 22:30:04 -06:00
Mikayla Maki
e792c1a5c5
Open new windows with a default size and position (#9204)
This PR changes GPUI to open windows with a default size and location,
and to otherwise inherit from their spawning window.

Note: The linux build now crashes on startup.

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Ezekiel Warren <zaucy@users.noreply.github.com>
2024-03-12 21:19:51 -07:00
张小白
9a2dceeea1
windows: Support dropping targets with filenames longer than 260 characters (#9115)
use `Vec` instead of slice to support dynamic filename length.

Release Notes:
- N/A
2024-03-12 21:19:31 -07:00
Bennet Bo Fenner
fb83cf2042
notification panel: rework time formatting (#8997)
Follow up of #7994 to rework the notification panel timestamps.
This PR also includes some of the changes @evrsen proposed in #8996 
Here is what it looks like now:


https://github.com/zed-industries/zed/assets/53836821/d85450e7-eab6-4fe7-bd11-1d76c0e87258

Release Notes:
- Reworked date time formatting in the chat and the notification panel
- Added hover style to notifications and hovering tooltip on timestamps

---------

Co-authored-by: Evren Sen <146845123+evrsen@users.noreply.github.com>
2024-03-12 21:02:04 -06:00
bbb651
a105b5f215
Wayland: Remove bogus wl_surface::commits on resize (with integer scaling) (#9245)
Release Notes:
- N/A

This prevents a crash on sway (on older versions without fractional
scaling). This means the resize is delayed until the next this we
present a frame, we need to investigate if this is the correct this to
do.
2024-03-12 19:46:18 -07:00
Piotr Osiewicz
aeb2a98058
chore: Move new util deps to workspace level (#9250)
I've missed a comment from @maxdeviant on #9247 before hitting merge;
mea culpa

Release Notes:

- N/A
2024-03-13 00:37:10 +01:00
Piotr Osiewicz
34f09bae4f
chore: Clean up util dependencies. (#9247)
This allows this crate to start building sooner + it reduces our total
build graph size by 13 units (1104 -> 1091).

Release Notes:

- N.A
2024-03-13 00:10:49 +01:00
Kirill Bulatov
c09fe1ce8a
Do not allow concurrent FindAllReferences requests for the same multibuffer anchors (#9242)
FindAllReferences LSP requests might take a long time to complete, and
currently Zed allows multiple requests spawned concurrently for the same
Anchor in the multi buffer. That results in multiple search results'
multi buffers appearing, sometimes at once, which is not what we want.

Part of https://github.com/zed-industries/zed/issues/5351 that helps to
reduce the amount of search results after clicks that did not resolve
instantly.


Release Notes:

- Improved FindAllReferences action by not allowing concurrent requests
for the same multi buffer source
2024-03-12 23:02:34 +02:00
Max Brunsfeld
64219ba49f
When fetching extensions from blob store, don't halt on invalid extensions. (#9241)
This fixes an error where we were failing to sync extensions from the
blob store because of the presence of one invalid extensions
(`gentle-dark`), which was missing the `authors` field in its manifest.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-03-12 16:36:40 -04:00
Conrad Irwin
05dfe96f0c
Add --add/--new to control CLI behaviour (#9202)
When neither is specified, if you open a directory you get a new
workspace, otherwise files are added to your existing workspace.

With --new files are always opened in a new workspace
With --add directories are always added to an existing workspace

Fixes #9076
Fixes #4861
Fixes #5370

Release Notes:

- Added `-n/--new` and `-a/--add` to the zed CLI. When neither is
specified, if you open a directory you get a new workspace, otherwise
files are added to your existing workspace. With `--new` files are
always opened in a new workspace, with `--add` directories are always
added to an existing workspace.
([#9076](https://github.com/zed-industries/zed/issues/9096),
[#4861](https://github.com/zed-industries/zed/issues/4861),
[#5370](https://github.com/zed-industries/zed/issues/5370)).
2024-03-12 14:27:58 -06:00
dalton-oliveira
41d8ba12ec
Remove wezterm fork from dependencie (#8998)
Improves build time by removing wezterm dependency
([#8604](https://github.com/zed-industries/zed/issues/8604)).

Release Notes:

- N/A
2024-03-12 21:27:40 +02:00
Antonio Scandurra
e7289c385d
Correctly show the shift icon for keybindings on macOS (#9235)
Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-03-12 18:27:24 +01:00
Thorsten Ball
8c87b349dc
Show formatting failure (#9229)
This fixes #8072 and #9061 by surfacing formatting errors in the
activity indicator.

It shows a message in the activity indicator if the last attempt
to format a buffer failed.

It only keeps track of the last attempt, so any further formatting
that succeeds will reset or update the error message.

I chose to only keep track of that, because everything else (keeping
track of formatting state per buffer, per project, per worktree) seems
complicated with little benefit, since we'd have to keep track of that
state, update it, clean it, etc.

We can still do that should we decide that we need to keep track
of the state on a per-buffer basis, but I think for now this is a
good, simple solution.

This also changes the `OpenLog` action to scroll to the end of the
buffer
and to not mark the buffer as dirty.


Release Notes:

- Added message to activity indicator if last attempt to format a buffer
failed. Message will get reset when next formatting succeeds. Clicking
on message opens log with more information.
([#8072](https://github.com/zed-industries/zed/issues/8072) and
[#9061](https://github.com/zed-industries/zed/issues/9061)).
- Changed `zed: Open Log` action to not mark the opened log file as
dirty and to always scroll to the bottom of the log.


https://github.com/zed-industries/zed/assets/1185253/951fb9ac-8b8b-483a-a46d-712e52878a4d
2024-03-12 16:30:08 +01:00
Antonio Scandurra
39a0841ea8
Center dock resize handle hitboxes (#9225)
Also, add a `deferred` function which takes an element to paint after
the current element tree.

Release Notes:

- Improved the size and position of the hitbox for resizing left, right,
and bottom panels.
([#8855](https://github.com/zed-industries/zed/issues/8855))

Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
2024-03-12 15:42:18 +01:00
Antonio Scandurra
409aa513d4
Fix mouse interactions with the project and branch switchers (#9222)
Previously, we were considering the mouse to be "out" of a div when its
hitbox wasn't hovered. However, if a parent listened for
"mouse_down_out" and a child occluded the parent, the parent would
always think the mouse was out even when the user clicked the child.

This commit changes the definition of "mouse out" to simply mean "does
not contain the point", without accounting for occlusion.

Release Notes:

- N/A

Co-authored-by: Julia <julia@zed.dev>
2024-03-12 15:30:27 +01:00
Antonio Scandurra
d5796dc5eb
Show only prefix/suffix if there are more than 12 breadcrumbs (#9220)
Fixes https://github.com/zed-industries/zed/issues/9079

This should fix the arena panic we were observing. I saw that breadcrumb
rendering was on the stack trace for some of the panics, so my suspicion
is that it's being caused by some people navigating into deeply nested
files.

Release Notes:

- Fixed a panic that could occur when displaying too many breadcrumbs.
([#9079](https://github.com/zed-industries/zed/issues/9079))
2024-03-12 14:33:12 +01:00