Commit Graph

1776 Commits

Author SHA1 Message Date
Nathan Sobo
657b92b020 Don't prompt for keychain access when launching from a pty
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-23 12:18:17 -06:00
Nathan Sobo
ee9ed936e4 Don't try keychain after authentication fails
Previously, we were achieving this by deleting the keychain item, but this can sometimes fail which leads to an infinite loop. Now, we explicitly never try the keychain when reattempting authentication after authentication fails.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-23 12:15:36 -06:00
Antonio Scandurra
5cd94b5b92 WIP 2022-03-23 19:05:46 +01:00
Antonio Scandurra
255a8c5d14 Don't push a duplicate nav entry when changing selections via the mouse
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-23 18:45:45 +01:00
Keith Simmons
0a8d543f66 Add global tests and wrap global update functions in update call to flush effects
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-03-23 10:27:27 -07:00
Max Brunsfeld
0b3a63b843 Fix error in follower when leader creates pending selections
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 10:24:26 -07:00
Keith Simmons
454f7a570c Add global change observations 2022-03-23 09:14:12 -07:00
Antonio Scandurra
10f176073d
Merge pull request #662 from zed-industries/fix-refresh-selections-when-mouse-selecting
Account for pending selections when calling `Editor::refresh_selections`
2022-03-23 15:58:28 +01:00
Antonio Scandurra
b73f57d37a Don't destroy pending selection on Editor::refresh_selections
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 15:21:11 +01:00
Antonio Scandurra
004f98cc6d
Merge pull request #661 from zed-industries/follow
Introduce basic following experience
2022-03-23 15:17:44 +01:00
Antonio Scandurra
60b6b0b317 Cycle through panes spatially rather than in the order in which they created
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 15:06:25 +01:00
Antonio Scandurra
5ac39aa7cd Don't show local cursors when editor is not focused
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 14:46:33 +01:00
Antonio Scandurra
4f27049305 Focus followed items when they become active if the pane is active
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 14:41:48 +01:00
Antonio Scandurra
edc038a1cf Activate previous pane and next pane via cmd-k cmd-left and cmd-k cmd-right
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 14:26:00 +01:00
Nathan Sobo
097bbe3e07 Update follow binding, remove unfollow binding
The previous binding to follow had ergonomics issues for the frequency that I think we'll want to use it. It would also conflict with the sub-word selection binding.

