36cbfbf
windows: Better keyboard input support (#9180)
Click to expand commit body
### 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
张小白
created
2abb5ae
Fix crash when launching `Zed.exe` directly from `target/debug` dir (#9112)
Click to expand commit body
As I described in #9111 , the PR fixs this crash.
Release Notes:
- N/A
张小白
created
a56a260
Add ability to specify binary path/args for rust-analyzer (#9293)
Click to expand commit body
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>
724c19a
Add a setting for custom associations between languages and files (#9290)
Click to expand commit body
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>
Max Brunsfeld
and
Marshall
created
77de568
Allow setting a channel for new users to auto-join (#9291)
Click to expand commit body
Release Notes:
- Automatically add new users to the #zed channel
Conrad Irwin
created
88e33a1
Account for all hover heights & prevent un-hover between popovers (#9257)
Click to expand commit body
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>
Julia
and
Antonio Scandurra
created
139bb32
Automatically reset cursor style when hit test changes (#9289)
6286d86
Set the correct dispatch action for the double-click handler for the pane tab bar (#9221)
Click to expand commit body
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)).
Igal Tabachnik
created
fc9f844
Always stop propagation in div's scroll wheel listener (#9282)
Click to expand commit body
Fixes #9274
This fixes a bug that was preventing the editor hover popovers from
being scrolled with the trackpad.
Release Notes:
- N/A
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))
Kirill Bulatov
created
572ba3f
Fall back to FindAllReferences if cmd-click did not preform GoToDefinition elsewhere (#9243)
Kirill Bulatov
created
427d669
gpui: Do not emit MouseUpEvent when exiting drag & drop (#9273)
Click to expand commit body
Fixes #9198
Release Notes:
- Fixed a bug where empty panes could be created during drag & drop.
Piotr Osiewicz
created
ac4bbb6
Correctly re-render mouse cursor when hovering over pane group divider (#9270)
Click to expand commit body
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>
Thorsten Ball
and
Antonio
created
754df93
Fix segfault when dropping MacWindow (#9267)
Click to expand commit body
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>
Thorsten Ball
and
Antonio
created
3c28282
Redraw when toggling between windows (#9236)
Click to expand commit body
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>
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>
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)).
Conrad Irwin
created
e792c1a
Open new windows with a default size and position (#9204)
Click to expand commit body
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>
Mikayla Maki
,
Nathan
, and
Ezekiel Warren
created
9a2dcee
windows: Support dropping targets with filenames longer than 260 characters (#9115)
Click to expand commit body
use `Vec` instead of slice to support dynamic filename length.
Release Notes:
- N/A
张小白
created
fb83cf2
notification panel: rework time formatting (#8997)
Click to expand commit body
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>
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.
bbb651
created
aeb2a98
chore: Move new util deps to workspace level (#9250)
Click to expand commit body
I've missed a comment from @maxdeviant on #9247 before hitting merge;
mea culpa
Release Notes:
- N/A
Piotr Osiewicz
created
34f09ba
chore: Clean up util dependencies. (#9247)
Click to expand commit body
This allows this crate to start building sooner + it reduces our total
build graph size by 13 units (1104 -> 1091).
Release Notes:
- N.A
Piotr Osiewicz
created
c09fe1c
Do not allow concurrent FindAllReferences requests for the same multibuffer anchors (#9242)
Click to expand commit body
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
Kirill Bulatov
created
64219ba
When fetching extensions from blob store, don't halt on invalid extensions. (#9241)
Click to expand commit body
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>
Max Brunsfeld
and
Marshall
created
05dfe96
Add --add/--new to control CLI behaviour (#9202)
Click to expand commit body
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)).
Conrad Irwin
created
89c67fb
Fix typos in default `settings.json` (#9239)
Click to expand commit body
This PR fixes some typos in the comments within the default
`settings.json` file.
Fixes #4257.
Release Notes:
- Fixed some incorrect comments in the default `settings.json` file
([#4257](https://github.com/zed-industries/zed/issues/4257)).
Marshall Bowers
created
41d8ba1
Remove wezterm fork from dependencie (#8998)
Click to expand commit body
Improves build time by removing wezterm dependency
([#8604](https://github.com/zed-industries/zed/issues/8604)).
Release Notes:
- N/A
dalton-oliveira
created
e7289c3
Correctly show the `shift` icon for keybindings on macOS (#9235)
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
Thorsten Ball
created
39a0841
Center dock resize handle hitboxes (#9225)
Click to expand commit body
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>
Antonio Scandurra
,
Julia
, and
Nathan
created
409aa51
Fix mouse interactions with the project and branch switchers (#9222)
Click to expand commit body
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>
Antonio Scandurra
and
Julia
created
d5796dc
Show only prefix/suffix if there are more than 12 breadcrumbs (#9220)
Click to expand commit body
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))
Antonio Scandurra
created
9f39694
Improve error messages when fetching single GitHub release (#9219)
Click to expand commit body
Release Notes:
- N/A
Thorsten Ball
created
e103607
copilot: Track focus of modal + close modal on ESC (#9217)
Click to expand commit body
I've also made Copilot's modal regain focus whenever you click on it, as
otherwise there's nothing inside of it that can gain focus. Clicks do
not fall through a modal, which I think is nice.
Release Notes:
- Fixed the issue where pressing ESC (`menu::Cancel`) did not exit the
Copilot modal. Fixes #8852
Piotr Osiewicz
created
0a34126
Insert hitbox when an interactive element can be scrolled (#9216)

Release Notes:
- Added syntax highlighting to code blocks in markdown preview
- Fixed scroll position in markdown preview when editing a markdown file
(#9208)
Bennet Bo Fenner
created
e5bd9f1
Fix prettier plugins does not seem to be picked up (#9193)
Click to expand commit body
This fixed the issue that prettier plugins were not picked up. The old
code would always send an empty array to the prettier plugin that
happens inside the `prettier_server.js`.
**Before**
The `options.plugins` key is an empty array, which is not correct.
```log
stderr: Resolved config: {"singleQuote":true,"trailingComma":"all","plugins":["prettier-plugin-organize-imports"]}, will format file '/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx' with options: {"singleQuote":true,"trailingComma":"all","plugins":[],"parser":"typescript","path":"/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx"}
```
https://github.com/zed-industries/zed/assets/62463826/52f2aad0-2f96-43a9-81ec-9d4630c495b2
**After**
The `options.plugins` contains the `prettier-plugin-organize-imports`
plugin as expected.
```log
stderr: Resolved config: {"singleQuote":true,"trailingComma":"all","plugins":["prettier-plugin-organize-imports"]}, will format file '/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx' with options: {"singleQuote":true,"trailingComma":"all","plugins":["prettier-plugin-organize-imports"],"parser":"typescript","path":"/Users/remcosmits/Documents/code/prettier-test/src/app/page.tsx"}
```
https://github.com/zed-industries/zed/assets/62463826/9045028d-aeca-4df1-819c-01905d83216c
Release Notes:
- Fixed send plugins correctly to the prettier plugin
([#8841](https://github.com/zed-industries/zed/issues/8841)).
Remco Smits
created
98cf494
Fix broken ESLint by pinning to `2.2.20-Insiders` release (#9215)
Click to expand commit body
This fixes #9213 by pinning ESLint to `2.2.20-Insiders` which is the
last known version to work well with Zed.
Once this fix is out, we can take a closer look at upgrading to 2.4.x or
even 3.x once that's out of prerelease.
Release Notes:
- Fixed ESLint integration being broken after Mar 7 2024 due to ESLint
3.0.1 alpha release being pushed.
([#9213](https://github.com/zed-industries/zed/issues/9213)).
Thorsten Ball
created
3be1402
Fix the double click and update the default settings (#9214)
Kirill Bulatov
created
44adb0a
Detect URLs at beginning and end of buffer as well (#9212)
Click to expand commit body
Release Notes:
- Fixed URL detection at very beginning and very end of buffer
([#9210](https://github.com/zed-industries/zed/issues/9210)).
| Before | After |
| ------ | ----- |
| 
| 
|
Ivan Žužak
created
14a0d80
ui: Center `Checkbox` within its container (#9201)
Click to expand commit body
This PR fixes an issue with the `Checkbox` component where the checkbox
wasn't being centered within its container element.
The problem can be seen when applying a background color to the
container element:
#### Before
<img width="439" alt="Screenshot 2024-03-11 at 5 44 10 PM"
src="https://github.com/zed-industries/zed/assets/1486634/11704b1a-3c3e-4250-99c3-973fb442287a">
#### After
<img width="447" alt="Screenshot 2024-03-11 at 5 45 59 PM"
src="https://github.com/zed-industries/zed/assets/1486634/569a850b-4bd7-4711-8327-bf426fa5d265">
This resulted in issues where, under certain conditions, the checkbox
could get cut off, as seen in #8868.
Centering the checkbox fixes this issue:
<img width="305" alt="Screenshot 2024-03-11 at 5 51 00 PM"
src="https://github.com/zed-industries/zed/assets/1486634/14e5642f-59ad-4288-bc25-ea7da2a008a7">
Fixes #8868.
Release Notes:
- Fixed a positioning issue with checkboxes
([#8868](https://github.com/zed-industries/zed/issues/8868)).
This PR insets the headers within `ContextMenu`s to give them some more
breathing room.
#### Before
<img width="347" alt="Screenshot 2024-03-11 at 4 13 31 PM"
src="https://github.com/zed-industries/zed/assets/1486634/73a56d68-d40e-4396-b584-f443197b69d6">
#### After
<img width="354" alt="Screenshot 2024-03-11 at 4 12 43 PM"
src="https://github.com/zed-industries/zed/assets/1486634/44c12a07-0784-4c94-b194-245f5cf94b2b">
Release Notes:
- Added padding to headers in context menus.
Marshall Bowers
created
02dcdd0
Open excerpt on double click in multibuffer by default. (#9196)
Click to expand commit body
Closes https://github.com/zed-industries/zed/issues/5275
Double click with `alt` modifier pressed will do the regular word
selection.
Adds a setting to disable this behavior and instead select a word, as in
the regular buffer.
```
// What to do when multibuffer is double clicked in some of its excerpts
// (parts of singleton buffers).
// May take 2 values:
// 1. Behave as a regular buffer and select the whole word.
// "double_click_in_multibuffer": "select"
// 2. Open the excerpt clicked as a new buffer in the new tab (default).
// "double_click_in_multibuffer": "open",
// For the case of "open", regular selection behavior can be achieved by holding `alt` when double clicking.
"double_click_in_multibuffer": "open",
```
Release Notes:
- Made multibuffer to open excerpts in new tabs on double click by
default (changing settings or keeping alt restores the word selection
behavior). ([5275](https://github.com/zed-industries/zed/issues/5275))
Kirill Bulatov
created
25c471f
Render `+` separators for keybindings on non-macOS platforms (#9194)
Click to expand commit body
This PR adjusts the rendering of keybindings on non-macOS platforms to
have a `+` separator instead of just a blank space.
<img width="952" alt="Screenshot 2024-03-11 at 3 18 17 PM"
src="https://github.com/zed-industries/zed/assets/1486634/1573823d-4329-41f0-bef4-7a6c09f3e632">
<img width="584" alt="Screenshot 2024-03-11 at 3 16 25 PM"
src="https://github.com/zed-industries/zed/assets/1486634/aae41b22-dfde-40a6-9e0e-cee855522d3a">
Release Notes:
- N/A
Marshall Bowers
created
fe70a26
Fix relative glob patterns not working for language servers (#9179)
Click to expand commit body
If a language server would send us a glob pattern like `**/*.rb` or
`**/{package.json}` we'd end up ignoring it and never sending the
language server any notifications, because we try to `strip_prefix` the
projects absolute path from the pattern, BUT if that path is not in the
pattern, we'd return `None`.
This change fixes that.
Release Notes:
- Fixed language server glob patterns for file watching being ignored if
they were relative patterns.
Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Remco <djsmits12@gmail.com>