Commit Graph

59 Commits

Author SHA1 Message Date
Antonio Scandurra
4700d33728
Fix flickering (#9012)
See https://zed.dev/channel/gpui-536

Fixes https://github.com/zed-industries/zed/issues/9010
Fixes https://github.com/zed-industries/zed/issues/8883
Fixes https://github.com/zed-industries/zed/issues/8640
Fixes https://github.com/zed-industries/zed/issues/8598
Fixes https://github.com/zed-industries/zed/issues/8579
Fixes https://github.com/zed-industries/zed/issues/8363
Fixes https://github.com/zed-industries/zed/issues/8207


### Problem

After transitioning Zed to GPUI 2, we started noticing that interacting
with the mouse on many UI elements would lead to a pretty annoying
flicker. The main issue with the old approach was that hover state was
calculated based on the previous frame. That is, when computing whether
a given element was hovered in the current frame, we would use
information about the same element in the previous frame.

However, inspecting the previous frame tells us very little about what
should be hovered in the current frame, as elements in the current frame
may have changed significantly.

### Solution

This pull request's main contribution is the introduction of a new
`after_layout` phase when redrawing the window. The key idea is that
we'll give every element a chance to register a hitbox (see
`ElementContext::insert_hitbox`) before painting anything. Then, during
the `paint` phase, elements can determine whether they're the topmost
and draw their hover state accordingly.

We are also removing the ability to give an arbitrary z-index to
elements. Instead, we will follow the much simpler painter's algorithm.
That is, an element that gets painted after will be drawn on top of an
element that got painted earlier. Elements can still escape their
current "stacking context" by using the new `ElementContext::defer_draw`
method (see `Overlay` for an example). Elements drawn using this method
will still be logically considered as being children of their original
parent (for keybinding, focus and cache invalidation purposes) but their
layout and paint passes will be deferred until the currently-drawn
element is done.

With these changes we also reworked geometry batching within the
`Scene`. The new approach uses an AABB tree to determine geometry
occlusion, which allows the GPU to render non-overlapping geometry in
parallel.

### Performance

Performance is slightly better than on `main` even though this new
approach is more correct and we're maintaining an extra data structure
(the AABB tree).


