Commit Graph

1800 Commits

Author SHA1 Message Date
Antonio Scandurra
f832c0074f Fix memory leak in ListState 2022-05-30 18:29:51 +02:00
Antonio Scandurra
20e1044d49 Merge branch 'main' into project-panel-with-new-mouse-events 2022-05-30 18:29:46 +02:00
Antonio Scandurra
6c145b2abc Show keystrokes as uppercase 2022-05-30 12:23:03 +02:00
Antonio Scandurra
2b9015c096 Introduce {MutableAppContext,ViewContext}::observe_actions 2022-05-30 10:01:23 +02:00
Antonio Scandurra
e7ab61d125 Dismiss context menu when (right-)mousing down outside of it 2022-05-28 08:51:46 +02:00
Antonio Scandurra
fb26f8195b Sort mouse regions by their stacking context's depth 2022-05-28 08:45:10 +02:00
Nathan Sobo
44c8ee5709 Add mouse down out handlers
These will fire whenever the left/right mouse button is pressed down outside a specific region. I'll use these to cancel the context menu in the next commit.
2022-05-27 12:56:44 -06:00
Keith Simmons
48abbb7e63
Merge pull request #1019 from zed-industries/vim-visual-line-mode
Vim visual line mode
2022-05-27 11:22:56 -07:00
Nathan Sobo
9909fc529b Allow context menu to be cancelled after deploying it twice
Previously, two right clicks would cause an issue with cancelling the context menu via escape.
2022-05-27 12:00:11 -06:00
Nathan Sobo
c3baf2748f Block hovering behind overlays 2022-05-27 11:54:51 -06:00
Max Brunsfeld
04bd57b2c7 Add an API for setting a window's title
This controls how the window appears in the Window menu.
2022-05-27 10:45:55 -07:00
Nathan Sobo
5413a97c7e Restrict multiple hovered regions to a single stacking context
We won't hover regions from stacking contexts that are below the one being hovered.
2022-05-27 11:09:07 -06:00
Antonio Scandurra
9099c40364 Merge branch 'mouse-events' into project-panel-context-menu 2022-05-27 12:07:00 +02:00
Antonio Scandurra
be0e66ef21 Invoke mouse_down and right_mouse_down callbacks 2022-05-27 11:20:39 +02:00
Antonio Scandurra
7c7917494c Don't dispatch events down the tree if they were handled by mouse region 2022-05-27 11:20:32 +02:00
Antonio Scandurra
1d7fc12229 Add right-click support to MouseEventHandler 2022-05-27 10:47:54 +02:00
Antonio Scandurra
307eb1726c Compute dispatch path based on the view id that dispatched the action 2022-05-27 09:59:24 +02:00
Nathan Sobo
aedfd74d30 Use the hit bounds when painting mouse regions 2022-05-26 20:05:20 -06:00
Nathan Sobo
893f15ddab Switch MouseEventHandler to use MouseRegions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 20:00:01 -06:00
Nathan Sobo
50edcb06dd Add drag callbacks to mouse regions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:59:38 -06:00
Nathan Sobo
bd62a68234 Eliminate ElementStateContext trait
We now always have a RenderContext when rendering MouseEventHandlers or scrollable Flex columns/rows.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:37:28 -06:00
Nathan Sobo
b6b16fc9c3 In UniformList, guard against misbehavior of append_items
If for some reason the handle got dropped and we call it, we'll deal with it somewhat gracefully.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:30:28 -06:00
Nathan Sobo
8dd82fdce1 Take a RenderContext in ListState's build item callback
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:23:44 -06:00
Nathan Sobo
2ea085b178 Pass a RenderContext to UniformList
In some cases, we need to render during layout. Previously, we were rendering with a LayoutContext in some cases, but this commit adds the ability to retrieve a render context with a given handle and we use that feature in UniformList.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:03:34 -06:00
Keith Simmons
61f0daa5c5 Visual line mode handles soft wraps 2022-05-26 17:02:05 -07:00
Nathan Sobo
d69776585d Add mouse_state method to RenderContext
We can use this to determine if a region is hovered or clicked.
2022-05-26 13:22:23 -06:00
Nathan Sobo
3a59d2a331 Allow hovered and clicked mouse regions to be tracked in the presenter 2022-05-26 12:44:52 -06:00
Nathan Sobo
0866f0ed55 Introduce CursorRegion struct
This will blend in with an upcoming MouseRegion struct that sits next to it in the scene.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-26 11:00:10 -06:00
Antonio Scandurra
82ddac8e7e Restore focus when closing context menu 2022-05-26 15:21:55 +02:00
Antonio Scandurra
580f1a4125 Style context menu 2022-05-26 10:40:53 +02:00
Antonio Scandurra
a8483ba458 WIP 2022-05-26 09:59:25 +02:00
Antonio Scandurra
3b2f1644fb Constrain context menu to the width of the widest item
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-26 09:59:25 +02:00
Nathan Sobo
5b7825d5de Add MutableAppContext::keystrokes_for_action
This can be used to lookup keystrokes that will dispatch an action based on the currently focused view. There might be multiple, but we return the first found, meaning the most recently added bindings matching that action for the closest view to the focused view in the hierarchy.
2022-05-26 09:59:25 +02:00
Nathan Sobo
b110fd5fb7 Render a context menu when right-clicking in project panel
It doesn't currently do anything, but I managed to get it rendering in an absolutely positioned way.
2022-05-26 09:59:25 +02:00
Antonio Scandurra
3ac6fc89c1 Pretty-print JSON of server snapshot 2022-05-26 09:34:39 +02:00
Max Brunsfeld
fbd589b589 Start work on handling multibuffers properly when closing unsaved buffers 2022-05-22 16:48:33 -07:00
Max Brunsfeld
b72d97ce78 Disable menu item key equivalents while there are pending keystrokes 2022-05-20 10:04:43 -07:00
Max Brunsfeld
21862faa58 Convert function keys to the correct macOS codes for menu items 2022-05-19 17:37:46 -07:00
Max Brunsfeld
ea85473f4f Enable and disable application menu items based on the active view 2022-05-19 16:50:40 -07:00
Max Brunsfeld
ef0b584532 Remove AppState from workspace actions
This allows those actions to be bound to keystrokes in the keymap.
Also, remove the WorkspaceParams struct, simplify how Workspaces are
constructed.
2022-05-19 14:37:26 -07:00
Max Brunsfeld
7445197f4d Derive application menu key equivalents from the keymap 2022-05-19 10:04:01 -07:00
Antonio Scandurra
225536accc Merge branch 'main' into request-to-join-project 2022-05-17 14:55:20 +02:00
Antonio Scandurra
e0c772db3e Hold a weak handle to Presenter when dispatching events
This ensures that the only strong reference to the presenter is held
by `App`. This is important because we want to call `flush_effects`
when removing a window and implicit drops of the `Presenter` would
make that hard.