Now that moving the cursor etc unfollows, I don't think we need the follow binding.
2022-03-23 06:19:35 -06:00
Antonio Scandurra
d24bd6f19a Account for pending selections when calling Editor::refresh_selections 2022-03-23 11:46:35 +01:00
Antonio Scandurra
3298529ed1 Fix global nested event test after turning subscriptions into effects 2022-03-23 09:14:33 +01:00
Max Brunsfeld
fa62fd968f Autoscroll when leader moves cursors
instead of copying their scroll top.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 18:02:54 -07:00
Max Brunsfeld
fad299eb3f Add unit test for editor's following methods
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 17:39:34 -07:00
Max Brunsfeld
8699dd9c56 Replicate fractional component of leader's scroll position
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 17:20:13 -07:00
Max Brunsfeld
880eaa268b Coalesce followed view updates only within one frame
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 17:03:24 -07:00
Max Brunsfeld
4435d9b106 Combine updates from multiple view events when updating followers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 16:22:42 -07:00
Keith Simmons
fba6f24ab7 Add editor lifetime events 2022-03-22 16:14:32 -07:00
Keith Simmons
6a1c197c1b Add editor selection utilities
Also improved test that was failing during above to use marker text approach as a drive by
2022-03-22 16:08:22 -07:00
Max Brunsfeld
fc811e0856 Don't represent editor's scroll top anchor as an option
Use Anchor::min as the special value representing a scroll top of zero
2022-03-22 13:32:25 -07:00
Max Brunsfeld
0a3f013e00 Use env_logger when running the app in a terminal 2022-03-22 13:32:25 -07:00
Max Brunsfeld
c105802b2d Allow customizing the pane's following border width in the theme 2022-03-22 13:32:25 -07:00
Max Brunsfeld
4ed8f6fbb4 Make UpdateBuffer a foreground message 2022-03-22 13:32:25 -07:00
Keith Simmons
df751867a1 Remove results from movement function return values, and move editor test utilities to test file 2022-03-22 10:55:03 -07:00
Antonio Scandurra
c78bcf7116 Ensure leader updates don't change the active pane of followers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 16:44:59 +01:00
Antonio Scandurra
9885c4f6ba Don't trigger observations with notifications emitted prior to observing
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 16:28:11 +01:00
Antonio Scandurra
5ecf945e28 Don't trigger global subscriptions with events emitted prior to subscribing
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 16:14:21 +01:00
Antonio Scandurra
73eae287a1 Don't trigger subscriptions with events emitted prior to subscribing
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 15:57:30 +01:00
Antonio Scandurra
284a446be7 WIP 2022-03-22 13:35:37 +01:00
Antonio Scandurra
381c82714b Bump protocol version 2022-03-22 13:19:07 +01:00
Antonio Scandurra
016fb01ef8 Merge branch 'main' into follow 2022-03-22 11:20:55 +01:00
Antonio Scandurra
e5a99cf8cd Stop following when leader disconnects 2022-03-22 11:16:04 +01:00
Antonio Scandurra
ffaf409a31 Forget last pane's leader when such pane is removed
This is just a memory optimization and doesn't cause any observable
change in behavior.
2022-03-22 11:06:52 +01:00
Antonio Scandurra
5dc36260e5 Reflect leader's view state when recycling existing local editors 2022-03-22 10:51:17 +01:00
Antonio Scandurra
34e5a1f6bb Always render local selections on top of remote ones 2022-03-22 10:31:28 +01:00
Antonio Scandurra
7d566ce455 Follow last collaborator or the next one via cmd-alt-shift-f 2022-03-22 10:16:58 +01:00
Antonio Scandurra
67dbc3117d Stop following when activating a different item on the follower pane 2022-03-22 09:42:37 +01:00
Antonio Scandurra
3117554568 Automatically unfollow when editing, scrolling or changing selections 2022-03-22 09:17:01 +01:00
Max Brunsfeld
c550fc3f01 WIP - Start work on unfollowing automatically 2022-03-21 21:52:28 -07:00
Max Brunsfeld
1728551282 Always mirror the leader's selections when following 2022-03-21 21:47:29 -07:00
Nathan Sobo
ee3e6049a3 Make boundary-finding methods wrap across newlines
This requires word and subword methods to explicitly acknowledge that they want to stop at newlines, which I think actually increases clarity. It makes the boundary finding method more general and useful for external callers such as the forthcoming vim crate.
2022-03-21 21:25:02 -06:00
Nathan Sobo
f70f4c7729 Improve DisplayPoint Debug impl 2022-03-21 21:07:56 -06:00
Nathan Sobo
e5a00d72f8 Implement next_subword_end 2022-03-21 20:02:08 -06:00
Nathan Sobo
c0d05c82b7 WIP: Start on previous_subword_start
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 19:53:01 -06:00
Max Brunsfeld
c8f36af823 Show borders around avatars and panes to indicate following state 2022-03-21 15:12:15 -07:00
Nathan Sobo
5b54874705 Extract logic for scanning over character boundaries 2022-03-21 16:01:22 -06:00
Nathan Sobo
0c89ad3ac0 Make multi-byte and surrounding_word tests more readable
Just merge multi-byte tests into the main word movement tests
2022-03-21 15:41:42 -06:00
Nathan Sobo
210fa4c443 Remove CharKind::Newline
This is just a character, and so it seems clearer to refer to it specifically when we want to know if a character is a newline. There was only one case where we relied on Newline being different from Whitespace, and we special-cased that instance. Changing this actually makes us match the behavior of VS Code when double-clicking runs of multiple newlines.

/cc @as-cii

Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:32 -06:00
Nathan Sobo
baeb7d27b8 Clarify word movement function names and improve test coverage
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:25 -06:00
Max Brunsfeld
06cd9ac664 Match the leader's last selection when unfollowing
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-21 14:04:55 -07:00
Max Brunsfeld
3e0bc979c3 Avoid infinite loop when collaborators follow each other
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-21 11:47:00 -07:00
Antonio Scandurra
13a2dacc60 💄 2022-03-21 18:16:06 +01:00
Nate Butler
1c23a45d02 Update Zed fonts to 1.2.1 2022-03-21 12:11:31 -04:00
Antonio Scandurra
9575796f9e Allow unfollowing of leaders by clicking on their avatar 2022-03-21 17:10:23 +01:00
Antonio Scandurra
a154e4500b Implement Workspace::unfollow
This also changes the structure of the follow state back to be per-pane. This
is because we can't share the same view state across different panes for
a couple of reasons:

- Rendering the same view in N different panes is almost always not something
that we want due to global state such as focus.
- If we allowed it and a user followed the same person in two different panes,
there would be no way of unfollowing in one pane without also unfollowing in
the other.
2022-03-21 16:55:18 +01:00
Antonio Scandurra
a2dbebd9ba Hide cursor both locally and remotely when following 2022-03-21 15:16:56 +01:00
Nathan Sobo
7cb8935ff5 Pass project entry id to Pane when opening a project items
This fixes an oversight where we were failing to associate project items with their project entry ids, which broke the logic that prevented the same project entry from being opened twice in the same pane.
2022-03-20 08:54:20 -06:00
Antonio Scandurra
0e920ad5e9 Unset follower's scroll anchor when editor is scrolled all the way up 2022-03-19 10:50:23 +01:00
Max Brunsfeld
570c987455 Handle view updates when following
Basic following now works. Editors' scroll positions
are their only replicated view state.
2022-03-18 15:56:57 -07:00
Max Brunsfeld
e338da0271 Allow clicking a titlebar avatar to initiate following 2022-03-18 13:37:07 -07:00
Max Brunsfeld
d860ed25c1 Allow FollowableItem::to_state_message to return None
This way, we can avoid a panic if we don't handle certain cases,
like a non-singleton editor.
2022-03-18 13:36:05 -07:00
Max Brunsfeld
df0632011c 🎨 client
Forgot to push this yesterday night.
2022-03-18 13:03:43 -07:00
Max Brunsfeld
d02ab9bd06 Start work on updating editors's scroll positions when following
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-18 12:56:20 -07:00
Max Brunsfeld
2c53175566 Rename FollowedItem -> FollowableItem
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-18 10:12:51 -07:00
Antonio Scandurra
f4520d4184 WIP 2022-03-18 18:07:03 +01:00
Antonio Scandurra
7d7e10598a Broadcast active view to followers 2022-03-18 16:00:03 +01:00
Antonio Scandurra
3d81eb9ddf Allow accessing workspace after adding item to pane 2022-03-18 14:59:53 +01:00
Antonio Scandurra
10e6d82c3e WIP: Start on sending view updates to followers 2022-03-18 14:20:09 +01:00
Antonio Scandurra
f0b7bd6e17 Serialize initial follow state in leader and reflect it in follower 2022-03-18 10:22:13 +01:00
Max Brunsfeld
0fdaa1d715 WIP 2022-03-17 17:53:49 -07:00
Max Brunsfeld
eda06ee408 Add AnyWeakViewHandle 2022-03-17 17:53:38 -07:00
Max Brunsfeld
5702737de2 Start work on an integration test for following 2022-03-17 13:53:06 -07:00
Max Brunsfeld
845457e2c4 Always read project entry id from workspace::Item
We cannot store a workspace item's project entry id separately,
since buffers' entry ids can change (for example when doing
a *save as*).

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-17 10:58:20 -07:00
Max Brunsfeld
9716ff7964 Set up logic for starting following
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-17 10:46:54 -07:00
Antonio Scandurra
2b4738d82d Avoid passing a closure to workspace::register_project_item
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-17 17:39:25 +01:00
Antonio Scandurra
4bbfd0918e Start defining follow protocol
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 16:50:29 +01:00
Antonio Scandurra
5d14c9abdf Introduce workspace::register_project_item
This lets downstream crates like `editor` define how project items should be
opened.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 15:54:34 +01:00
Antonio Scandurra
bff414cfbc Remove Editor::find_or_create
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 15:13:47 +01:00
Antonio Scandurra
6f9c37851c Add Editor::for_multibuffer and repurpose Editor::for_buffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:39:02 +01:00
Antonio Scandurra
44d997c00c Rename app_state to global in gpui
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:33:01 +01:00
Antonio Scandurra
84bacc556f Rename build_editor to build_item in Pane::open_item
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:31:05 +01:00
Antonio Scandurra
6446660c88 Rename open_buffer_for_path to open_buffer 2022-03-17 11:42:13 +01:00
Antonio Scandurra
e6755f4115 Search only in active pane when using Editor::find_or_create 2022-03-17 11:39:39 +01:00
Antonio Scandurra
a691c2fbdb Delete unused code 2022-03-17 11:33:58 +01:00
Antonio Scandurra
0efce8f70a Rename ItemView to Item 2022-03-17 11:32:46 +01:00
Antonio Scandurra
aced1e2315 Finish refactoring of how editors are opened 2022-03-17 11:29:46 +01:00
Nathan Sobo
728c708150 WIP: Massage opening of editors
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-16 17:40:09 -06:00
Nathan Sobo
1f9885ec42 Remove open_item_in_pane
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-16 16:08:13 -06:00
Nathan Sobo
0036e5c86c Replace ProjectEntry struct with ProjectEntryId
Previously, we tracked the worktree_id and entry_id separately, but now that entry ids are unique across all worktrees this is unnecessary.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-16 15:59:47 -06:00
Max Brunsfeld
a88320dc5f Remove workspace::Item trait
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2022-03-16 13:34:06 -07:00
Antonio Scandurra
b0afb64a6e Fix edge cases when calling refresh_windows
This commit ensures that new views are rendered for the first time. This fixes
a panic that could be reproduced by dropping the `ThemeSelector` and opening
the file finder during the same update.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-16 14:51:54 +01:00
Max Brunsfeld
257601b3c1 Add buffer method for getting the symbols containing a position 2022-03-15 14:04:58 -07:00
Max Brunsfeld
76fc9c955e Restore underline for warnings about unused code 2022-03-15 13:13:33 -07:00
Antonio Scandurra
a0224cbe71
Merge pull request #630 from zed-industries/fix/go-to-line-panic
Fix go to line panic by replacing an unwrap with an and_then
2022-03-15 18:11:26 +01:00
Keith Simmons
72188456b2 fix go to line panic by replacing an unwrap with an and_then 2022-03-15 09:31:24 -07:00
Antonio Scandurra
f20aaf5c35 v0.21.0 2022-03-15 16:48:28 +01:00
Antonio Scandurra
447f350123 Compute line-height as a multiple of font size
...instead of using the bounding box. This makes `PragmataPro` and other
fonts render more cleanly.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 16:35:06 +01:00
Antonio Scandurra
c6c72a7249 Skip over unnecessary code diagnostics when hitting f8
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:55:39 +01:00
Antonio Scandurra
7155dabf5b Fade out unnecessary code
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Antonio Scandurra
41bd58e3ac Only show errors and warnings in project diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:30:05 +01:00
Antonio Scandurra
021699e51c Implement shift-f8 to go to previous diagnostic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01: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
Antonio Scandurra
45ce503afd Start on implementing filtering support for Cursor::prev 2022-03-15 15:13:23 +01:00
Antonio Scandurra
fbf7cdf4f2 Make all HighlightStyle properties optional
Previously, some of those properties such the font weight, style and color
would be mandatory: when the theme didn't specify them, Zed would use a default
value during deserialization. This meant that those default properties would
unconditionally override the base text style, causing a rendering bug when
combining syntax highlights with diagnostic styles.

