Commit Graph

69 Commits

Author SHA1 Message Date
Antonio Scandurra
f3710877f1
Introduce Editor::insert_flaps and Editor::remove_flaps (#12096)
This pull request introduces the ability to add flaps, custom foldable
regions whose first foldable line can be associated with:

- A toggle in the gutter
- A trailer showed at the end of the line, before the inline blame
information


https://github.com/zed-industries/zed/assets/482957/c53a9148-f31a-4743-af64-18afa73c404c

To achieve this, we changed `FoldMap::fold` to accept a piece of text to
display when the range is folded. We use this capability in flaps to
avoid displaying the ellipsis character.

We want to use this new API in the assistant to fold context while still
giving visual cues as to what that context is.

Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-05-21 20:23:37 +02:00
Thorsten Ball
f7ea1370a4
Update docstring for SumTree (#10927)
Need the updated docstring for the blog post.
Release Notes:

- N/A
2024-04-24 14:01:10 +02:00
Mikayla Maki
8a02159b82
Add a command to expand the context for a multibuffer (#10300)
This PR adds an action to expand the excerpts lines of context in a
multibuffer.

Release Notes:

- Added an `editor::ExpandExcerpts` action (bound to `shift-enter` by
default), which can expand the excerpt the cursor is currently in by 3
lines. You can customize the number of lines by rebinding this action
like so:

```json5
// In your keybindings array...
  {
    "context": "Editor && mode == full",
    "bindings": {
      "shift-enter": ["editor::ExpandExcerpts", { "lines": 5 }],
    }
  }
```

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-04-19 14:27:56 -07:00
Antonio Scandurra
57a736d74a
Fuse iterator supplied to SumTree::from_iter (#10571)
This fixes an issue that could cause `from_iter` to never finish if the
underlying iterator restarted after returning `None` for the first time.

We only saw this in development but I wanna cherry-pick it to stable and
preview, just in case.

Release Notes:

- N/A

Co-authored-by: Kyle <kylek@zed.dev>
2024-04-15 20:09:43 +02: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
Marshall Bowers
22fe03913c
Move Clippy configuration to the workspace level (#8891)
This PR moves the Clippy configuration up to the workspace level.

We're using the [`lints`
table](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table)
to configure the Clippy ruleset in the workspace's `Cargo.toml`.

Each crate in the workspace now has the following in their own
`Cargo.toml` to inherit the lints from the workspace:

```toml
[lints]
workspace = true
```

This allows for configuring rust-analyzer to show Clippy lints in the
editor by using the following configuration in your Zed `settings.json`:

```json
{
  "lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "check": {
          "command": "clippy"
        }
      }
    }
  }
```

Release Notes:

- N/A
2024-03-05 12:01:17 -05:00
Marshall Bowers
328c8a94b3
Enable clippy::search_is_some (#8748)
This PR enables the
[`clippy::search_is_some`](https://rust-lang.github.io/rust-clippy/master/index.html#/search_is_some)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 21:46:30 -05:00
vultix
8aa5319210
Add documentation to many core editor types (#7919)
Hopefully this makes it a bit easier for new contributors to dive into
the codebase :)

Release Notes:

- Improved documentation for many core editor types

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-02-17 09:03:05 -07:00
Thorsten Ball
33f713a8ab
Optimize construction and insertion of large SumTrees (#7731)
This does two things:

1. It optimizes the constructions of `SumTree`s to not insert nodes
one-by-one, but instead inserts them level-by-level. That makes it more
efficient to construct large `SumTree`s.
2. It adds a `from_par_iter` constructor that parallelizes the
construction of `SumTree`s.

In combination, **loading a 500MB plain text file went from from
~18seconds down to ~2seconds**.

Disclaimer: I didn't write any of this code, lol! It's all @as-cii and
@nathansobo.

Release Notes:

- Improved performance when opening very large files.

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Julia <julia@zed.dev>
2024-02-13 16:24:40 +01:00
Marshall Bowers
0cb8b0e451
Clean up Cargo.toml files (#7044)
This PR cleans up some inconsistencies in the `Cargo.toml` files that
were driving me crazy.

Release Notes:

- N/A
2024-01-29 23:47:20 -05:00
Piotr Osiewicz
21e6b09361
Remove license-file from Cargo.toml as it is apparently redundant (#4218)
Release Notes:

- N/A
2024-01-23 17:40:30 +01:00
Piotr Osiewicz
678bdddd7d
chore: Add crate licenses. (#4158)
- GPUI and all dependencies: Apache 2
- Everything else: AGPL

Here's a script that I've generated for it:
https://gist.github.com/osiewicz/6afdd6626e517da24a2092807e6f0b6e

Release Notes:
- N/A

---------

Co-authored-by: David <david@zed.dev>
2024-01-23 16:56:22 +01:00
Piotr Osiewicz
4fa28b3de2 chore: fix clippy lints for rope2, sum_tree, text2 and util 2024-01-01 23:50:14 +01:00
Max Brunsfeld
24141c2f16 Ensure collaborators cursor colors are the same in channel buffers as in projects
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-24 11:31:41 -07:00
Max Brunsfeld
a127b0d3e6 Fix warnings surfaced in Rust 1.71 2023-08-02 09:19:23 -07:00
Antonio Scandurra
2e0d051a78 Maintain cursor stack's position correctly when ascending the tree
This fixes a bug that could cause the cursor to incorrectly report its
start when using `slice` or `seek_forward`, and then calling `prev`. We
didn't notice this because we were not testing those three methods
together.

I suppose this could explain some of the panics we've observed because
we do use `slice`/`seek_forward` followed by `prev` calls in production.
2023-07-27 12:34:03 +02:00
Antonio Scandurra
f77b680db9 Account for inlay biases when clipping a point 2023-06-29 22:25:50 +03:00
Antonio Scandurra
976edfedf7 Add Cursor::next_item 2023-06-29 22:25:50 +03:00
Kirill Bulatov
63074c5cd8 Better bias selection for hints that prefix the type
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-29 22:25:49 +03:00
Nathan Sobo
8c298a9da5 Rename SumTree::push_tree to ::append 2023-06-19 19:49:33 -06:00
Mikayla Maki
34e134fafb
Fix several randomized test failures with the new git status implementation 2023-06-07 14:10:17 -07:00
Mikayla Maki
6ef0f70528
Made the map seek target a publicly implementable interface
Integrated remove_range with the existing git code

co-authored-by: Nathan <nathan@zed.dev>
2023-05-12 08:37:32 -07:00
Nathan Sobo
ee3637216e
Add TreeMap::remove_between that can take abstract start and end points
This commit introduces a new adaptor trait for SeekTarget that works around
frustrating issues with lifetimes. It wraps the arguments in a newtype wrapper
that lives on the stack to avoid the lifetime getting extended to the caller
of the method.

This allows us to introduce a PathSuccessor object that can be passed as the
end argument of remove_between to remove a whole subtree.
2023-05-12 08:21:01 -07:00
Mikayla Maki
d526fa6f1f
fmt 2023-05-11 16:06:56 -07:00
Mikayla Maki
d538994c7f
Use more efficient sum tree traversals for removal and improve ergonomics with iter_from
co-authored-by: Nathan <nathan@zed.dev>
2023-05-11 16:06:25 -07:00
Mikayla Maki
1bb34e08bb
Fix test 2023-05-11 12:03:39 -07:00
Mikayla Maki
dfb6a2f7fc
fmt 2023-05-11 12:02:25 -07:00
Mikayla Maki
5b2ee63f80
Added status trickle up 2023-05-11 12:01:42 -07:00
Mikayla Maki
e20eaca595
Got basic replication working :) 2023-05-10 17:37:36 -07:00
Mikayla Maki
00b345fdfe
Use sum tree traversal to remove paths 2023-05-10 17:37:36 -07:00
Mikayla Maki
67491632cb
WIP: Track live entry status in repository
co-authored-by: petros <petros@zed.dev>
2023-05-10 17:37:36 -07:00
Mikayla Maki
023d665fb3
Fix TreeMap retain 2023-05-08 14:33:58 -07:00
Mikayla Maki
563f13925f
WIP: Convert old git repository vec to new treemap based approach.
co-authored-by: Nathan <nathan@zed.dev>
2023-05-08 14:33:58 -07:00
Mikayla Maki
a58d3d8128
Add a data driven representation of the current git repository state to the worktree snapshots
WIP: Switch git repositories to use SumTrees

Co-authored-by: Nathan <nathan@zed.dev>
2023-05-08 14:33:58 -07:00
Max Brunsfeld
ebbe52e6b0 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
Antonio Scandurra
137d9384b5 Initialize the active editor when vim mode is enabled
Instead of waiting for a focus event. This makes more tests pass.
2023-04-20 14:02:40 -06:00
Max Brunsfeld
2d97387f49 Restructure background scanner to handle refresh requests even while scanning 2023-04-12 16:29:51 -07:00
Mikayla Maki
d060114f00 Added complete scripts for generating third party license files 2023-01-23 12:47:12 -08:00
Joseph Lyons
233b28a1b9 Appease clippy 2023-01-01 23:50:45 -05:00
Julia
00b7c78e33 Initial hacky displaying of git gutter in multi-buffers 2022-12-13 12:35:58 -05:00
Julia
61ff24edc8 Move cloneable diff state into new snapshot type
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-29 13:16:02 -04:00
Max Brunsfeld
f6a817a0f3 Start work on a SyntaxMap data structure 2022-08-21 11:37:10 -07:00
ForLoveOfCats
8ba2f77148 One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Antonio Scandurra
df33556693 Introduce a new TreeSet struct in sum_tree
This is just a special case of `TreeMap<K, V>` where `V = ()`.
2022-07-18 13:40:30 +02:00
Max Brunsfeld
724affc442 Upgrade deps to avoid multiple versions of transitive deps
* env_logger
* prost-build
* bindgen
2022-06-02 17:38:33 -07:00
Max Brunsfeld
a2c22a5e43 Prevent eager snapshot mutations from being clobbered by background updates
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-04 15:10:39 -07:00
Max Brunsfeld
438e4e7a19 Allow guests to rename stuff
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-04 10:28:44 -07:00
Nathan Sobo
7e5a3f9f6b Introduce structured logging
We're enabling the log crate feature everywhere, but only using it on the server for now.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-08 10:06:51 -06:00
Antonio Scandurra
a6d0caf557 Don't seek FilterCursor upon creation
This lets us use `next` or `prev` to decide whether to park the cursor
at the first or last filtered item.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio Scandurra
f10fd6c419 Randomize test FilterCursor::prev
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00