![before_after](https://github.com/zed-industries/zed/assets/482957/c8120b07-1dbd-4776-834a-d040e569a71e)

Release Notes:

- Fixed a bug that was causing popovers to flicker.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Thorsten <thorsten@zed.dev>
2024-03-11 10:45:57 +01:00
Conrad Irwin
0b87be71e6
Make anchor_in_excerpt Optional (#8975)
We were seeing panics due to callers assuming they had valid
excerpt_ids, but that cannot easily be guaranteed across await points as
anyone may remove an excerpt.

Release Notes:

- Fixed a panic when hovering in a multibuffer
2024-03-06 18:55:36 -07:00
Marshall Bowers
4b81b15cad
Enable clippy::useless_conversion (#8724)
This PR enables the
[`clippy::useless_conversion`](https://rust-lang.github.io/rust-clippy/master/index.html#/useless_conversion)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 16:31:47 -05:00
Marshall Bowers
87efb75e53
Enable clippy::bind_instead_of_map (#8723)
This PR enables the
[`clippy::bind_instead_of_map`](https://rust-lang.github.io/rust-clippy/master/index.html#/bind_instead_of_map)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 16:10:34 -05:00
Kirill Bulatov
b7784d414a
When clicking the checkbox, toggle open the LSP trace logs (#8689)
Before this change, enabling LSP trace checkbox closed the panel and
toggled the server logs on.
Now, the newly enabled trace logs are shown instead.

Release Notes:

- Improved LSP logs checkbox behavior
2024-03-02 02:03:30 +02:00
Max Brunsfeld
268fa1cbaf
Add initial support for defining language server adapters in WebAssembly-based extensions (#8645)
This PR adds **internal** ability to run arbitrary language servers via
WebAssembly extensions. The functionality isn't exposed yet - we're just
landing this in this early state because there have been a lot of
changes to the `LspAdapter` trait, and other language server logic.

## Next steps

* Currently, wasm extensions can only define how to *install* and run a
language server, they can't yet implement the other LSP adapter methods,
such as formatting completion labels and workspace symbols.
* We don't have an automatic way to install or develop these types of
extensions
* We don't have a way to package these types of extensions in our
extensions repo, to make them available via our extensions API.
* The Rust extension API crate, `zed-extension-api` has not yet been
published to crates.io, because we still consider the API a work in
progress.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-03-01 16:00:55 -08:00
Conrad Irwin
778b6fb27b
Add OpenExcerptsSplit (#8574)
I would like to keep diagnostics open on one side, and process them on
the other.


Release Notes:

- Added `editor::OpenExcerptsSplit` (bound to `cmd-k enter`) to open the
selected excerpts in the adjacent pane
- vim: Added `ctrl-w d`, `ctrl-w shift-d` and `ctrl-w space` for
`editor::GoTo{,Type}Definition` and `editor::OpenExcerptsSplit`
2024-02-28 19:23:36 -07:00
Max Brunsfeld
6edeea7c8a
Add logic for managing language and theme extensions (#7467)
This PR adds the initial support for loading extensions in Zed.

### Extensions Directory

Extensions are loaded from the extensions directory.

The extensions directory has the following structure:

```
extensions/
  installed/
    extension-a/
      grammars/
      languages/
    extension-b/
      themes/
  manifest.json
```

The `manifest.json` file is used internally by Zed to keep track of
which extensions are installed. This file should be maintained
automatically, and shouldn't require any direct interaction with it.

Extensions can provide Tree-sitter grammars, languages, and themes.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-02-07 15:14:50 -05:00
Kirill Bulatov
944a1f8fb0
Send lsp_types::InitializeParams with Zed version (#7216)
Based on the great work in
https://github.com/zed-industries/zed/pull/7130 , now sends this data

```
[crates/lsp/src/lsp.rs:588] ClientInfo { name: name.to_string(), version: Some(version.to_string()) } = ClientInfo {
    name: "Zed Dev",
    version: Some(
        "0.122.0",
    ),
}
```

with every LSP server initialization.

Release Notes:

- Added Zed name and version to LSP InitializeParams requests
2024-02-01 18:39:28 +02:00
Marshall Bowers
ff76b2ec4d
Replace IIFE with maybe! (#6909)
This PR replaces a usage of an IIFE with `maybe!`.

Release Notes:

- N/A
2024-01-27 22:34:37 -05:00
Piotr Osiewicz
b5cb8323d4 lsp-log: Reemit Editors search events.
NextMatch/PreviousMatch did not work due to us not updating the match index in the buffer search (that relied on an event being emitted).
2024-01-22 14:02:48 +01:00
Max Brunsfeld
b65cf6d2d9 Merge branch 'main' into language-api-docs 2024-01-18 15:06:45 -08:00
Piotr Osiewicz
6cbc49e5f0
Editor docs (#4097)
Release Notes:

- N/A

---------

Co-authored-by: Kirill <kirill@zed.dev>
2024-01-18 00:48:37 +01:00
Joseph T. Lyons
ba9a9f4f17 Add more open events
project search
diagnostics
welcome page
2024-01-15 16:26:04 -05:00
Kirill Bulatov
92add99260 Add LSP logs into the end of the editor, not after its caret
Also prevent tabs from being added in readonly editors
2024-01-15 22:12:52 +02:00
Marshall Bowers
90f4c70a82
Rename h_stack and v_stack to h_flex and v_flex, respectively (#4053)
This PR renames the `h_stack` and `v_stack` to `h_flex` and `v_flex`,
respectively.

We were previously using `h_stack` and `v_stack` to match SwiftUI, but
`h_flex` and `v_flex` fit better with the web/flexbox terminology that
the rest of GPUI uses.

Additionally, we were already calling the utility functions used to
implement `h_stack` and `v_stack` by the new names.

Release Notes:

- N/A
2024-01-15 11:34:06 -05:00
Kirill Bulatov
253c8dbe8e Disable copilot for feedback and lsp log editors
LSP log editor caused recursive flood of messages, and feedback editor is better with people writing their own feedback.
2024-01-15 15:49:23 +02:00
Kirill Bulatov
c197ea49ca Simplify uniform list scrolling logic 2024-01-10 13:45:50 +02:00
Max Brunsfeld
b02f37083b More docs 2024-01-09 10:53:57 -08:00
Piotr Osiewicz
d475f1373a
gpui: Further docs refinement & moved some reexports into 'private' module (#3935)
This commit mostly fixes invalid URLs in docstrings. It also
encapsulates crates we reexport (serde stuff + linkme) into a public
module named "private" in order to reduce the API surfaced through docs.
Moreover, I fixed up a bunch of crates that were pulling serde_json in
through gpui explicitly instead of using Cargo manifest.

Release Notes:
- N/A
2024-01-07 14:14:21 +01:00
Kirill Bulatov
12b5dbff68 Fix current lsp logs menu item not shown as selected 2024-01-05 19:23:15 +02:00
Marshall Bowers
47476faef1
Fix label color for inactive tabs (#3899)
This PR fixes an issue where certain tabs were not using the correct
color for their labels when they were inactive.

Release Notes:

- Fixed an issue where some inactive tabs were not using the correct
label color.
2024-01-04 17:25:11 -05:00
Max Brunsfeld
0ac8aae17b Remove 2 suffix for language_tools, search, terminal_view, auto_update
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 10:52:40 -08:00
Kirill Bulatov
a95cce9a60 Reduce max log lines, clean log buffers better 2023-10-17 21:47:21 +03:00
Kirill Bulatov
08af830fd7 Do not create buffers for rpc logs 2023-10-17 21:43:34 +03:00
Kirill Bulatov
c872c86c4a Remove another needless log buffer 2023-10-17 21:43:34 +03:00
Kirill Bulatov
ba5c188630 Update editor with current buffer logs 2023-10-17 21:43:34 +03:00
Kirill Bulatov
5a4161d293 Do not detach subscriptions 2023-10-17 21:43:34 +03:00
Kirill Bulatov
33296802fb Add a rough prototype 2023-10-17 21:43:34 +03:00
Mikayla
a81484f13f
Update IDs on interactive elements in LSP log viewer 2023-10-17 02:22:34 -07:00
Mikayla Maki
591ec02cea
Add support for the experimental Next LS for Elixir (#3024)
This is a PR I built for a friend of a friend at StrangeLoop, who is
making a much better LSP for elixir that elixir folks want to experiment
with. This PR also improves the our debug log viewer to handle LSP
restarts.

TODO:
- [ ] Make sure NextLS binary loading works.

Release Notes:

- Added support for the experimental Next LS for Elxir, to enable it add
the following field to your settings to enable:

```json
"elixir": {
    "next": "on"
}
```
2023-09-25 12:52:56 -05:00
Mikayla
052cb459a6
Improve lsp log viewer's behavior in the presence of LSP restarts
Improve settings interface to local LSP
2023-09-24 04:59:55 -07:00
Kirill Bulatov
d61565d227 Do not resubscribe for Copilot logs events
Copilot sends multiple events about its LSP server readiness, not necessarily recreating the server from scratch (e.g. due to re-sign in action).
Avoid re-adding same log subscriptions on the same LSP server, which
causes panics.
2023-09-22 13:40:20 +03:00
Kirill Bulatov
ead7155b0f Make LSP panel scrollable
co-authored-by: Max <max@zed.dev>
2023-09-21 10:59:19 +03:00
Kirill Bulatov
82010b68c1 Avoid extra LSP log events 2023-09-20 11:27:52 +03:00
Kirill Bulatov
5e1b284846 Show supplementary language servers in the logs panel 2023-09-19 22:29:27 +03:00
Kirill Bulatov
91fac2aa76 Automatically subscribe for lsp logs of every server added
Avoid re-adding the server on new logs events.
2023-09-19 11:52:21 +03:00
Piotr Osiewicz
4cb8647702
Z 1200/replace in buffer (#2922)
This is still WIP, mostly pending styling. I added a pretty rudimentary
text field and no buttons whatsoever other than that. I am targeting a
Preview of 09.13, as I am gonna be on PTO for the next week.

I dislike the current implementation slightly because of `regex`'s crate
syntax and lack of support of backreferences. What strikes me as odd wrt
to syntax is that it will just replace a capture name with empty string
if that capture is missing from the regex. While this is perfectly fine
behaviour for conditionally-matched capture groups (e.g. `(foo)?`), I
think it should still error out if there's no group with a given name
(conditional or not).
Release Notes:

- Added "Replace" functionality to buffer search.
2023-09-12 18:46:54 +02:00
Kirill Bulatov
fe2300fdaa Style the clear button better, add border to button constructor options 2023-08-31 18:31:21 +03:00
Kirill Bulatov
7b5974e8e9 Add LSP logs clear button 2023-08-31 18:31:21 +03:00
Kirill Bulatov
54e7e2f59d Capture language servers' stderr into server logs 2023-08-31 01:14:37 +03:00
Piotr Osiewicz
07b9c6c302
language: Make Buffer::new take an explicit ID (#2900)
See Linear description for the full explanation of the issue. This PR is
mostly a mechanical change, except for the one case where we do pass in
an explicit `next_id` instead of `model_id` in project.rs.

Release Notes:
- Fixed a bug where some results were not reported in project search in
presence of unnamed buffers.
2023-08-28 11:51:50 +02:00
Max Brunsfeld
404f76739c Format let-else statements 2023-08-25 10:11:32 -07:00
Nathan Sobo
d375f7992d Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
Mikayla
e5eed29c72
Add components example
Re-arrange generics on mouse event handler
Add TypeTag struct for dynamically tagged components
2023-08-15 03:06:43 -07:00
Nathan Sobo
0bf607cd2d WIP 2023-08-10 10:26:48 -06:00
Nathan Sobo
379652f074 Merge branch 'main' into cells 2023-08-03 19:33:04 -06:00
Nathan Sobo
afcc0d621b WIP 2023-08-03 17:03:39 -06:00
Nathan Sobo
884cee6dfd Get tests compiling returning WindowHandle<V: View> from add_window 2023-08-02 14:05:03 -06:00
Nathan Sobo
c602d98680 WIP 2023-07-26 13:34:57 -06:00