This commit fixes that by making `HighlightStyle`s more additive: each property
can be set independently and only the properties that theme specifies get
overridden in the base text style.
2022-03-15 10:39:43 +01:00
Max Brunsfeld
3a439f141d Open settings file in new window if current window isn't local
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-14 17:12:07 -07:00
Max Brunsfeld
d193c9a358 v0.20 2022-03-14 15:59:52 -07:00
Max Brunsfeld
38dcd522de Bump protocol version number 2022-03-14 15:57:39 -07:00
Max Brunsfeld
e7835caac4
Merge pull request #621 from zed-industries/autoclose-before-punctuation
Autoclose brackets before a language-specific set of characters
2022-03-14 15:33:47 -07:00
Max Brunsfeld
325e6c31ae Autoclose brackets before a language-specific set of characters
Fixes #588
2022-03-14 15:17:40 -07:00
Max Brunsfeld
2c25e619b4 Respect theme's background color when rendering field editors 2022-03-14 14:24:51 -07:00
Max Brunsfeld
5822b47b74 Ensure that worktrees' entry ids are unique across the project
Fixes #512
2022-03-14 12:36:56 -07:00
Max Brunsfeld
e392368d89 Fix layout panic on empty editors with blocks
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-14 12:03:26 -07:00
Antonio Scandurra
21eebede37 Add more assertions to investigate #503 in the future 2022-03-14 16:53:39 +01:00
Antonio Scandurra
a3ea6a34d9 Ensure there's at least one selection in Editor::set_selections
This commit introduces an assertion that will cause Zed to panic as
soon as the invariant gets violated. This will be useful to investigate
issue #503.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 16:17:14 +01:00
Antonio Scandurra
5d5f89231b Hold strong handle in ChildView
This eliminates a whole class of errors where the `ChildView` could
be referring to a view that doesn't exist anymore. That probably still
indicates that there's an underlying bug, but at least we won't panic.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 15:49:11 +01:00
Antonio Scandurra
bae44d8132 Re-render workspace when removing an inactive pane
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 15:49:08 +01:00
Antonio Scandurra
47b40e3839 Don't draw scene elements if their size is zero
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 15:29:18 +01:00
Max Brunsfeld
b33a049958 Merge branch 'main' into settings-file 2022-03-13 10:43:23 -07:00
Antonio Scandurra
1e9b6b050d
Merge pull request #596 from zed-industries/fix/dropped-subscription-in-callback
Fix Dropped Subscription in Handler Bug
2022-03-12 19:14:38 +01:00
Nathan Sobo
992fc07133 Hide selections in original editor when renaming
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:45:11 -07:00
Nathan Sobo
308cead8a8 🙊
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:44:11 -07:00
Nathan Sobo
9f629fa307 Improve selection handling when pending rename is taken
- Set selection to the intuitive cursor position when moving up rather than restoring the full selection of the rename editor.
- When cancelling, restore the original selection.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:30:57 -07:00
Nathan Sobo
33bcd6d904 Merge remote-tracking branch 'origin/main' into select-on-rename 2022-03-12 10:10:23 -07:00
Nathan Sobo
4f086b8d7a Refresh document highlight after rename, but not during
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:10:06 -07:00
Antonio Scandurra
965f82ec31
Merge pull request #589 from zed-industries/fold-map-test-failures
Avoid re-using excerpt IDs in `MultiBuffer`
2022-03-12 17:59:48 +01:00
Antonio Scandurra
dd1711d53f Account for all excerpts ever inserted when determining new excerpt ID 2022-03-12 17:50:09 +01:00
Antonio Scandurra
cd4a9f3178 Fix bug in selection position maintenance while renaming symbol
We were resolving the selection with the wrong buffer, which now
causes a panic because we don't check the anchor's `buffer_id` anymore.
2022-03-12 13:03:45 +01:00
Max Brunsfeld
20fed599b2 Start work on relaying settings to language servers 2022-03-11 17:36:27 -08:00
Max Brunsfeld
48848de82c Store settings as a global via a gpui app_state 2022-03-11 15:58:58 -08:00
Keith Simmons
c50be72214 Format including missing formatting changes from previous PR 2022-03-11 15:38:01 -08:00
Keith Simmons
16afb3d5b1 Add some tests for global events and fix potential bug in subscriptions when subscription is dropped inside of it's own callback
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-11 15:34:04 -08:00
Nathan Sobo
c35a96c425 On rename, replace background highlights with transparent text highlights 2022-03-11 15:54:17 -07:00
Nathan Sobo
951fd1ab36 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Max Brunsfeld
2103eec463 Allow registering handlers for typed LSP requests 2022-03-11 13:19:10 -08:00
Max Brunsfeld
a137abe2de Add a snippet unit test with an escaped curly brace 2022-03-11 13:02:20 -08:00
Keith Simmons
87b1cfe34f
Merge pull request #576 from zed-industries/cursor-shape
Add support for rendering the cursor as a Block and Underscore

Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-03-11 11:51:24 -08:00
Max Brunsfeld
7a68b2d371 Provide JSON language server with settings schema 2022-03-11 11:46:22 -08:00
Max Brunsfeld
862ec01e7d Add API for handling custom requests from the language server 2022-03-11 11:44:02 -08:00
Keith Simmons
17ac240511
Merge pull request #586 from zed-industries/global-events
Global Events