Before this commit, if a rendered view contained strong handles to
views and models, we would only drop them on the next `flush_effects`.
This was manifesting itself in `Project`s not being released when
closing their containing window.
2022-05-17 13:04:38 +02:00
Nathan Sobo
d821e7a4c1 Cancel join requests when the requester closes the window 2022-05-16 20:29:36 -06:00
Antonio Scandurra
aa90c06012 Display a temporary window while remote project is loading 2022-05-16 17:45:50 +02:00
Nathan Sobo
a620665bed Only synthesize mouse moves on scene construction if window is active 2022-05-13 14:05:13 -06:00
Max Brunsfeld
be51a58311 Start work on requesting to join projects
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-12 17:53:11 -07:00
Antonio Scandurra
933a1f2cd6 Show badge when there are pending contact requests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-11 17:39:03 +02:00
Nathan Sobo
eef99f059d Make flex elements fill available space when they contain a float
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-10 06:14:30 -06:00
Antonio Scandurra
95d848fe1e Ensure flex_float works even when re-painting without layout
Previously, we were mutating the remaining space stored on the layout
state, which would cause re-paints to always have a `remaining_space`
of 0 and therefore not align `flex_float` elements to the right/bottom.
2022-05-06 10:20:03 +02:00
Max Brunsfeld
8445eaab85 Fix crash when emptying atlases
Previously, when an atlas was emptied, we would move it into a different
vector: free_atlases. This removal could cause existing atlas ids to
refer to the wrong atlases.
2022-05-05 17:52:47 -07:00
Antonio Scandurra
61346f734d WIP 2022-05-05 15:15:58 +02:00
Max Brunsfeld
657ea264cc Allow guests to create files from the project panel
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-04 10:28:44 -07:00
Antonio Scandurra
09a8b8e675 Capture crash reports and upload them the next time Zed launches 2022-05-02 15:17:43 +02:00
Antonio Scandurra
cddafa5fef
Merge pull request #940 from zed-industries/telemetry
Instrument the collab server with OpenTelemetry collecting into Honeycomb.io
2022-04-29 17:50:55 +02:00
Antonio Scandurra
7ec5c04fdf Correctly alpha-blend border and background in quad SDF 2022-04-28 13:54:18 +02:00
Nathan Sobo
36b462182b Send telemetry to Honeycomb via GRPC
We updated the core-foundation crates because Tonic (the GRPC crate) relies on a newer version of core foundation to find TLS root certificates.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-27 09:58:55 -06:00
Nathan Sobo
1293b21b2d Get db tests passing with Tokio Postgres adaptor
We now run tests that interact with the real database under a Tokio reactor. We make the tests run multi-threaded so we can block on the main thread on database teardown and still make progress actually tearing down the DB.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-04-26 13:30:21 -06:00
Max Brunsfeld
065734e1de
Merge pull request #898 from zed-industries/track-window-focus
Focus/blur views when application windows become active/inactive
2022-04-25 08:54:47 -07:00
Nathan Sobo
ac6880b6ee Only set the cursor style once per mouse move event
This will hopefully prevent some of the intermittent flickering we seem to be seeing.
2022-04-22 18:57:49 -06:00
Max Brunsfeld
e8d263274c Remove duplication between windowDid{Become,Resign}Key callbacks 2022-04-22 15:06:50 -07:00
Max Brunsfeld
6b9e93ac6d Fix double-borrow crash by calling window activated callback asynchronously 2022-04-22 15:01:19 -07:00
Max Brunsfeld
7f64076f8d Focus/blur views when application windows become active/inactive 2022-04-22 14:18:50 -07:00
Nathan Sobo
92f040df00 Apply cursor styles during paint
This makes the editor's cursor an IBeam and properly deals with nested cursor styles.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-22 10:54:18 -06:00
Antonio Scandurra
3def7a6803 Avoid flicker when toggling project browser on workspace open 2022-04-22 11:53:45 +02:00
Max Brunsfeld
066b4faf61 Restructure KeyMap file, make it easy to edit in Zed
Add a JSON schema for this file so that autocomplete can be used for the actions.
2022-04-21 13:35:10 -07:00
Antonio Scandurra
fb87bacc7e Merge branch 'main' into auto-update 2022-04-21 09:53:06 +02:00
Antonio Scandurra
a210b05d00 Remove App::on_open_files, as it's a subset of on_open_urls
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-20 17:36:27 +02:00
Antonio Scandurra
f7055c2acc Implement zed --wait 2022-04-20 17:28:31 +02:00
Max Brunsfeld
fbd1afc51f Add a command for installing the CLI 2022-04-20 17:27:33 +02:00
Nathan Sobo
75f0326e54 Use ipc_channel crate to communicate between cli and app
We still aren't handling CLI requests in the app, but this lays the foundation for bi-directional communication.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-04-20 17:15:46 +02:00
Antonio Scandurra
01eb2dce24 WIP: Start on a new cli crate
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-20 17:15:45 +02:00
Max Brunsfeld
c56e2ead23 Fix hang when dropping ::scoped future under deterministic executor
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-18 17:11:39 -07:00
Max Brunsfeld
d0413ac0e1 Fix crash when dropping a task that is awaiting a call to Background::scoped
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-18 17:11:39 -07:00
Max Brunsfeld
3901d9d544 Display key bindings in the command palette
They still need to be styled.

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-04-18 17:11:08 -07:00
Max Brunsfeld
4630071f58 Start work on a command palette 2022-04-18 17:11:08 -07:00
Max Brunsfeld
99f8466cb5 Add a gpui method for listing the available actions 2022-04-18 17:11:07 -07:00
Antonio Scandurra
77d3cc359e Fix tests 2022-04-14 18:50:45 +02:00
Antonio Scandurra
5a8297a02f Introduce ViewContext::observe_focus 2022-04-14 18:22:55 +02:00
Nathan Sobo
27057fdb1b Only process a single focus effect per batch
This allows us to focus the query editor of the project search when deploying it. Previously, a complex interplay between focus events was preventing this from working in an intuitive way. What happened previously:

- We'd activate the project search, which enqueued a focus effect for the project search view
- We'd focus the query editor, which enqueued an effect
- We'd process the focus effect for the search view, which would enqueue an effect to transfer focus to the results editor
- We'd process the effect to focus the query editor
- We'd process the effect to focus the results editor

Now...

- We activate the project search pane item, enqueuing a focus effect for the project search itself
- We focus the query editor and *remove* the previous pending focus change effect
- We process the focus effect
2022-04-14 08:52:24 -06:00
Keith Simmons
4b55b578b2 Don't panic when allocating tiny_skia pixmap 2022-04-13 14:57:16 -07:00
Antonio Scandurra
8e89074714 Reduce allocations when caching fonts
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-13 19:06:34 +02:00
Antonio Scandurra
cdcdccfb89 Render emojis
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-13 17:31:10 +02:00
Antonio Scandurra
fff1d9c631 Implement glyph scaling in a way that works with emojis as well 2022-04-13 15:56:32 +02:00
Keith Simmons
4249b5687e Implement font fallback in layout_line
Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-04-13 11:42:19 +02:00
Antonio Scandurra
6cc9306f00 Make room for font subpixel variants correctly 2022-04-13 11:36:54 +02:00
Antonio Scandurra
6b629dfa5c Use CTFont::draw_glyphs to rasterize glyphs
This API supports rendering emojis in addition to normal glyphs.
2022-04-12 19:37:26 +02:00
Max Brunsfeld
949fbe7cd3 Allow dumping the project diagnostic view's state as JSON
Also, improve DebugElements action so that it shows the JSON in an editor.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-04-11 19:51:46 -07:00
Max Brunsfeld
a754c3015f
Merge pull request #762 from zed-industries/safer-atlas-allocation
Safer Atlas Allocation
2022-04-11 17:42:53 -07:00
Max Brunsfeld
be11f63f1e Watch ~/.zed/bindings.json file for custom key bindings
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-11 16:50:44 -07:00
Max Brunsfeld
92a5c30389 Merge branch 'main' into load-keymaps 2022-04-11 15:55:10 -07:00
Keith Simmons
0ca4c9946a Add logging when atlas allocator fails to allocate 2022-04-11 10:31:38 -07:00
Keith Simmons
7abd3a98a8 Make atlas allocation fallable and skip rendering icons and paths when it fails 2022-04-11 10:15:49 -07:00
Max Brunsfeld
3636c9ec25 Load workspace and editor key bindings from a JSON file 2022-04-10 11:18:08 -07:00
Nathan Sobo
17195e615e
Merge pull request #781 from zed-industries/structured-logging
Introduce structured logging
2022-04-09 07:40:24 -06:00
Max Brunsfeld
fd4b81c8fc Allow actions to be deserialized from JSON
Introduce separate macro for implementing 'internal' actions which
are not intended to be loaded from keymaps.
2022-04-08 15:47:51 -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
Max Brunsfeld
5242a3a6dc Restructure action macro to assign a namespace to every action
Also, allow arbitrary types to be used as Actions via the impl_actions macro

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-07 16:20:49 -07:00
Antonio Scandurra
b396909035 Calculate hitbox based on visible bounds in {Mouse}EventHandler
This is in contrast to not dispatching the event altogether in `Flex` when
the event is not contained in the flex element bounds. That approach was
problematic because it didn't give an opportunity to `MouseEventHandler`s
to handle mouse move events when they didn't intersect with the element bounds,
causing elements to never clear their hover state, cursor style, etc.
2022-04-07 15:12:09 +02:00
Antonio Scandurra
73f2fd6b09 Pass visible bounds to Element::dispatch_event 2022-04-07 15:10:09 +02:00
Antonio Scandurra
ae415ee49b
Merge pull request #763 from zed-industries/inconsistent-diagnostic-state
Fix bad diagnostic state when restarting a language server w/ a running diagnostic task
2022-04-07 09:54:00 +02:00
Antonio Scandurra
52251c3463
Merge pull request #745 from zed-industries/scroll-tabs
Allow pane tabs to be scrolled when they overflow
2022-04-07 09:48:54 +02:00
Max Brunsfeld
b354af7bda Use an unbounded channel in gpui test helper methods
The bounded channel could fill up when many events were emitted in one
effect cycle.
2022-04-06 22:02:04 -07:00
Keith Simmons
1812480cbb Tab size is pulled properly from settings instead of hardcoded 2022-04-06 10:23:37 -07:00
Nathan Sobo
0214bec7f4 Don't dispatch events to flex children outside of parent flex's bounds 2022-04-06 10:59:03 -06:00
Antonio Scandurra
1453954ef4 Autoscroll to active tab when activating a new item 2022-04-06 09:08:44 +02:00
Nathan Sobo
eb99588368 Remove stray dbg! expressions 2022-04-05 20:02:45 -06:00
Nathan Sobo
ab3bbe1e17 Make the tabs scrollable when they overflow
This adds the ability to make a Flex element scrollable by passing a type tag and instance id, which we use to store the scroll position in an ElementStateHandle.

