Commit Graph

934 Commits

Author SHA1 Message Date
Antonio Scandurra
e8105c9a99 Show a message when no matches were found 2022-01-29 18:23:14 +01:00
Antonio Scandurra
c16bd98f56 Fix panic when no matches were found 2022-01-29 18:21:19 +01:00
Antonio Scandurra
969d81b632 Determine active match index correctly when cursor is after last match 2022-01-29 16:44:26 +01:00
Antonio Scandurra
df4cc45790 Select next/prev find match based on whether we intersect active match
Also, capture the next/prev selection logic in a unit test.
2022-01-29 16:16:48 +01:00
Antonio Scandurra
1d55872e7a Display active match and allow going to next or previous match
We still need to write a unit test for this, as well as add a keybinding.
2022-01-29 14:38:58 +01:00
Antonio Scandurra
5ebd24d528 📝 Improve assertion comment 2022-01-29 10:41:55 +01:00
Antonio Scandurra
a284e7140c Always return valid locations when refreshing anchors
Specifically, with this commit:

- We will now refresh the anchor if it escapes the boundaries of the excerpt by
using the `Excerpt::contains` method. This was not the case before, as we were
just checking if the excerpt id and buffer id of the anchors matched the ones
stored on the excerpt.
- We fixed a bug that was causing the anchor to be outside of the excerpt when
resetting it to one of the excerpt's endpoints after we couldn't keep its
position. This would happen because we were using `anchor_at`, which resolved
the anchor to an offset first and then converted it back into an anchor with
the given bias, which is a lossy operation. We now use `Anchor::bias` to
achieve the same goal: note that this could still lead to the anchor escaping
the excerpt's boundary when the bias doesn't match the endpoint's bias, so we
take extra care to avoid that and `min`/`max` the newly-produced anchor with
the other endpoint.
2022-01-29 10:10:53 +01:00
Antonio Scandurra
2d6e348185 Prevent anchors from escaping their excerpt's range when resolving them
This could happen if an anchor was created on an excerpt with a larger range.
Then, if the excerpt was removed and added back at the same position and with
the same buffer but a smaller range, resolving the anchor could overshoot
the excerpt's boundaries.
2022-01-29 09:52:38 +01:00
Max Brunsfeld
5c7cea5a3e WIP - Navigate to prev/next search result 2022-01-28 14:00:00 -08:00
Max Brunsfeld
7e02d669e1 Add a simple unit test for find bar 2022-01-28 13:05:29 -08:00
Max Brunsfeld
be7f5340d0 Adjust hover assertion in lsp test after bumping rust-analyzer 2022-01-28 12:11:26 -08:00
Antonio Scandurra
d2a64f2171 Optimize search when regex doesn't contain newlines
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-28 17:26:08 +01:00
Antonio Scandurra
5b9d791269 Implement regex search with multiline support
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-28 16:15:18 +01:00
Antonio Scandurra
5c862bfe98 Maintain search results as query and active editor changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-28 15:19:58 +01:00
Antonio Scandurra
860e37d50f Move finding results in the background 2022-01-28 12:15:55 +01:00
Antonio Scandurra
b2ded5bca8 Optimize some common operations when MultiBuffer is a singleton 2022-01-28 11:50:13 +01:00
Antonio Scandurra
b980b11053 Implement whole word mode 2022-01-28 11:48:04 +01:00
Nathan Sobo
df1810a3b0 A bit more progress styling find
Fix the pinwheel when hovering mode buttons.
2022-01-27 18:59:44 -07:00
Max Brunsfeld
da35df0cca WIP 2022-01-27 16:16:51 -08:00
Max Brunsfeld
4f0ffdcdaf Avoid panic when closing the last tab in a pane, due to calling activate_item 2022-01-27 15:38:10 -08:00
Max Brunsfeld
3abd7bc8dd Highlight find matches
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:19:52 -08:00
Max Brunsfeld
34ed734749 Add highlighted_ranges API to editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:19:28 -08:00
Max Brunsfeld
d8e4464a89 WIP - Run substring search when typing in find bar
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 13:00:51 -08:00
Max Brunsfeld
05e20ca72b Inform toolbars when active item changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 13:00:23 -08:00
Antonio Scandurra
bebde782fa Deploy FindBar when hitting cmd-f
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-27 17:56:50 +01:00
Antonio Scandurra
e7d4c385d5 Take an Into<AnyViewHandle> in ChildView::new
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-27 17:54:45 +01:00
Antonio Scandurra
dbf48d2a5b
Merge pull request #375 from zed-industries/more-project-diagnostics-styling
Last touches on project diagnostics for now
2022-01-27 16:47:05 +01:00
Antonio Scandurra
3853826f78 Pause cursor blinking only when editor is focused
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 16:33:47 +01:00
Antonio Scandurra
37032f5eb2 Show non-disk-based diagnostics in project diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 16:23:50 +01:00
Antonio Scandurra
ff24766319 Fix warning
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:55:48 +01:00
Antonio Scandurra
41ec4645ab Don't panic when ending transaction that wasn't started by the same editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:53:44 +01:00
Antonio Scandurra
f055053fc9 Avoid grouping transactions created by different editors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:51:46 +01:00
Antonio Scandurra
4d9cdd474b Style empty project diagnostics state 2022-01-27 10:21:26 +01:00
Antonio Scandurra
3e4fe09d00 Filter out supporting diagnostics that contain no messages 2022-01-27 09:51:15 +01:00
Max Brunsfeld
0e55f0ccaa Use Rust 2021 edition in all crates
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 12:50:31 -08:00
Max Brunsfeld
509d362bdd Avoid stripping newlines before opening backticks in error messages 2022-01-26 11:51:12 -08:00
Max Brunsfeld
f1d621133e Dial back opacity of border.1 in dark themes 2022-01-26 11:27:00 -08:00
Max Brunsfeld
76bbd101c6 Increase diagnostic editor's vertical scroll margin
This way, the first path header will always be fully visible when
you move your cursor to the beginning of the multibuffer.
2022-01-26 10:23:41 -08:00
Max Brunsfeld
9b9fcf6927 Avoid showing selection strip on top of diagnostic headers 2022-01-26 10:23:40 -08:00
Antonio Scandurra
51c34ebcc2 Alpha-blend borders with backgrounds in quad SDF
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-26 19:16:26 +01:00
Antonio Scandurra
02baaa3529 Bump the protocol version
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 17:42:04 +01:00
Nathan Sobo
e585bc7199 Add retries to rescan test that uses the real file system
We could potentially use a fake file system, but this should avoid flaky tests in the short run.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-26 09:25:06 -07:00
Antonio Scandurra
0263ea289c Style diagnostic header's border in light and dark theme
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 17:08:24 +01:00
Antonio Scandurra
dedd5d63fb Fix blending of quad's border with background
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 17:06:20 +01:00
Antonio Scandurra
3f6960bd34 Position underlines at a distance proportional to the line descent
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 16:03:06 +01:00
Antonio Scandurra
b9b255652f Display squiggly underlines underneath text with diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 15:52:40 +01:00
Antonio Scandurra
52594fe250 WIP: Start on squiggly underlines 2022-01-26 13:07:39 +01:00
Max Brunsfeld
a890787923 Render header blocks as horizontall fixed (like the gutter)
Tweak editor layout to perform horizontal autoscroll before
laying out the blocks, so that they can access the scroll position.
2022-01-25 17:19:38 -08:00
Max Brunsfeld
f19934096a Account for editor's full scroll width when laying out blocks
Compute the editor's scroll width earlier in layout and
store it on the layout state, rather than computing it repeatedly.
2022-01-25 16:31:14 -08:00
Max Brunsfeld
cefb63936d Tweak diagnostic header styling
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 15:33:49 -08:00
Max Brunsfeld
e04e929010 Render diagnostic status bar icon with icons 2022-01-25 15:33:34 -08:00
Max Brunsfeld
dbe969893c Show icons and counts in the project diagnostics tab
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 12:31:55 -08:00
Max Brunsfeld
c9b4bb78f2 Merge branch 'project-diagnostics-pinned-tab' into style-project-diagnostics 2022-01-25 12:20:37 -08:00
Max Brunsfeld
78b57e4d9d Scale diagnostic header and message text with editor font
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 12:10:11 -08:00
Nathan Sobo
0c6fd157ee Scale diagnostic headers icons with editor font and right align w/ line numbers
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-25 12:40:53 -07:00
Antonio Scandurra
121b45e249 Sanitize language server diagnostics coming from Rust
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 17:49:50 +01:00
Antonio Scandurra
7250974aa6 Style block decorations
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 17:07:12 +01:00
Antonio Scandurra
65d4c33c0e Format messages within backticks using bold instead of with a background 2022-01-25 15:50:49 +01:00
Antonio Scandurra
7e55353de8 Show error code in diagnostic header 2022-01-25 15:23:58 +01:00
Antonio Scandurra
ec0ca2a1b6 Display icon next to primary message 2022-01-25 15:15:03 +01:00
Antonio Scandurra
e7ec016350 Restyle diagnostic headers 2022-01-25 12:23:24 +01:00
Max Brunsfeld
0cfb9ff1ae Add random delays in FakeFs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-24 16:50:38 -08:00
Max Brunsfeld
2b8685c1a2 Insert random delays when sending and receiving websocket messages in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-24 16:37:22 -08:00
Nathan Sobo
d241ab6370 Don't store operations for remote buffers we haven't yet opened
This used to be needed, but we think with our improvements to message ordering that we'll never miss operations that were applied after opening a remote buffer.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-24 17:33:46 -07:00
Nathan Sobo
afa33c958b Clear shared buffers when unsharing projects
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-24 17:24:07 -07:00
Nathan Sobo
469ee554a0 Get most tests passing when respecting wake order for foreground tasks in Deterministic executor
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-24 17:13:56 -07:00
Antonio Scandurra
b7314ef2aa WIP: Start restructuring executor 2022-01-24 18:49:20 +01:00
Antonio Scandurra
96b66dcce1 Fix race condition when opening a buffer and getting a definition to it 2022-01-24 18:47:55 +01:00
Antonio Scandurra
93125cbd16 Remove executor::Foreground::Test
All code paths have already transitioned to `Foreground::Deterministic`.
2022-01-24 16:14:30 +01:00
Antonio Scandurra
dabab6e323 Verify simultaneously opening buffers via definition and open_buffer
This fails because we don't yet handle this scenario.
2022-01-24 15:08:04 +01:00
Antonio Scandurra
a762f575f4 Add remote worktree to project before it is fully deserialized
This prevents a race condition where the host will send us messages and
responses about a worktree that we have seen but haven't yet finished loading.
2022-01-24 14:00:38 +01:00
Antonio Scandurra
245490f934 Implement Project::definition when the buffer is remote 2022-01-24 13:10:13 +01:00
Antonio Scandurra
528a4dd9b4 Fix regression causing guests to miss operations while opening a buffer 2022-01-24 11:28:46 +01:00
Antonio Scandurra
f859d444ff Don't show conflict indicator on remote buffer after a reload 2022-01-24 10:17:36 +01:00
Antonio Scandurra
4372fe1ed0 Maintain remote buffers via UpdateBufferFile messages sent by host 2022-01-24 09:32:40 +01:00
Nathan Sobo
da13d028a3 Send File protos as part of Buffer protos
Use the File proto to build the File associated with the buffer rather than relying on the local entry.
2022-01-22 22:19:04 -07:00
Nathan Sobo
66fce5ec8e Introduce LocalFile trait
If you want to call `abs_path` or `load`, the file needs to be local. You call `as_local` which returns `Option<dyn LocalFile>` with those local-only methods. I think this makes it more explicit what works only locally vs everywhere.
2022-01-22 15:52:14 -07:00
Nathan Sobo
ea9c5b0686 💄 2022-01-22 15:30:38 -07:00
Nathan Sobo
506ce8e032 Introduce LocalSnapshot
This allows us to remove the absolute path and scan-related state from the Snapshot. None of this data is relevant or valid on guests.
2022-01-22 15:19:14 -07:00
Nathan Sobo
d192b6ebc7 Remove Worktree::abs_path
I'd like to only have methods related to absolute paths on local worktrees, because it's not really possible to implement them on remote worktrees since we don't know the full path being shared and wouldn't have anything to do with it anyway if we did.
2022-01-22 14:44:58 -07:00
Nathan Sobo
e2a2073bdb Remove worktree_path from File struct 2022-01-22 14:29:36 -07:00
Nathan Sobo
e61a5b172c Defer pane interaction when opening excerpts in diagnostics view
Activating a new item causes the current item to be deactivated. We're the current item, but we're on the stack, so we panic if we try to do this synchronously. If we use defer to wait until we're off the stack it works.
2022-01-22 13:23:08 -07:00
Nathan Sobo
b755b2d602 Add ViewHandle::defer
It's like update, but happens after the current effect instead of synchronously. Also, it doesn't allow the callback to return a value because there would be nothing to do with it.
2022-01-22 13:21:59 -07:00
Nathan Sobo
8b04c5d3ac Add a ViewContext::defer
This takes a closure that will be enqueued as an effect to ensure there are no entities on the stack.
2022-01-22 13:14:25 -07:00
Nathan Sobo
83418204b6 Assign diagnostics on buffer even if it doesn't have a language
This shouldn't be necessary in practice but makes testing easier.
2022-01-22 09:54:25 -07:00
Nathan Sobo
8bf628c17b Update new buffers with existing diagnostics in Project – after assigning language 2022-01-22 08:46:37 -07:00
Antonio Scandurra
2773cab4ec Simplify opening buffers in the Project and assign language synchronously 2022-01-22 11:34:44 +01:00
Antonio Scandurra
31dfd01fda Make add_local_worktree private and use find_or_create_local_worktree
The former always adds a worktree, even if we have one already in the
project and that could be misused. The public API should always search
for a local worktree containing the requested path first so that the
project can uphold invariants about which worktrees it has.
2022-01-22 11:23:00 +01:00
Max Brunsfeld
622aff3be2 Get diagnostics crate's tests passing
Update diagnostics on project instead of on worktree

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 18:02:10 -08:00
Max Brunsfeld
2712cadaf6 Get integration tests passing
* Fix misuse of guest buffer's id as its remote id

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 17:44:24 -08:00
Max Brunsfeld
f1fc0bde99 Flush effects after every spawned future completes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 17:43:24 -08:00
Max Brunsfeld
34e42c0c5f Remove worktree_id from buffer-related RPC messages 2022-01-21 16:23:39 -08:00
Max Brunsfeld
03dc1e5aea Move main worktree structs adjacent to each other 2022-01-21 16:10:26 -08:00
Max Brunsfeld
bd49a02c92 Move buffers from worktree to project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 15:46:27 -08:00
Max Brunsfeld
7de26302ec Remove UserStore from Worktree 2022-01-21 12:37:44 -08:00
Max Brunsfeld
6751bd9d78 Change integration tests to open buffers via the project 2022-01-21 12:23:17 -08:00
Nathan Sobo
a578d71ea2 v0.13.0
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-21 11:26:32 -07:00
Nathan Sobo
3ecb7e81f1 Remove panic when guest attempts to go to definition
We'll implement this soon but want to merge something stable to main.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-21 11:24:05 -07:00
Nathan Sobo
19751e9200 Merge remote-tracking branch 'origin/main' into go-to-definition 2022-01-21 11:12:38 -07:00
Nathan Sobo
a73671e57c Revert "Replace project_path with project_entry in workspace::{Item, ItemView}"
This reverts commit 9c9a09cccb.
2022-01-21 11:07:10 -07:00