Co-authored-by: Max Brunsfeld <nathan@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-11 11:42:25 -08:00
Keith Simmons
144591d639 Minor renames for clarity 2022-03-11 11:25:36 -08:00
Max Brunsfeld
6091caee8e Merge branch 'main' into settings-file 2022-03-11 10:04:17 -08:00
Max Brunsfeld
022bb28a59 Handle escaped characters in snippets 2022-03-11 09:57:43 -08:00
Nathan Sobo
fd36b25db1
Merge pull request #587 from zed-industries/lsp-progress
Show language server progress in the status bar
2022-03-11 10:57:24 -07:00
Antonio Scandurra
71aa5e5360 💄 2022-03-11 17:13:28 +01:00
Antonio Scandurra
a74b602f18 Assume the anchor is valid if we can find an excerpt that contains it 2022-03-11 17:08:12 +01:00
Nathan Sobo
5407f25c94 Don't reuse excerpt ids in MultiBuffer
This prevents anchors from swapping their ordering, which was causing issues in FoldMap.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:50:50 -07:00
Nathan Sobo
134496ce8f Remove dead code
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:24:42 -07:00
Antonio Scandurra
c67cfd7fe1 Respect excerpt's range when comparing two anchors both belonging to it 2022-03-11 12:42:22 +01:00
Antonio Scandurra
18b1e9d35f Don't starve main thread when lots of messages/events arrive at once 2022-03-11 10:09:13 +01:00
Antonio Scandurra
7a454003fe Show the last in-progress task from language servers 2022-03-11 09:59:13 +01:00
Keith Simmons
5f62f69907 Add unwrap check if buffer_line not available 2022-03-10 20:04:16 -08:00
Keith Simmons
81fc812221 Add global events to MutableAppContext and raise global event when new workspace is created 2022-03-10 20:03:01 -08:00
Keith Simmons
b62daebde1
Merge pull request #563 from zed-industries/mouse-history-navigation
Add missing mouse button events and mouse history navigation
2022-03-10 17:39:36 -08:00
Max Brunsfeld
bdb39f6247 Create the settings file if needed when opening it via command 2022-03-10 17:27:46 -08:00
Max Brunsfeld
9a6819b899 For single-file worktrees start LSP with parent dir as CWD 2022-03-10 16:06:12 -08:00
Max Brunsfeld
44a68b723c Add cmd-, as a keybinding for opening settings 2022-03-10 15:51:57 -08:00
Nathan Sobo
94bf3366f6 Focus in-progress rename editor when editor is focused 2022-03-10 16:42:20 -07:00
Nathan Sobo
a498cd32c8 When renaming, match the color of the renamed token in the rename editor 2022-03-10 16:38:45 -07:00
Max Brunsfeld
f32107eb8e Always refresh the windows when the settings change 2022-03-10 15:34:04 -08:00
Max Brunsfeld
00056fbe88 Load the settings file on a background thread during startup 2022-03-10 15:25:22 -08:00
Nathan Sobo
69ce021f32 Remove unused variable 2022-03-10 15:27:29 -07:00
Nathan Sobo
3968b37e26 When renaming, fade out the old name and select all 2022-03-10 14:55:31 -07:00
Keith Simmons
5502c00d9a swap default cursor shape back to bar 2022-03-10 13:28:13 -08:00
Keith Simmons
5b35c68d2e Fix failing gpui test from missing cursor shape 2022-03-10 13:20:45 -08:00
Keith Simmons
eddb089f27 render character under block cursor 2022-03-10 13:16:31 -08:00
Nathan Sobo
e6b1fea117 WIP 2022-03-10 11:32:14 -07:00
Antonio Scandurra
5157b42896 Extract a LanguageServerStatus struct 2022-03-10 18:43:56 +01:00
Antonio Scandurra
45fb470f4d Display language server name in status bar 2022-03-10 16:48:43 +01:00
Antonio Scandurra
4243f0c339 Render pending language server work in status bar 2022-03-10 16:09:47 +01:00
Antonio Scandurra
4bbf5ed0b9 Listen to all LSP progress notifications and broadcast them to peers 2022-03-10 12:00:33 +01:00
Antonio Scandurra
ee6d7fc6d5 Delete till previous tabstop when backspacing within indent column 2022-03-10 10:28:24 +01:00
Keith Simmons
0d42c85195 fix formatting 2022-03-10 01:09:25 -08:00
Keith Simmons
178442a4a8 Add support for rendering cursors as a block and underscore 2022-03-10 01:09:02 -08:00
Nathan Sobo
ac1eb19f83 Start on text highlight support 2022-03-09 20:51:35 -07:00
Nathan Sobo
49e38e6e00 Eliminate ToFoldPoint trait
Just make it a method on FoldMap
2022-03-09 20:49:18 -07:00
Max Brunsfeld
a971306381 Reload the app settings whenever ~/.zed/settings.json changes 2022-03-09 18:00:09 -08:00
Max Brunsfeld
83f98dde52 Start work on loading settings from a file
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-09 17:59:29 -08:00
Keith Simmons
6ee0cceb14 Switch to using mouse navigation events instead of other in order to get rid of opaque button id 2022-03-09 15:04:04 -08:00
Max Brunsfeld
3dc100adfb Reset receive timeout only on reads from websocket connection, not writes
Also, increase the receive timeout to 30 seconds. We'll still respond immediately
to explicit disconnection, but when there are temporary network blips that
delay pings, we think we should err on the side of keeping the connection
alive. This is in response to a false positive 'host disconnected' state
that we observed when pairing today, while the host (Keith) still clearly
had a working internet connection, because we were screen sharing.

Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-09 11:27:47 -08:00
Keith Simmons
508c4df79b
Merge pull request #565 from zed-industries/eager-theme-selector
Make theme selector eagerly display the selected theme
2022-03-09 11:00:28 -08:00
Keith Simmons
5aad1ff788 formatting fixes 2022-03-09 10:42:27 -08:00
Keith Simmons
853acccbc2 Make theme selector match other selector styling 2022-03-09 10:40:30 -08:00
Keith Simmons
99e34db0ec ensure that we set original theme when dismissing theme selector and fix some minor edge cases 2022-03-09 10:34:52 -08:00
Antonio Scandurra
f15e3177d3
Merge pull request #569 from zed-industries/refine-autoclose
Refine bracket auto-closing behavior
2022-03-09 16:28:35 +01:00
Antonio Scandurra
97da93c9ec 💄 2022-03-09 15:44:58 +01:00
Antonio Scandurra
d9b3f04436 Surround selections with brackets when they are non-empty 2022-03-09 15:41:54 +01:00
Antonio Scandurra
f54ce8a19c Autoclose bracket only if next char is whitespace or the end of a pair 2022-03-09 15:38:17 +01:00
Antonio Scandurra
7546ede288 Split language server initialization from construction
This gives clients a chance to register to notifications.
2022-03-09 12:31:21 +01:00
Antonio Scandurra
ef1ec88523 Remove delegate support from GPUI
We added this because we thought it would save some allocations when
sending operations given that we could move them to the delegate upon
notifying it, but the reality is that we serialize operations and that
only requires a reference.
2022-03-09 10:48:52 +01:00
Antonio Scandurra
0a9595b5fa Notify all language servers only when a buffer is saved
Other notifications such as opening, closing or changing a document
are still tied to the buffer's language.
2022-03-09 10:44:03 +01:00
Keith Simmons
b440a51675 Make theme selector eagerly display the selected theme 2022-03-08 18:42:31 -08:00
Max Brunsfeld
4cb4b99c56 Assign buffer's completion triggers from LSP capabilities
Also, make LanguageServer::new() async. The future resolves
once the server is initialized.
2022-03-08 17:41:52 -08:00
Keith Simmons
fc36c706d3 Add missing mouse button events and mouse history navigation
Co-Authored-By: Max Brunsfeld
Co-Authored-By: Nathan Sobo
2022-03-08 15:45:36 -08:00
Antonio Scandurra
317a1bb07b Remove language servers from buffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-08 15:16:07 -08:00
Antonio Scandurra
6662ba62a3 Move DidSaveTextDocument notification from Buffer to Project 2022-03-08 11:35:54 +01:00
Antonio Scandurra
51d5ed48f0 Remove unused CloseBuffer message 2022-03-08 11:17:20 +01:00
Antonio Scandurra
d6c8fdb3c4 Send buffer operations via the Project instead of Worktree 2022-03-08 11:11:25 +01:00
Antonio Scandurra
b49951ac57 Implement {ModelHandle,ViewHandle}::become_delegate 2022-03-08 09:30:32 +01:00
Nathan Sobo
f2848a092b WIP: Start on a delegation... like events, but single consumer that takes ownership of event 2022-03-08 09:01:57 +01:00
Antonio Scandurra
03aa906068 v0.19.0 2022-03-08 08:18:51 +01:00
Max Brunsfeld
5cc5fa2f93 Populate environment from shell
Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-07 16:39:50 -08:00
Max Brunsfeld
bb6ab837cf
Merge pull request #542 from zed-industries/guest-disconnections
Send heartbeats in both directions so the server can detect when clients disconnect
2022-03-07 15:52:35 -08:00
Max Brunsfeld
1f5eab39a9 Reset peer's receive timeout when a message is received
* Make advance_clock more realistic by waking timers in order,
  instead of all at once.