Still need to allow the element to auto-scroll.
2022-04-05 19:58:15 -06:00
Nathan Sobo
025d857be8 Make UniformListState an Rc<RefCell<>> instead of an Arc<Mutex<>>
We don't need to support multiple threads.
2022-04-05 18:40:25 -06:00
Nathan Sobo
aeb0b42c7a Report more information when we panic due to an allocation failure 2022-04-05 13:53:13 -06:00
Nathan Sobo
4f4364d510 Ensure we drop the last pane item
Previously, we weren't updating the toolbar's active item when emptying out a pane. This enhances an integration test to ensure that we don't hold references to any editors or buffers once we close everything.
2022-04-05 13:05:14 -06:00
Nathan Sobo
41a27e6925 💄 2022-04-05 12:09:40 -06:00
Nathan Sobo
e2bf89b1e8 Don't require a path in TestAppContext::dispatch_action
Instead, derive it from the presenter. This makes tests easier to write and more reliable since we'll be accurately simulating the actual relationship between parent and child views.
2022-04-05 12:08:25 -06:00
Antonio Scandurra
61c479ebc8 Pass an NSString to objectForInfoDictionaryKey 2022-04-05 10:02:37 +02:00
Max Brunsfeld
e566a8335f Find path to running app using [NSBundle bundlePath] 2022-04-04 20:53:46 -07:00
Nathan Sobo
66544d54f2 Drop borrow to window state before calling beginSheetModalForWindow
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-04-04 16:18:28 -06:00
Antonio Scandurra
38e902b241 WIP: Start on auto-update
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-04-04 18:59:57 +02:00
Antonio Scandurra
dee416bdbe Avoid text insertion when holding down the fn key 2022-04-04 11:13:35 +02:00
Nathan Sobo
903810f22e Style search in buffer below breadcrumbs
We still have issues with project search styling.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-31 11:44:16 -06:00
Antonio Scandurra
0453dd1101 Allow flex items to float to the end of the flex axis
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-30 16:46:14 +02:00
Antonio Scandurra
0cd356ce06
Merge pull request #689 from zed-industries/format-timeout
Skip formatting during save if it takes too long
2022-03-28 16:17:56 +02:00
Antonio Scandurra
f69bd0e327 Snap icon sprites to pixel grid
This should resolve some rendering artifacts potentially caused by
floating point errors when sampling the texture. It should also lead
to crisper images when icons are rendered midway through a pixel.
2022-03-28 11:52:13 +02:00
Antonio Scandurra
26aa138429 Fire fake timers waking up at the same time as the current clock 2022-03-28 10:57:52 +02:00
Nathan Sobo
daf999c3be Fully disable vim mode on start unless it's enabled
Also: Make some structural adjustments to remove the need for defer. Instead of accessing the global in associated VimState functions, have a single method that allows us to call update instance methods.
2022-03-26 19:19:12 -06:00
Keith Simmons
bb9b36dccd Add initial vim mode mode switching
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:37 -07: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
Keith Simmons
454f7a570c Add global change observations 2022-03-23 09:14:12 -07:00
Antonio Scandurra
3298529ed1 Fix global nested event test after turning subscriptions into effects 2022-03-23 09:14:33 +01: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
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
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
Max Brunsfeld
e338da0271 Allow clicking a titlebar avatar to initiate following 2022-03-18 13:37:07 -07:00
Antonio Scandurra
10e6d82c3e WIP: Start on sending view updates to followers 2022-03-18 14:20:09 +01:00
Max Brunsfeld
eda06ee408 Add AnyWeakViewHandle 2022-03-17 17:53:38 -07: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
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
aced1e2315 Finish refactoring of how editors are opened 2022-03-17 11:29:46 +01: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
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
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
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
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
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
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
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
951fd1ab36 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07: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
Keith Simmons
144591d639 Minor renames for clarity 2022-03-11 11:25:36 -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
Nathan Sobo
a498cd32c8 When renaming, match the color of the renamed token in the rename editor 2022-03-10 16:38:45 -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
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
Nathan Sobo
ac1eb19f83 Start on text highlight support 2022-03-09 20:51:35 -07: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
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
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
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
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
Nathan Sobo
40c0b9e7a5 Halt keystroke dispatch when a global action is dispatched 2022-03-06 09:46:33 -07:00
Max Brunsfeld
4124308d94 Fix errors from conditional compilation in timer functions 2022-03-04 17:16:17 -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
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
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
5c1aff1143 Don't insert input into editors when control or command keys are held
This is a follow-up to #475
2022-03-02 14:09:46 -08:00
Antonio Scandurra
141e0559a5 Fix warnings 2022-03-02 12:45:49 +01:00
Antonio Scandurra
3ec76b63d3 Make dhat optional 2022-03-02 11:02:10 +01:00
Antonio Scandurra
51345cf1e1 Advance clock when simulating random delay 2022-03-02 10:39:46 +01:00
Antonio Scandurra
be7a4770fb Delete timer state when the future that's awaiting it gets dropped 2022-03-02 10:08:38 +01:00
Max Brunsfeld
8b7a9367fa Avoid storing type name string on AnyViewHandle
It won't be needed for leak error messages, because the typed
view handle will typically be created first. And this avoids
increasing the size of the handle used in production.
2022-03-01 18:22:09 -08:00
Antonio Scandurra
a25f21df39 Remove debug_elements_callbacks from App
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-01 19:16:58 +01:00
Antonio Scandurra
bc9c034baa Fix Presenter leak when removing windows 2022-03-01 18:50:05 +01:00
Antonio Scandurra
83a3402235 Make TestAppContext and its dependencies available only in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 17:01:52 +01:00
Antonio Scandurra
0d6f6bf5bb Detect when view handles are leaked
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 16:11:12 +01:00
Antonio Scandurra
aa03ebce0e Enable leak backtraces by setting LEAK_BACKTRACE=1
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 16:00:40 +01:00
Antonio Scandurra
466db69780 Pass a reference to TestAppContext in tests
This allows us to drop the context *after* we ran all futures to
completion and that's crucial otherwise we'll never drop entities
and/or flush effects.
2022-03-01 12:01:02 +01:00
Antonio Scandurra
8390f04e7d Allow capturing references in the future passed to Deterministic::run 2022-03-01 11:59:58 +01:00
Antonio Scandurra
7ce6f23ed4 Remove all windows on dropping TestAppContext
This allows us to remove the dropped entities and flush effects as
necessary.
2022-03-01 10:55:12 +01:00
Antonio Scandurra
10a872a370 Avoid reference cycle between Client and its models 2022-03-01 10:55:05 +01:00
Max Brunsfeld
471ecae82c WIP - include dhat for memory profiling tests 2022-02-28 22:52:21 -08:00
Max Brunsfeld
c09921e790 Clear the executor at the end of a test by running until it is parked 2022-02-28 22:20:03 -08:00
Max Brunsfeld
426e0e3d4f Flush effects when dropping a TestAppContext
This way, at the end of a test, dropped entities will be removed, and will drop
the handles that they hold.
2022-02-28 22:17:20 -08:00
Max Brunsfeld
7d53e37672 Start work on detecting leaked handles in tests
For now, just track models. Tests fail because we don't
yet clear the app contexts at the right time.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-28 22:02:43 -08:00
Nathan Sobo
cb230ad574 Re-activate the most recently-activated project search on cmd-shift-F
This commits adds the beginnings of an application state facility as a non-static place to store the most recently-activated search for each project.

