Commit Graph

1693 Commits

Author SHA1 Message Date
Marshall Bowers
2f876471a1
Enable clippy::extra_unused_lifetimes (#8754)
This PR enables the
[`clippy::extra_unused_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/extra_unused_lifetimes)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 22:43:00 -05:00
Marshall Bowers
659974411d
Enable clippy::explicit_auto_deref (#8753)
This PR enables the
[`clippy::explicit_auto_deref`](https://rust-lang.github.io/rust-clippy/master/index.html#/explicit_auto_deref)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 22:30:18 -05:00
Marshall Bowers
ea68f86476
Enable clippy::option_map_unit_fn (#8751)
This PR enables the
[`clippy::option_map_unit_fn`](https://rust-lang.github.io/rust-clippy/master/index.html#/option_map_unit_fn)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 22:08:37 -05:00
Marshall Bowers
008c5053e6
Enable clippy::unit_arg (#8742)
This PR enables the
[`clippy::unit_arg`](https://rust-lang.github.io/rust-clippy/master/index.html#/unit_arg)
rule and suppresses the false positive that it flags.

Release Notes:

- N/A
2024-03-02 20:59:41 -05:00
Marshall Bowers
9735912965
Enable clippy::clone_on_copy (#8728)
This PR enables the
[`clippy::clone_on_copy`](https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_copy)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 17:37:48 -05:00
Marshall Bowers
5935681c5c
Enable clippy::single_char_pattern (#8727)
This PR enables the
[`clippy::single_char_pattern`](https://rust-lang.github.io/rust-clippy/master/index.html#/single_char_pattern)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 17:04:59 -05:00
Marshall Bowers
bf666af3a2
Deny all Clippy warnings (#8720)
This PR makes Clippy deny all warnings across the workspace.

We now enumerate all of the rules that have violations and temporarily
allow them, with the goal being to drive the list down over time.

On Windows we don't yet use `--deny warnings`, as the Windows build
still has some warnings.

Release Notes:

- N/A
2024-03-02 15:51:01 -05:00
Tommi Pisto
5de7492146
Add flex_wrap_* and content_* to GPUI (#8710)
Now with GPUI you can auto-layout something like this:

<img width="560" alt="Screenshot 2024-03-02 at 13 56 50"
src="https://github.com/zed-industries/zed/assets/226244/8ec4b683-dd7d-41f8-8b09-4be66ecec9a0">
2024-03-02 11:29:44 -05:00
Liam Murphy
0903062933
Fix unsafe precondition violation when building with nightly rustc (#8691)
Fixes #8658

Release Notes:

- N/A
2024-03-02 08:01:44 +01:00
Marshall Bowers
ca2cda8d2a
Remove unneeded 'static lifetimes on &strs in constants (#8698)
This PR removes unneeded `'static` lifetimes on `&str`s stored in
`const` declarations.

This addresses some Clippy lints about
[`redundant_static_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_static_lifetimes).

In item-level `const` declarations we can rely on lifetime elision and
use the default `'static` lifetime.

Note that associated constants still require an explicit `'static`
lifetime, as explained in
https://github.com/rust-lang/rust/issues/115010.

Release Notes:

- N/A
2024-03-02 00:40:49 -05:00
Brian Donovan
a84a3c0ebe
docs: Fix "it's" typos that should be "its" (#8690)
These all meant to use the possessive "its" rather than the contraction
of "it is".
2024-03-01 20:32:27 -05:00
Dzmitry Malyshau
26103e8bb9
Clean up and refactor X11 refresh loop (alternative) (#8655)
Associates every window with its own refresh event. Removes the use of
X11 present.
Alternative to #8592.
Instead of doing the rendering on idle and then involving a hack for
polling X11 events, this PR just tries to do the rendering inside the
main loop. This guarantees that we continue to poll for events after the
draw, and not get screwed by the driver talking to X11 via the same file
descriptor.

Release Notes:
- N/A
2024-03-01 16:43:24 -08:00
Nathan Sobo
4cc4f08a53
Remove ! from todo!() in comments (#8643)
This practice makes it difficult to locate todo!s in my code when I'm
working. Let's take out the bang if we want to keep doing this.

Release Notes:

- N/A
2024-02-29 18:19:05 -07:00
Conrad Irwin
9bd5ebb74b
Revert "Introduce a new ToggleGraphicsProfiler command (#7607)" (#8567)
This reverts commit 0cebf68306.

Although this thing is very cool, it is a top source of crashes.

Example crash:
```
Segmentation fault: 11 on thread 26
  objc_retain +16
  invocation function for block in Overlay::onCommandBufferCommit(id<MTLCommandBuffer>) +60
  MTLDispatchListApply +52
```

Release Notes:

- Removed "Toggle Graphics Profiler" as it crashes too much.
2024-02-28 16:39:51 -07:00
Rom Grk
7f954cbbb8
linux: improve key translation (#8560)
This PR brings linux XKB key translation more in line with the macOS
logic, which fixes quite a few key bindings.
2024-02-28 15:13:02 -08:00
Roman
b76e0d997e
Linux: Rewrite the event loop using calloop (#8314)
This PR unifies the event loop code for Wayland and X11. On Wayland,
blocking dispatch is now used. On X11, the invisible window is no longer
needed.

Release Notes:

- N/A

---------

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
Co-authored-by: Tadeo Kondrak <me@tadeo.ca>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: julia <julia@zed.dev>
2024-02-28 14:59:11 -08:00
Conrad Irwin
014e6f66bb
gpui: Don't impl IntoElement on () (#8555)
Although it's kinda cute, rust makes it too easy to accidentally return
() from a function.

/cc @nathansobo

Release Notes:

- N/A
2024-02-28 15:19:05 -07:00
Antonio Scandurra
57f5f128f3
Fix flickering cursor style when a pane was zoomed (#8546)
Release Notes:

- N/A

Co-authored-by: Max Brunsfeld <max@zed.dev>
2024-02-28 18:50:48 +01:00
Antonio Scandurra
7aba9eb4b7
Introduce a short-term solution for flickering (#8542)
This uses bounds checking alone to determine hover state to avoid
flicker. It's a short-term solution because the rendering is incorrect.
We think this is better than flickering though and buys us some time as
we work on a more robust solution overall.

Release Notes:

- Fixed flickering when hovering.

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-02-28 17:57:20 +01:00
Kirill Bulatov
a0c8debd35
Mention possible run options in the task modal placeholder (#8449)
Release Notes:

- Improved run task modal's placeholder

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-02-27 00:04:56 +02:00
Julia
d4584a10b6
Tell Wayland compositor we can handle keyboard ver 4 for repeat info (#8446)
Fixes us not getting Wayland key repeat info from the compositor

Release Notes:

- N/A
2024-02-26 15:13:01 -05:00
Dzmitry Malyshau
a44fc24445
Clean up many small dependencies (part 3) (#8425)
Follow-up to #8353

Release Notes:
- N/A
2024-02-26 11:08:57 +02:00
Marshall Bowers
d8276b0f0d
Hoist itertools dependency to workspace level (#8417)
This PR hoists the `itertools` dependency to the workspace level.

Release Notes:

- N/A
2024-02-25 20:37:52 -05:00
Bennet Bo Fenner
934af6ad45
recent projects: fix list flashing/empty (#8376)
If the list is large (size > overdraw + available height) the
`all_rendered` check was preventing the list from returning an inferred
size. Theoretically we can now report heights which are actually too
small (because not all items were affected during layout), this can be
manually adjusted using the overdraw parameter. In this case its fine
because the picker is inside a max_height which should never be more
then the overdraw we specify (1000 px), and the list will shrink down
either way when the request_measured_layout callback is called again.

Release Notes:

- Fixed flashing of recent projects list when there were a lot of
projects in the list
([#8364](https://github.com/zed-industries/zed/issues/8364#issuecomment-1962849393)).
2024-02-25 17:22:01 +02:00
Dzmitry Malyshau
d895388809 linux: profile text system functions 2024-02-24 00:04:00 -08:00
Bennet Bo Fenner
dc7e14f888
Respect user preferences when formatting timestamp (#7994)
This is a follow up to #7945. The current behaviour reads the locale and
infers from that which type of time format should be used (12 hour/24
hour).
However, in macOS you can override this behaviour, e.g. you can use
en_US locale but still use the 24 hour clock format (Can be customized
under Settings > General > Date & Format > 24-hour time). You can even
customize the date format.

This PR uses the macOS specific `CFDateFormatter` API, which outputs
time format strings, that respect those settings.

Partially fixes #7956 (as its not implemented for linux)

Release Notes:

- Added localization support for all macOS specific date and time
configurations in chat
2024-02-23 19:18:06 -07:00
Paul Berg
9b44ba9382
linux/text: fix invalid span creation (#8286)
This fixes a crash when showing completions.

Release Notes:

- N/A
2024-02-23 17:03:00 -08:00
白山風露
aef299be3d
CI: Enable clippy on Windows (#8240)
Release Notes:

- N/A
2024-02-23 16:23:42 -08:00
Dzmitry Malyshau
885ae2d863
linux/x11: prioritize input in the event loop (#8253)
With this change, interaction with Zed is actually real-time and usable
🚀 🎉

The gist of it is - trying to process all of the input events before
rendering anything.

Release Notes:
- N/A

**Note**: this can be further improved in a follow-up.
Currently, once the input and runnables are processed, we'd try to draw
+ render a frame.
Presentation starts with acquiring a new frame. We currently have FIFO
presentation method, so acquiring a frame is blocking on that swapchain
image to become available. As the result, presentation takes around 16
ms, most of which is just busy wait.
Ideally, we'd be able to process more input in this time frame, instead.

**Note2**: it's a bit laggy in Debug for me, but that's just because of
the extra-long `draw` times, which is unrelated to rendering (or
platform support, for the matter). I'm curious how come on MacOS the
`draw()` times in Debug are more modest.
2024-02-23 16:22:54 -08:00
Rom Grk
008d99d206
Wayland: implement key repeat (#8038)
Wayland requires the client to implement key repetition. This PR
implements the functionality as it's supposed to, but I don't see the
`repeat_info` event come in so the feature uses the default values (but
my system is configured for a much smaller `delay` and a much faster
`rate`). But this is good enough for now.

https://wayland-book.com/seat/keyboard.html#key-repeat


[Kooha-2024-02-20-20-42-12.webm](https://github.com/zed-industries/zed/assets/1423607/fb9fc327-efb7-43d1-9b53-1f8a3d9ba608)
2024-02-23 12:48:27 -05:00
Conrad Irwin
3bc7cd66b7
Allow typing space in workspace::SendKeystrokes (#8288)
Fixes #8222

Release Notes:

- N/A
2024-02-23 10:40:12 -07:00
Dzmitry Malyshau
991c9ec441
Integrate profiling into gpui (#8176)
[Profiling](https://crates.io/crates/profiling) crate allows easy
integration with various profiler tools. The best thing is - annotations
compile to nothing unless you request a specific feature.

For example, I used this command to enable Tracy support:
```bash
cargo run --features profiling/profile-with-tracy
```
At the same time I had Tracy tool open and waiting for connection. It
gathered nice stats from the run:

![zed-profiler](https://github.com/zed-industries/zed/assets/107301/5233045d-078c-4ad8-8b00-7ae55cf94ebb)


Release Notes:
- N/A
2024-02-22 10:59:52 -08:00
Rom Grk
bd94a0e921
Wayland: implement focus events (#8170)
Implements keyboard focus in/out events.

This also enables vim mode to work on wayland, which is only activated
when an editor gains focus.
2024-02-22 09:51:09 -08:00
apricotbucket28
40bbd0031d
linux: fix reveal_path for files (#8162)
Fixes 'Reveal in Finder' opening files instead of showing them in the
file explorer.
Tested on Fedora KDE 39.

Release Notes:

- N/A
2024-02-22 09:49:36 -08:00
Rom Grk
946f4a312a
Wayland: avoid replacing text with empty string (#8103)
Fix an issue where the `ime_key` is sometimes an empty string, and
pressing a keystroke replaces the selected text.

E.g. select some text, press `Escape`: selected text is deleted.
2024-02-22 09:48:15 -08:00
Xinzhao Xu
36586b77ec
gpui: use a separate image in the image example and remove unnecessary examples (#8181)
Follow-up of https://github.com/zed-industries/zed/pull/8174#issuecomment-1959031659,
Fixes image example and removes window-less "noop" example.

<img width="1975" alt="Screenshot 2024-02-22 at 17 34 15"
src="https://github.com/zed-industries/zed/assets/9134003/060d8484-63b6-415a-9f06-189542422457">

Release Notes:
- N/A
2024-02-22 11:47:24 +02:00
Xinzhao Xu
6f36527bc6
gpui: add example sections in Cargo.toml (#8174)
So that we can run the example simply by `cargo run --example hello_world`

Release Notes:
- N/A
2024-02-22 11:18:34 +02:00
Dzmitry Malyshau
9fcda5a5ac
blade: quad render fast path (#8110)
Ported from #7231

Release Notes:
- N/A
2024-02-21 10:04:24 -08:00
Joseph T. Lyons
92b2e5608b
Fix crash when closing last zed window (#8102)
Fixes: #8100

Release Notes:

- N/A
2024-02-21 00:48:42 -05:00
gmorenz
cd640a87a9
Improve key handling on x11, sharing wayland implementation (#8094)
Makes keyboard shortcuts work on x11.

Release Notes:

- N/A
2024-02-20 16:04:52 -08:00
Kirill Bulatov
c97ecc7326
Add initial CI job for Windows target (#8088)
Clippy is disabled for now, due to many warnings in both `gpui` and
other code, see
https://github.com/zed-industries/zed/actions/runs/7980269779/job/21789529800
for more details.

Also, due to `#!/usr/bin/env bash` shebang in the `script/clippy`, it
starts in Windows CI with `shell: C:\Program Files\Git\bin\bash.EXE
-euxo pipefail {0}`

https://github.com/zed-industries/zed/actions/runs/7980269779/job/21789529800#step:4:3
It seems more appropriate to use PowerShell instead.

See `todo!("windows")` for all stubbed places currently.

Release Notes:

- N/A
2024-02-21 00:35:29 +02:00
N
8a73bc4c7d
Vim: enable sending multiple keystrokes from custom keybinding (#7965)
Release Notes:

- Added `workspace::SendKeystrokes` to enable mapping from one key to a
sequence of others
([#7033](https://github.com/zed-industries/zed/issues/7033)).

Improves #7033. Big thank you to @ConradIrwin who did most of the heavy
lifting on this one.

This PR allows the user to send multiple keystrokes via custom
keybinding. For example, the following keybinding would go down four
lines and then right four characters.

```json
[
  {
    "context": "Editor && VimControl && !VimWaiting && !menu",
    "bindings": {
      "g z": [
        "workspace::SendKeystrokes",
        "j j j j l l l l"
      ],
    }
  }
]
```

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-02-20 15:01:45 -07:00
Gabriel Dinner-David
389d26d974
Linux(Wayland): translate enter and pageup/down from keysym (#8089)
enter and pagedown/pageup weren't working now they do
Release Notes:
- N/A
2024-02-20 13:48:14 -08:00
Conrad Irwin
3d9503a454
Fix cx.windows() to return borrowed windows (#8086)
Fixes #8068

Release Notes:

- Fixed an error message when joining a project twice
([#8068](https://github.com/zed-industries/zed/issues/8068)).
2024-02-20 13:42:11 -07:00
Dzmitry Malyshau
b028231aea
linux/x11: disable Vulkan validation in Debug (#8044)
Turns out this validation requirement is confusing new users.

Release Notes:
- N/A
2024-02-20 11:14:13 -08:00
Dzmitry Malyshau
d51a0b60be
linux/x11: send XCB requests asynchronously (#8045)
With `send_and_check_request` we'd be blocking both the main loop and
the caller. `send_request` is only going to be blocking on the main loop
when processing the request.

Release Notes:
- N/A

Based on a flamegraph from `perf`/`hotspot`, we are spending 40% of time
redrawing, another 40% of time downloading stuff (i.e. rust toolchain),
and the rest on text rendering, layout and such. This is with Vulkan
Validation (see https://github.com/zed-industries/zed/pull/8044).

I'm also wondering if it would be better with #7758, but regardless we
should have no problem rendering at 60-120 fps and processing user
input. More follow-ups are expected here.
2024-02-20 10:20:49 -08:00
bbb651
0422d43798
Linux: Add support for MouseButton::Navigate in GPUI (wayland and x11) (#7996)
Release Notes:

- N/A

Based on wgpu implementation (which I wrote).

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-02-19 18:09:53 -08:00
Dzmitry Malyshau
b00b65b330
linux/x11: implement window focus (#8002)
Release Notes:
- N/A
2024-02-19 17:54:54 -08:00
Janrupf
fddb778e5f
Enable server side decorations on wayland (#8037)
This PR enables server side decorations on Wayland if possible. This is
stopgap solution, so that the window can be moved, resized and dragged
on Wayland sessions at all.


![image](https://github.com/zed-industries/zed/assets/25827180/3dc9af53-76c0-4664-8746-ed6a6e5eafe7)

Since Wayland compositors can decide to force either mode (as in,
forcing server or client side decorations), this requires additional
handling in zed. Since zed doesn't provide any of that handling as of
now, as a temporary solution server side decorations are always
requested.
2024-02-19 17:53:31 -08:00
Thorsten Ball
0a5df7d597
Fix jk not working in Vim bindings (#8023)
Fixes #8006.

Release Notes:

- Fixed two-character bindings in Vim insert mode (e.g. `j k` or `j j`)
not working.
([#8006](https://github.com/zed-industries/zed/issues/8006))

Co-authored-by: Conrad <conrad@zed.dev>
2024-02-19 10:21:07 -07:00