* Don't advance the clock when simulating random delays.

Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-07 15:33:43 -08:00
Antonio Scandurra
e579da64c3 WIP: Introduce a read timeout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-07 17:08:12 +01:00
Nathan Sobo
40c0b9e7a5 Halt keystroke dispatch when a global action is dispatched 2022-03-06 09:46:33 -07:00
Antonio Scandurra
711de5edcb Ensure active_item_index doesn't go off the end when closing items
This fixes a bug introduced in #538, where closing the current tab would hide
all the other tabs, if the current tab was the last one.

Also, this commit manually sets the active item index instead of calling
`Pane::activate_item`: even though this introduces a little bit of duplication,
it prevents us from mistakenly calling `deactivate` on the wrong item. This would
happen because `activate_item` looks at `self.active_item_index` to determine
which item to deactivate before setting the new one. However, that index is
potentially invalid because `::close_items` manipulates the `item_views` vector,
so `activate_item` could end up calling `deactivate` on an item view that was
not active in the first place.
2022-03-05 10:52:55 +01:00
Antonio Scandurra
c7ddb66795
Merge pull request #538 from zed-industries/close-inactive-items
Implement close inactive items
2022-03-05 10:35:22 +01:00
Max Brunsfeld
4124308d94 Fix errors from conditional compilation in timer functions 2022-03-04 17:16:17 -08:00
Max Brunsfeld
fab115e549 Adjust test connection to treat the half-open state more realistically
When a network connection is lost without being explicitly closed by the
other end, writes to that connection will error, but reads will just wait
indefinitely.