I also store workspace items by descending order of their entity id so that we always fetch the newest item of a given type when calling `Workspace::item_of_type`.
2022-02-27 18:07:46 -07:00
Nathan Sobo
71241b1fb8 Add capture phase for action dispatch
Just like the DOM, we now bubble events down the tree during a capture phase before bubbling them back up.
2022-02-27 16:14:40 -07:00
Nathan Sobo
ed6c8b1836 Allow actions to be propagated from nested ViewContexts
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:14:16 -07:00
Nathan Sobo
d5cc3fea3d Implement Debug for keymap::MatchResult
Helpful when debugging issues with keystroke dispatch.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:13:53 -07:00
Nathan Sobo
618f0a127a Don't insert input in editor when control keys are pressed 2022-02-21 18:21:27 -07:00
Antonio Scandurra
38e4ec9157 Replace Inconsolata with Zed Mono and Zed Sans 2022-02-18 14:55:11 +01:00
Max Brunsfeld
10580f96a3 Automatically include current view id in element state ids 2022-02-17 13:44:46 -08:00
Antonio Scandurra
1fbcea6c0d Randomly detach requests on guest to let them race with other local ops 2022-02-17 09:05:06 +01:00
Antonio Scandurra
7c5a5c4ad4 Print the correct seed on randomized test failure 2022-02-16 16:29:45 +01:00
Antonio Scandurra
38f225b575 Clean db pool on drop only if assertions fail or it's the last iteration 2022-02-16 15:07:41 +01:00
Max Brunsfeld
1ca1595490 Add AnyWeakModelHandle
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-15 17:56:50 -08:00
Max Brunsfeld
34bba303dc In random collaboration test, add failing assertion for worktree convergence 2022-02-15 14:55:38 -08:00
Antonio Scandurra
a11495af19 Start on a randomized integration test 2022-02-15 17:33:43 +01:00
Antonio Scandurra
c33d554675 Don't render sample item twice in UniformList 2022-02-15 12:02:58 +01:00
Max Brunsfeld
ddc1f237a6 Panic if element state is used twice in the same frame
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 14:04:27 -08:00
Antonio Scandurra
1eea2f3653 Add integration test for code actions 2022-02-14 11:42:56 +01:00
Antonio Scandurra
5a7d391d73 Ensure response barrier is always dropped, even if request is canceled 2022-02-12 10:23:50 +01:00
Antonio Scandurra
2fcdcac080 Fetch code actions on cursor movement instead of on-demand
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 14:41:19 +01:00
Max Brunsfeld
e0fe8b5a7c Merge branch 'main' into assists 2022-02-08 12:41:57 -08:00
Max Brunsfeld
e3f055d950 Use a pool of databases to speed up integration tests
Also, use env_logger consistently in the tests for each crate.
Only initiallize the logger at all if some RUST_LOG env var is set.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:00:00 -08:00
Nathan Sobo
dc20be256e Start on code action confirmation 2022-02-05 12:37:34 -07:00
Max Brunsfeld
16acbd2123 Handle appkit's cancelOperation: message to allow binding cmd-. 2022-02-04 17:33:09 -08:00
Antonio Scandurra
625beaaa9b Finish writing test for the new autocompletion behavior
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 15:47:19 +01:00
Antonio Scandurra
ae5aebf405 Fix flaky test_highlighted_ranges due to random TypeId ordering 2022-02-02 10:09:12 +01:00
Antonio Scandurra
b89a39bcb3 Filter and sort suggestions in autocomplete
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 15:11:20 +01:00
Max Brunsfeld
c19d639e0a Derive autocomplete menu's width from the width of its largest item
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:01:20 -08:00
Nathan Sobo
960696a504 Bind autocomplete to ctrl-space
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-31 11:34:19 -07: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
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
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
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
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
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
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
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
93125cbd16 Remove executor::Foreground::Test
All code paths have already transitioned to `Foreground::Deterministic`.
2022-01-24 16:14:30 +01: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
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
Nathan Sobo
19751e9200 Merge remote-tracking branch 'origin/main' into go-to-definition 2022-01-21 11:12:38 -07:00
Antonio Scandurra
e5662dd426 Allow observing the release of entities
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 14:34:14 +01:00
Nathan Sobo
fbca28337a When opening a path in an existing window, move it to the foreground 2022-01-20 20:45:30 -07:00
Antonio Scandurra
634340dd84 Return a task from Workspace::save_active_item
This required changing our approach to OS prompts and this commit greatly
simplifies that. We now avoid passing a callback and return a simple future
instead. This lets callers spawn tasks to handle those futures.
2022-01-20 09:51:29 +01:00
Max Brunsfeld
f3239fe1d5 Apply scroll_max after uniform list autoscrolls 2022-01-14 11:56:28 -08:00
Max Brunsfeld
dd8e5ee543 Add bottom margin to the outline view 2022-01-14 11:01:20 -08:00
Max Brunsfeld
b7561c6cef Add select_first and select_last bindings to outline view
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-14 10:45:37 -08:00
Antonio Scandurra
ce51196eab Center the selected item when updating outline query
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-14 17:53:06 +01:00
Max Brunsfeld
adeb7e6864 Incorporate syntax highlighting into symbol outline view
Still need to figure out how to style the fuzzy match characters
now that there's syntax highlighting. Right now, they are
underlined in red.
2022-01-13 18:10:02 -08:00
Max Brunsfeld
ed88fdcea2 Add unit test for diagnostic + path header ordering 2022-01-12 11:34:57 -08:00
Max Brunsfeld
ce6f3d7f3e Reuse views when moving between diagnostic view and editors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 11:00:12 -08:00
Antonio Scandurra
794d214eee Refactor opening workspace items
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-07 17:38:37 +01:00
Max Brunsfeld
2b36ab0de7 Introduce Expanded element
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-06 17:35:45 -08:00
Max Brunsfeld
1f762e482d Unify Flexible and Expanded elements
We'll use the name Expanded for something else now.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-06 17:29:34 -08:00
Nathan Sobo
943571af2a Report backtraces of pending conditions when deterministic executor illegally parks
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-06 13:33:55 -07:00
Nathan Sobo
d7a78e14ac Allow disk-based diagnostic progress begin/end events to interleave
When multiple saves occur, we can have multiple start events followed by multiple end events. We don't want to update our project diagnostics view until all pending progress is finished.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-06 09:32:08 -07:00
Antonio Scandurra
1875a0e349 Polish rendering of inline errors
- Don't soft-wrap
- Render multiple lines

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-06 16:17:53 +01:00
Max Brunsfeld
8728d3292d Merge branch 'main' into polish-project-diagnostics
Also fix false failure in ModelHandle::condition when parking is not forbidden.
2022-01-05 10:53:18 -08:00
Max Brunsfeld
d8b888c9cb Replicate diagnostic summaries
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-04 14:29:22 -08:00
Max Brunsfeld
f5d4e26799 Remove unused context variable 2021-12-27 15:34:07 -08:00
Nathan Sobo
e9a750be71 Don't merge keymap contexts from containing elements
Co-Authored-By: Aaron Hillegass <charmedliferaft@gmail.com>
2021-12-24 16:44:35 -07:00
Max Brunsfeld
466a377e1d Merge branch 'main' into share-project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-20 11:42:59 -08:00
Max Brunsfeld
614ee4eac7 Send worktree info only when sharing worktree
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-20 11:36:59 -08:00
Nathan Sobo
ab5db0bc1e Fix warnings and tests 2021-12-18 11:06:07 -07:00
Nathan Sobo
cd65031cda Halt keystroke dispatch immediately when we call a global action handler
Someday, we may want to define a global action context that allows us to propagate the action, but this isn't currently supported. Previous to this commit, we were invoking the same global action handler multiple times, once for each view in the responder chain.
2021-12-18 08:12:08 -07:00
Max Brunsfeld
026c3476db Upgrade tree-sitter to 0.20.1 2021-12-05 21:37:08 -08:00
Antonio Scandurra
45d1690f6e Use 16-bit float to store path windings
Previously, we were using a normalized 8-bit unsigned integer which forced us
to represent each increment of the winding number as a fraction of the max
value (1 / 255) which we would then add up using additive alpha blending.