This allows the tests to exercise our heartbeat logic.
2022-03-04 16:47:55 -08:00
Max Brunsfeld
9017a1363b Send websocket pings from both the client and the server
Remove the client-only logic for sending protobuf pings.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-04 15:21:18 -08:00
Max Brunsfeld
c61a1bd659 Make timer method available on both foreground and background executors
Also, make it return a static future.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 13:54:07 -08:00
Max Brunsfeld
1982a8c27d Put vector clock serialization logic alongside other serialization logic
This way, the `clock` crate doesn't depend on the `rpc` crate.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 13:54:07 -08:00
Max Brunsfeld
28bacabc4e Move Network test helper from util crate into text crate
This way, `util` does not depend on `clock`.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 13:54:07 -08:00
Nathan Sobo
8b9f41175b Use the macOS standard binding instead of VS Code's
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-04 10:39:11 -07:00
Nathan Sobo
3057b38fad Implement close inactive items action
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-04 10:36:51 -07:00
Nathan Sobo
a72d58a28c Merge branch 'main' into disconnected-status 2022-03-04 10:07:26 -07:00
Nathan Sobo
d59451fb08 Fix tests after font update
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-04 10:06:21 -07:00
Antonio Scandurra
c38de3243d 🎨
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:54:48 +01:00
Antonio Scandurra
38313abc48 Disable events when project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:37:37 +01:00
Antonio Scandurra
77e913b5a4 Blur focused view when project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:37:26 +01:00
Antonio Scandurra
b21d91db22 Render overlay after remote project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 17:28:18 +01:00
Nate Butler
38e32f368d Update zed fonts to 1.2.0 2022-03-04 11:05:34 -05:00
Antonio Scandurra
6ee5e96d7b
Merge pull request #534 from zed-industries/create-buffers-via-project
Open untitled buffers via the `Project`
2022-03-04 16:18:02 +01:00
Antonio Scandurra
29cad65ce0 Open untitled buffers via the Project
This allows the registration of such buffers in the project, which is necessary
to correctly support `::save_buffer_as` and opens the door to sharing untitled
buffers with guests in the future.

Note that, for now, this disallows guests to create untitled buffers in the
current window and will create a new window instead. This is because we don't
yet have a global way of allocating a buffer's remote id (nor a way of saving
such buffers in the host's worktree) and we instead rely on the local model ID,
which could clash with the host's buffer IDs.

I think we should revisit this once guests can share their untitled buffers
with the host and other remote peers, as well as once we start keying
operations by entry id.
2022-03-04 15:25:39 +01:00
Antonio Scandurra
d8ef3a5d61 Support formatting in fake LSP capabilities 2022-03-04 11:24:18 +01:00
Antonio Scandurra
46da80d726 Use LSP range formatting when document formatting is not available 2022-03-04 10:13:17 +01:00
Antonio Scandurra
dc5a09b3f7
Merge pull request #525 from zed-industries/preserve-worktrees
Grow worktrees monotonically when sharing and move most messages to the background
2022-03-04 09:48:18 +01:00
Antonio Scandurra
7c420050c7 Observe selection set lamport timestamps when deserializing buffer 2022-03-04 09:34:30 +01:00
Antonio Scandurra
bcd5c28833 Allow receiving diagnostic updates out of order 2022-03-04 09:27:49 +01:00
Max Brunsfeld
19658139b1 Avoid infinite loop when a language server fails to start 2022-03-03 18:13:38 -08:00
Max Brunsfeld
05df1dfae9 Disable doctests for all libraries
We don't use them, and they add a lot of noise to the test output
when running all tests in the workspace.
2022-03-03 16:15:56 -08:00
Max Brunsfeld
3c242a43d2 Wait for LSP capabilities to be initialized before checking them 2022-03-03 15:59:03 -08:00
Max Brunsfeld
78d96a05fc Make fake language servers have full capabilities 2022-03-03 15:42:29 -08:00
Max Brunsfeld
9999862016 Enable formatting feature of JSON language server
The feature doesn't work yet because the JSON language server
only supports *range* formatting, not document formatting.
We need to adjust our code to inspect the server's capabilities
and send range formatting requests instead when needed.

We're going to hold off on doing this right now, because it
will create merge conflicts with the `preserve-worktrees`
branch (#525)

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 14:16:58 -08:00
Max Brunsfeld
81627a0f14 Avoid sending unhandled LSP requests to JSON language server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 13:39:40 -08:00
Max Brunsfeld
0582c557e3 Add JSON language server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 13:29:25 -08:00
Max Brunsfeld
bf1153cedd Add syntax highlighting/auto-indent/outlines for JSON files
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 12:12:18 -08:00
Antonio Scandurra
556d9cc53f Correctly defer undo operations when messages arrive out of order
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-03 18:07:59 +01:00
Antonio Scandurra
410ee124af Maintain remote worktrees correctly when building updates
This accidentally regressed in 53327e2.
2022-03-03 16:13:17 +01:00
Antonio Scandurra
c613b22619 Ignore diagnostics received for invisible worktrees 2022-03-03 13:58:55 +01:00
Antonio Scandurra
d0d6916167 Move code action and completion edit messages to the background 2022-03-03 13:54:26 +01:00
Antonio Scandurra
14d26eeedc Move several buffer-related messages to the background 2022-03-03 12:18:19 +01:00
Antonio Scandurra
1c14168f38 Ensure no two worktrees can point to the same root path
This could happen because there was a pause between creating the worktree
and adding it to the list of tracked local worktrees, and so we might end
up adding the same worktree twice when calling `create_local_worktree` in
rapid succession.
2022-03-03 10:54:52 +01:00
Antonio Scandurra
d171d8ccc4 Change the definition of check_invariants
- On the host, ensure that only one worktree can exist for a given absolute
path. Asserting about buffers was cool but I think should be tackled in the
context of leaning more on entry ids for collaboration (vs. buffer ids).
- On the guest, ensure that all the opened buffers don't contain deferred
operations.
2022-03-03 10:51:37 +01:00