This had three major drawbacks:

- The max winding number could not be greater than 255.
- Adding up (1 / 255) several times could result in a loss of precision.
- Due to also computing anti-aliasing as a fractional winding number, we had to
  reduce the max winding number to 32. This was still not good enough because
  we would multiply a fractional value with `1 / 32`, thus introducing more and
  more loss of precision.

This commit changes the texture type to an `f16` which doesn't require the
division by 255 and enables greater precision in the computation of the
anti-aliased parts of a curve. Note how this also removes the limitation of 255
windings at most per curve. The tradeoff is paying twice as much memory for
storing the texture, but that seems totally valid to achieve rendering accuracy.

Note that this kind of texture should be compatible with WebGL2 once we start
working on a web version of Zed.
2021-12-05 11:17:26 +01:00
Antonio Scandurra
3426d46b69 Clear pending keystrokes after dispatching an action
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-03 17:59:46 +01:00
Antonio Scandurra
0e93bc41dd In add_option_view, avoid bumping view's ref counts if view is None
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-03 17:52:39 +01:00
Max Brunsfeld
0c714210ff Start work on generalizing the BlockMap to allow arbitrary elements
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 15:25:55 -08:00
Nathan Sobo
1445ce10b5 Name the root file of every crate after the crate to ease navigation
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:46:39 -07:00
Max Brunsfeld
5ec003530f Consolidate pending effects logic into MutableAppContext::update
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 14:16:19 -08:00
Max Brunsfeld
4cc1556ca4 Introduce weak_handle methods on ModelContext and ViewContext
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 14:13:22 -08:00
Max Brunsfeld
88e0fe6f88 Paint highlighted lines correctly when horizontally scrolled 2021-11-29 11:28:43 -08:00
Nathan Sobo
fbc307cd5e Associate collaborator avatars with "ribbons" corresponding to their cursor color 2021-11-28 13:25:05 -07:00
Antonio Scandurra
d19d3bbe45 Calculate an overshoot when mousing to build columnar selections 2021-11-24 10:28:32 +01:00
Nathan Sobo
e0bf5337ca
Merge pull request #244 from zed-industries/mouse-selections
Improve support for selecting text via the mouse
2021-11-23 18:11:04 -07:00
Max Brunsfeld
294769be35 Add outdent command, fix indent bugs 2021-11-23 16:44:05 -08:00
Nathan Sobo
73afb29b04 Use alt modifier instead of cmd to add selections 2021-11-23 16:23:30 -07:00
Nathan Sobo
d969f38850 Implement shift-click to extend the newest selection 2021-11-23 15:42:21 -07:00
Max Brunsfeld
091ed9ab47 Maximize new windows 2021-11-23 10:24:31 -08:00
Antonio Scandurra
bcf38e6bb5 Implement word-wise mouse selection
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-23 18:50:17 +01:00
Antonio Scandurra
005a7076af Expose a count field on Event::LeftMouseDown 2021-11-23 16:18:17 +01:00
Max Brunsfeld
4002be882f Clear sprite cache when scale factor changes 2021-11-22 16:47:51 -08:00
Max Brunsfeld
23fbeaf978 Include scale factor in glyph cache keys 2021-11-22 16:37:01 -08:00
Max Brunsfeld
447f710570
Merge pull request #226 from zed-industries/1d-block-map
Allow full diagnostic messages to be displayed in the editor
2021-11-19 09:16:49 -08:00
Max Brunsfeld
0b63d882ce Allow key bindings to F1 through F12 2021-11-18 14:23:36 -08:00
Antonio Scandurra
0a6293bcda Support highlighting in blocks
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 14:08:21 +01:00
Nathan Sobo
0ff87e603f Give the MouseEventHandlers for each tab bar their own id
This fixes a beachball where we oscillate back and forth between hovered and unhovered due to confusing two different tab bars as the same tab bar.
2021-11-03 19:15:55 -06:00
Antonio Scandurra
a26b066788 Introduce a status bar and add the cursor position to it
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-03 17:27:51 +01:00
Nathan Sobo
2c57703ad6 Explicitly shut down language servers when quitting the app
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-02 13:16:25 -06:00
Antonio Scandurra
f5aa07aac9 Remove all windows before quitting
This gives all entities a chance of running `Drop::drop` which,
in turn, could cause them to spawn a critical task. For example,
we use this capability when a language server is dropped and we
need to asynchronously send a shutdown message.
2021-11-02 14:55:31 +01:00
Max Brunsfeld
b8994c2a89 Add a facility for delaying quit until critical tasks finish
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-01 11:57:31 -07:00
Max Brunsfeld
4069db4959 Allow underlines to have different color than the text
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 12:46:46 -07:00
Antonio Scandurra
59ed535cdf Implement a more robust way of locating rust-analyzer
When bundled, we will retrieve it out of the `Resources` folder.
Locally, we're expected to run `script/download-rust-analyzer` and
put `vendor/bin` in our $PATH.
2021-10-25 11:02:35 +02:00
Antonio Scandurra
2c6aeaed7c Start on integrating rust-analyzer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-21 16:26:37 +02:00
Antonio Scandurra
f09798c4a7 Use the same test::run_test function for async gpui::tests 2021-10-05 18:04:22 +02:00
Antonio Scandurra
9c7ef39da6 Minimize code generation for synchronous gpui::test macro
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-05 17:47:46 +02:00
Antonio Scandurra
499616d769 Move workspace module into its own crate 2021-10-05 13:49:10 +02:00
Max Brunsfeld
94209d2b6d Rename rpc_client -> client
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 17:14:21 -07:00
Max Brunsfeld
75cf2488db List path dependencies first in all Cargo.toml files
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 15:36:52 -07:00
Nathan Sobo
fdfed3d7db Move all crates to a top-level crates folder
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-10-04 13:22:21 -06:00