Compare commits

...

1041 Commits

Author SHA1 Message Date
Joseph Lyons
66776382b9 v0.83.x stable 2023-04-26 14:19:40 -04:00
Max Brunsfeld
aee54c96e3 zed 0.83.1 2023-04-24 14:56:52 -07:00
Max Brunsfeld
d290b1c83f Merge pull request #2409 from zed-industries/stale-excerpts
Fix stale project diagnostic excerpts for guests
2023-04-24 14:56:00 -07:00
Max Brunsfeld
f6b953c884 v0.83.x preview 2023-04-20 09:51:57 -07:00
Joseph T. Lyons
65f7228fed Merge pull request #2389 from zed-industries/save-panics-as-structured-data
Save panics as structured data
2023-04-20 12:51:00 -04:00
Max Brunsfeld
b414d43ee3 Merge pull request #2392 from zed-industries/eslint-multiple-language-server-adapters-rebased
Allow buffers to use multiple language servers
2023-04-20 09:40:23 -07:00
Mikayla Maki
ad71020990 Merge pull request #2395 from zed-industries/remove-stable-hiding-copilot
Remove stable guard for copilot
2023-04-21 04:04:04 +12:00
Max Brunsfeld
21bb13d309 Fix comment formatting errors for rust 1.69 2023-04-20 09:03:42 -07:00
Max Brunsfeld
32c57bcd22 Store buffer's diagnostic sets in a smallvec 2023-04-20 08:58:41 -07:00
Max Brunsfeld
960a2bc589 Don't use ESLint for now 2023-04-20 08:58:41 -07:00
Max Brunsfeld
0ebe44bfd5 Handle multiple language servers for a given path in project diagnostics view 2023-04-20 08:58:41 -07:00
Max Brunsfeld
4dd917c123 Introduce a LanguageServerId wrapper type
Clarify the meaning of all the usizes in use in all of these
struct fields an method signatures.
2023-04-20 08:58:41 -07:00
Julia
c5f86bc6af Avoid language servers fighting over diagnostics summaries
Previously each server would stomp all over the existing results

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
9e2949e7ba Refactor language server startup
Avoid parallel vecs

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
c59204c5e6 Cleanup
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
26abc824a9 Bump protocol version 2023-04-20 08:58:41 -07:00
Julia
df94aee758 Fix failing tests
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
6156dbced0 Finish getting multiple diagnostics sources building and running 2023-04-20 08:58:41 -07:00
Julia
bb4de47b15 Start getting diagnostics sets to work with multiple servers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
2a5c0fa5f8 Get ESLint to launch and provide diagnostics
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-04-20 08:58:41 -07:00
Julia
6e68ff5a50 Get it to build with multiple adapters per language! 🎉
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
ba7233f265 Incomplete refactor to allow for multiple adapters per language 2023-04-20 08:58:39 -07:00
Mikayla Maki
c1daf0fc36 Fix format 2023-04-20 08:54:44 -07:00
Mikayla Maki
ad8162fc9c Make sign_in init conditional 2023-04-20 08:36:29 -07:00
Mikayla Maki
f5bbb41cc2 Remove import 2023-04-20 08:34:50 -07:00
Mikayla Maki
5c8b41dd54 Remove stable guard for copilot 2023-04-20 08:33:45 -07:00
Petros Amoiridis
21e39e7523 Merge pull request #2394 from zed-industries/petros/z-804-change-default-settings-for-json-to-2
Set default tab_size for JSON to 2 and apply new formatting
2023-04-20 14:45:52 +03:00
Antonio Scandurra
370875b1d4 Merge pull request #2393 from zed-industries/relay-change-events-to-copilot
Relay buffer change events to Copilot language server
2023-04-20 13:34:42 +02:00
Petros Amoiridis
eca93c124a Apply the tab_size change to keymaps and settings 2023-04-20 14:08:30 +03:00
Petros Amoiridis
bed76462e2 Define tab_size equal to 2 in default settings 2023-04-20 14:06:43 +03:00
Antonio Scandurra
df71a9cfae Move buffer change reporting to a background task 2023-04-20 11:59:05 +02:00
Antonio Scandurra
4151bd39da Add buffer management test to Copilot 2023-04-20 10:51:50 +02:00
Antonio Scandurra
4d207981ae Notify LSP when Copilot suggestions are accepted/rejected 2023-04-20 10:15:31 +02:00
Antonio Scandurra
5d57167302 Make it easier to access a running/authenticated copilot server 2023-04-20 10:12:10 +02:00
Antonio Scandurra
4c3d6c854a Send editor information to copilot 2023-04-20 09:34:20 +02:00
Antonio Scandurra
b9a7b70e52 Register unknown buffer on the fly if completions are requested for it 2023-04-20 09:34:20 +02:00
Antonio Scandurra
34bcf6f072 Reopen file in Copilot language server when language or URI changes 2023-04-20 09:34:20 +02:00
Antonio Scandurra
672cf6b8c7 Relay buffer change events to Copilot 2023-04-20 09:34:20 +02:00
Mikayla Maki
ce8442a3d8 Fix underflow potential 2023-04-19 17:42:19 -07:00
Mikayla Maki
dd73233973 Merge pull request #2386 from zed-industries/copilot-shipping
Get copilot ready to ship
2023-04-20 12:38:27 +12:00
Mikayla Maki
26ab774b7f Removed debounce on suggestion cycling code 2023-04-19 17:34:09 -07:00
Mikayla Maki
f16b96cafc add copilot menu 2023-04-19 17:27:44 -07:00
Mikayla Maki
9b8a3e4de5 Fixed panic in new cycling code
Made cycling fire without debounce
2023-04-19 16:50:31 -07:00
Mikayla Maki
2882e0fa5b Remove new CTA in copilot sign in UI
Add a trim_end to copilot suggestions
2023-04-19 16:39:55 -07:00
Mikayla Maki
745e5e3a09 Add italic styles to copilot suggestions 2023-04-19 15:23:19 -07:00
Mikayla Maki
70ff4ca48f WIP: lower our usage of the copilot API by seperating out the cycling completion
Restore copilot setting visibility

co-authored-by: antonio <antonio@zed.dev>
2023-04-19 15:23:17 -07:00
Mikayla Maki
ea1c3fa7a0 Only fire completion cycling requests if specifically asked for by the user 2023-04-19 15:21:30 -07:00
Antonio Scandurra
8610f3acf3 Introduce a button to disable copilot integration
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-19 20:25:59 +02:00
Joseph Lyons
0326a45a91 Give closure parameter a name 2023-04-19 14:21:53 -04:00
Antonio Scandurra
54a78d7024 Clarify Copilot context menu
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-19 20:18:06 +02:00
Antonio Scandurra
4a9989fe38 Clear all suggestions from Editor when disabling Copilot
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-19 20:10:57 +02:00
Antonio Scandurra
1fd07b6fcf Clarify copilot settings
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-19 20:07:05 +02:00
Petros Amoiridis
699b2060b3 Merge pull request #2390 from zed-industries/petros/z-66-command-to-add-a-new-line-on-the
Add newline above and improve newline below
2023-04-19 21:02:55 +03:00
Petros Amoiridis
b3b8f8532d Assert the editor and unmarked texts are the same
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2023-04-19 20:52:01 +03:00
Petros Amoiridis
f9c60b98c0 Add newline above and improve newline below
Add a new action for inserting a new line above the current line. @ForLoveOfCats  also helped fix a bug among other things. When two collaborators had their cursors at the end of a line, and one collaborator performed a newline below action, the second collaborator's cursor would be dragged to the new line. This is also fixing that.

Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-04-19 19:57:23 +03:00
Joseph Lyons
27a6bacab8 Save panics as structured data 2023-04-19 08:31:47 -04:00
Max Brunsfeld
c5e56a5e45 Fail the randomized test build after reporting the error to zed.dev 2023-04-18 18:41:33 -07:00
Max Brunsfeld
5934e882b8 Merge pull request #2379 from zed-industries/shebang
Select language based on a file's first content line in addition to its path
2023-04-18 17:31:19 -07:00
Max Brunsfeld
ad9fe79cf2 Merge pull request #2388 from zed-industries/cmd-o-new-window
When opening projects, only reuse the current window if it is empty
2023-04-18 17:31:08 -07:00
Max Brunsfeld
7cc868bc8c When opening projects, only reuse the current window if it is empty 2023-04-18 17:05:26 -07:00
Max Brunsfeld
44d26b69ae Merge pull request #2387 from zed-industries/panic-in-set-selections-from-remote
Fix 'invalid insertion' panic when following
2023-04-18 16:43:47 -07:00
Max Brunsfeld
bd7d50f339 Fix 'invalid insertion' panic when following
Wait for the necessary buffer operations to arrive before attempting to
set selections and scroll top.
2023-04-18 16:13:18 -07:00
Nate Butler
a8b3826955 Merge pull request #2384 from zed-industries/update-copilot-styles
Update copilot styles
2023-04-18 15:17:10 -04:00
Julia
4c086a4836 Merge pull request #2385 from zed-industries/rerender-breadcrumbs-on-focus-change
Re-render toolbar items when updating their knowledge of pane focus
2023-04-18 15:13:53 -04:00
Julia
721baf5746 Re-render toolbar items when updating their knowledge of pane focus 2023-04-18 14:56:39 -04:00
Nate Butler
957ab65422 Mix neutral and blue to make a predictive color that is unique 2023-04-18 14:47:52 -04:00
Joseph T. Lyons
614a9c8977 Merge pull request #2377 from zed-industries/add-tab-tooltips
Add tab tooltips
2023-04-18 14:37:38 -04:00
Nate Butler
ae0647c3a9 Update predictive color
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-04-18 14:29:08 -04:00
Joseph Lyons
304eddbbe4 Remove unnecessary lifetimes from tab_description 2023-04-18 14:15:56 -04:00
Joseph Lyons
9afd804062 Remove unnecessary lifetimes from tab_tooltip_text 2023-04-18 14:03:02 -04:00
Antonio Scandurra
1b477c9e38 Merge pull request #2383 from zed-industries/show-copilot-more-often
Clean up completion tasks, even if they fail or return no results
2023-04-18 11:16:47 +02:00
Antonio Scandurra
d26d0ac56f Clean up completion tasks, even if they fail or return no results
This fixes a bug where leaving the completion task in `completion_tasks`
could cause the Copilot suggestion to not be shown due to the LSP not
successfully return a completion.
2023-04-18 11:03:17 +02:00
Antonio Scandurra
75d6b6360f Add failing test to demonstrate Copilot not showing enough suggestions 2023-04-18 10:24:20 +02:00
Max Brunsfeld
8f25b98e6f Print the final minimized test plan before sending it to zed.dev 2023-04-17 16:35:54 -07:00
Max Brunsfeld
695973d117 Use Node 18 on CI, for fetch API 2023-04-17 16:22:30 -07:00
Max Brunsfeld
516964280b Merge pull request #2376 from zed-industries/randomized-tests-runner
Add an Actions workflow that repeatedly runs the randomized integration tests
2023-04-17 15:45:45 -07:00
Max Brunsfeld
485c56e3bd Don't run randomized tests on pushes to main 2023-04-17 15:43:12 -07:00
Max Brunsfeld
837866f962 Consolidate logic for running randomized tests in scripts 2023-04-17 15:37:11 -07:00
Julia
4adc92b8e5 Merge pull request #2382 from zed-industries/dont-have-contacts-popover-affect-share-unshare-button
Don't have contacts popover affect appearance of Share/Unshare button
2023-04-17 14:18:39 -04:00
Julia
14ef0edd7f Don't have contacts popover affect appearance of Share/Unshare button 2023-04-17 14:13:28 -04:00
Max Brunsfeld
233cd80f63 Merge pull request #2381 from zed-industries/fix-buffer-latency
Send buffer operations in batches to reduce latency
2023-04-17 10:59:51 -07:00
Max Brunsfeld
5d73e646d8 Delete pull_request_template.md 2023-04-17 10:23:57 -07:00
Antonio Scandurra
1f284408a9 Send buffer operations in batches to reduce latency
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-17 10:22:13 -07:00
Julia
f5a2534c1b Merge pull request #2380 from zed-industries/show-followers-full-color
Unconditionally display followers in full color
2023-04-17 13:16:19 -04:00
Julia
61f4f8aaeb Unconditionally display followers in full color 2023-04-17 13:10:40 -04:00
Max Brunsfeld
1dcd4717b1 Select language based on a file's first content line in addition to its path 2023-04-16 12:28:27 -07:00
Joseph Lyons
ebe57254e0 Add tab tooltips 2023-04-15 06:46:14 -04:00
Max Brunsfeld
3569c61784 Minimize randomized test failures before reporting issues 2023-04-14 17:51:24 -07:00
Max Brunsfeld
5c3da91e15 Report randomized test failures to zed.dev, to create issues in linear 2023-04-14 15:45:01 -07:00
Max Brunsfeld
c329546570 Extract randomized test CI process into a script 2023-04-14 14:25:55 -07:00
Max Brunsfeld
253411bfd0 Start work randomized test runner GH action workflow 2023-04-14 13:54:57 -07:00
Max Brunsfeld
e655a6c767 Merge pull request #2375 from zed-industries/worktree-scan-id-fix
Always bump worktree's scan_id when refreshing an entry
2023-04-14 09:53:40 -07:00
Max Brunsfeld
5ea49b3ae3 Fix inconsistent worktree state when renaming entries while scanning 2023-04-13 22:34:34 -07:00
Max Brunsfeld
bb1cfd51b8 Add randomized test for mutating worktree during initial scan 2023-04-13 22:34:03 -07:00
Max Brunsfeld
debb694d97 Always bump scan_id when refreshing an entry
The scan_id needs to be bumped even if a scan is already in progress,
so that worktree updates can detect that entries have changed. This
means that the worktree's completed_scan_id may increase by more than
one at the end of a scan.
2023-04-13 16:51:11 -07:00
Max Brunsfeld
c13914bda1 Merge pull request #2371 from zed-industries/refresh-entry-delay
Restructure background scanner to handle refresh requests even while scanning directories
2023-04-13 12:44:04 -07:00
Joseph T. Lyons
6a75e884c0 Merge pull request #2374 from zed-industries/add-vim-mode-metric
Add vim mode metric
2023-04-13 13:52:31 -04:00
Joseph Lyons
5f0bf5929f Add vim mode metric 2023-04-13 13:46:22 -04:00
Antonio Scandurra
f4daeb4778 Merge pull request #2373 from zed-industries/fix-copilot-panic
Avoid interpolating Copilot suggestion if cursor excerpt differs
2023-04-13 10:48:57 +02:00
Antonio Scandurra
495c7acadf Avoid interpolating Copilot suggestion if cursor excerpt differs 2023-04-13 10:44:08 +02:00
Max Brunsfeld
5ca603dbeb Don't process gitignore updates after the initial scan 2023-04-12 18:17:29 -07:00
Max Brunsfeld
3d14bfd90c Prioritize path refresh requests over gitignore status updates 2023-04-12 18:08:00 -07:00
Max Brunsfeld
2d97387f49 Restructure background scanner to handle refresh requests even while scanning 2023-04-12 16:29:51 -07:00
Max Brunsfeld
a85c2d71ad collab 0.8.3 2023-04-12 11:11:32 -07:00
Joseph Lyons
afbd275f4f v0.83.x dev 2023-04-12 13:31:39 -04:00
Joseph T. Lyons
ee238a300e Merge pull request #2368 from zed-industries/Improve-tab-closing-experience
Add tab context menu
2023-04-12 13:08:46 -04:00
Joseph T. Lyons
b39b3541e9 Merge pull request #2370 from zed-industries/flip-screen-sharing-icon-states
Flip screen sharing icon states
2023-04-12 12:50:00 -04:00
Antonio Scandurra
6d8635fa29 Merge pull request #2349 from zed-industries/randomized-tests-operation-script
Restructure randomized integration test to allow editing and replaying a plan, fix discovered bugs
2023-04-12 11:45:47 +02:00
Antonio Scandurra
12a286ac50 Forget buffered operations when resyncing with the host
Previously, we could end up with a situation where the host did not
see an operation but a guest that didn't have that buffer open would. When
such guest would finally open the buffer, they would apply the operation
without however sending it to the host. The guest wouldn't bother resyncing
it because it wasn't part of its open buffers.
2023-04-12 10:39:01 +02:00
Joseph Lyons
0b52308c99 Represent dirty state in item-testing code 2023-04-11 16:27:12 -04:00
Joseph Lyons
c39764487c Construct context menu in a more clear way 2023-04-11 15:46:52 -04:00
Max Brunsfeld
61d048cb25 Don't wait for host's reply before broadcasting buffer updates to guests 2023-04-11 12:37:08 -07:00
Joseph Lyons
ae930bde87 Flip screen sharing icon states 2023-04-11 15:30:44 -04:00
Max Brunsfeld
727afae4ff Fix unit tests after fixing gpui model drop semantics
co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-11 10:58:01 -07:00
Nate Butler
209e9a59c5 Merge pull request #2369 from zed-industries/nate/update-ayu-theme
Update `Ayu` Theme Family
2023-04-11 13:05:25 -04:00
Nate Butler
7ba094e10e add license_checksum 2023-04-11 12:56:18 -04:00
Nate Butler
20ec9f6daf Add meta fields to ayu 2023-04-11 12:37:20 -04:00
Nate Butler
65c2fb1cc6 Fix paths after publishing 2023-04-11 12:25:02 -04:00
Nate Butler
de60657d53 Ignore the target folder 2023-04-11 12:23:54 -04:00
Nate Butler
975f5d5fa8 Format 2023-04-11 12:23:21 -04:00
Nate Butler
527f0310e2 Update + publish the Ayu theme 2023-04-11 12:22:49 -04:00
Antonio Scandurra
42b10044fc Fix running client crate tests 2023-04-11 17:43:05 +02:00
Antonio Scandurra
5eb1719ab8 Re-send worktree if reconnecting while initial scan isn't finished yet
Previously, if the client was disconnected while the initial worktree
state was being sent, it would not see the remaining state after reconnecting.
This was due to `scan_id` and `completed_scan_id` both being initialized to
`0`, so the client would ask for updates since `0` and get nothing.

This commit changes the worktree to initialize `scan_id` to `1` and
`completed_scan_id` to `0`, so that we get the full worktree again on reconnect.
2023-04-11 17:15:43 +02:00
Antonio Scandurra
172441ab72 Cancel pending calls when participant fails to reconnect
Previously, we would only cancel pending calls when the room became
empty.
2023-04-11 16:33:08 +02:00
Antonio Scandurra
5e37c893c2 Ensure project is still alive by the time remote LSP request starts 2023-04-11 15:14:32 +02:00
Antonio Scandurra
5898600239 Use LspCommand to handle code actions 2023-04-11 15:12:58 +02:00
Antonio Scandurra
651a83977e 🔥 2023-04-11 14:53:08 +02:00
Antonio Scandurra
ac532cb6fa Use LspCommand to handle completions 2023-04-11 14:52:07 +02:00
Antonio Scandurra
9e6d865882 Prevent already dropped model from being upgraded during release 2023-04-11 10:43:05 +02:00
Antonio Scandurra
6ba5e06247 Stop waiting for buffers when releasing a remote project 2023-04-11 10:42:43 +02:00
Antonio Scandurra
643381ce0c Make UpdateDiffBase a Foreground message to prevent reordering 2023-04-11 08:50:26 +02:00
Joseph Lyons
67cb046298 Add tab context menu 2023-04-11 00:03:47 -04:00
Max Brunsfeld
abfbba68f0 Improve randomized test assertion message when diff base is wrong 2023-04-10 18:28:34 -07:00
Max Brunsfeld
25e3c4e586 Fix leak when project is unshared while LSP handler waits for edits 2023-04-10 17:03:58 -07:00
Max Brunsfeld
e853e77d59 Upgrade postage for oneshot channel drop fix
Previously, dropping a oneshot sender didn't wake the receiver.
2023-04-10 16:03:49 -07:00
Julia
0e4de87e0e Merge pull request #2367 from zed-industries/log-github-api-response-for-deserialize-error
In the case of Github release deserialize error, log response text
2023-04-10 17:04:59 -04:00
Julia
189784f5fd In the case of Github release deserialize error, log response text
Co-Authored-By: Joseph Lyons <joseph@zed.dev>
2023-04-10 16:45:15 -04:00
Max Brunsfeld
e79815622c Preserve ordering between UpdateProject and CreateBufferForPeer messages
Previously, because UpdateProject messages were sent in a separately-
spawned task, they could be sent after CreateBufferForPeer messages that
were intended to be sent after them.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-10 12:54:25 -07:00
Antonio Scandurra
9761febf82 Avoid broadcasting SaveBuffer in response to a client's save request
The host will send a `SaveBuffer` message anyway and this prevents re-querying
the database, which could cause two `BufferSaved` messages to race and, as a
result, cause guest to apply them in the wrong order.
2023-04-10 10:02:13 +02:00
Antonio Scandurra
3a82c04248 Improve assertion message when buffer state diverges 2023-04-10 10:01:44 +02:00
Antonio Scandurra
016343e65d Merge branch 'main' into randomized-tests-operation-script 2023-04-10 08:45:22 +02:00
Antonio Scandurra
7f73ebdab5 Apply BufferReloaded message to incomplete remote buffers 2023-04-10 08:41:31 +02:00
Antonio Scandurra
116d4f20fa Merge pull request #2366 from zed-industries/avoid-unwrapping-on-try-send
Don't panic if worktree was dropped before sending path changes
2023-04-10 08:36:53 +02:00
Antonio Scandurra
372e31d54f Don't panic if worktree was dropped before sending path changes
In `refresh_entry`, we send a message to the `self.path_changes_tx` channel
to notify the background thread that a path has changed. However, given that
`refresh_entry` uses `spawn_weak`, the worktree could get dropped before sending
the message, which could cause a panic.

This commit changes the code to return an error instead of panicking.
2023-04-10 08:16:08 +02:00
Max Brunsfeld
acbf9b55d7 Halt UpdateBuffer messages until sync if one errors
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-07 17:31:52 -07:00
Max Brunsfeld
e50c48852a Wait for host to acknowledge buffer updates before sending them to other guests 2023-04-07 16:27:48 -07:00
Max Brunsfeld
f519f32ec2 Fixed removal of closed projects in randomized test
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-07 12:24:59 -07:00
Joseph Lyons
035189a2a1 Put file location details of panic on separate line 2023-04-07 14:32:14 -04:00
Nathan Sobo
676dbdc57b Merge pull request #2365 from zed-industries/dont_export_gpui_platform_module
Don't export platform::* from gpui
2023-04-07 12:12:05 -06:00
Nathan Sobo
2615a11f7c Don't export platform::* from gpui
I'd like to avoid cluttering the top-level namespace with all the platform-
specific types.
2023-04-07 11:45:53 -06:00
Joseph T. Lyons
f450692e77 Merge pull request #2364 from zed-industries/put-backtrace-on-a-newline-when-reporting-panics
Put backtrace on a new line when reporting panics
2023-04-07 12:46:53 -04:00
Joseph Lyons
9cf3481fc7 Put backtrace on a new line when reporting panics 2023-04-07 12:12:18 -04:00
Joseph T. Lyons
c58601ab8d Merge pull request #2363 from zed-industries/add-copy-path-commands
Update copy path commands
2023-04-07 12:09:39 -04:00
Joseph Lyons
5e55eb279c Update copy path commands 2023-04-07 02:36:56 -04:00
Nathan Sobo
dad403f483 Merge pull request #2362 from zed-industries/eliminate-mutable-app-context
Merge MutableAppContext into AppContext
2023-04-06 16:19:47 -06:00
Nathan Sobo
95eb918b4c Fix broken test due to trimmed trailing whitespace during formatting 2023-04-06 16:10:39 -06:00
Nathan Sobo
8136d8a8a6 Fix formatting 2023-04-06 15:54:44 -06:00
Nathan Sobo
de9bf6dfbd Merge MutableAppContext into AppContext
There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
2023-04-06 15:49:03 -06:00
Max Brunsfeld
aa7918c4b5 Fix handling of redundant buffer creation messages on guests
Check if the buffer already exists *before* overwriting it.
Ignore redundant registrations on remote projects.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-06 12:17:25 -07:00
Max Brunsfeld
22a6a243bc Move project assertions into main assertion function
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-06 11:38:42 -07:00
Joseph T. Lyons
dd00966cc6 Merge pull request #2361 from zed-industries/add-close-items-to-left-and-right
Add close items to left and right
2023-04-06 13:06:25 -04:00
Antonio Scandurra
ef04dc14cc Update file on incomplete buffer instead of waiting for it to be opened
This ensures that two successive file updates coming from the host are
not applied in reverse order.
2023-04-06 17:48:44 +02:00
Julia
4b39df4a6b Merge pull request #2304 from zed-industries/bump-diff-width
Increase git diff gutter width slightly
2023-04-06 10:58:55 -04:00
Antonio Scandurra
8020ea783f Wait to see guest's buffer version before converting completion anchor 2023-04-06 16:23:10 +02:00
Antonio Scandurra
4a61e2dfa4 Save server operations that were in the middle of being applied
Previously, if the test panicked before it had a chance to fully
apply an operation, it would end up not being saved in the plan.
With this commit we will mark the operation as applied before we
start processing it, and mark it as not applied if, once we're done,
we've found out that it couldn't be applied. This is consistent with
what we do for client operations.
2023-04-06 16:02:16 +02:00
Antonio Scandurra
f995d07542 Return error if subscribing to an entity that was already subscribed to 2023-04-06 14:42:19 +02:00
Antonio Scandurra
d7f56d6126 Forget which buffers were shared when host reconnects
This fixes a bug where the host would momentarily disconnect and the guest
would close and reopen the project. This would cause the host to not observe
the guest closing the project. When the guest tried to open one of the
buffers opened prior to closing the project, the host would not send them the
buffer state because it would still remember that the buffer was shared.

The `shared_buffers` map is now cleared when the host reconnects and will slowly
get re-filled as guests issue `SynchronizeBuffers` requests.
2023-04-06 13:49:09 +02:00
Joseph Lyons
4883ec2201 Add close items to left and right 2023-04-06 03:33:38 -04:00
Max Brunsfeld
bf3b8adf35 Avoid async fs call before checking if operation is applicable
This way, the executor isn't influenced by operations that aren't applicable.
2023-04-05 18:11:33 -07:00
Max Brunsfeld
1064b14779 Don't use TestPlan's rng in fake LSP handlers
These should use the test context's rng, so that they behave the same whether
a pre-recorded plan was used, or the plan is being generated.
2023-04-05 17:50:04 -07:00
Max Brunsfeld
2d63ed3ca4 Merge branch 'main' into randomized-tests-operation-script 2023-04-05 17:10:20 -07:00
Nathan Sobo
e5861d6c35 Fix typos in EULA 2023-04-05 18:02:35 -06:00
Max Brunsfeld
bda7086220 Clear guest's shared buffers if they rejoin project after leaving while host was disconnected 2023-04-05 16:53:36 -07:00
Max Brunsfeld
8e68c7f808 Do include operations in serialized test plan if they cause a client to hang 2023-04-05 16:52:39 -07:00
Max Brunsfeld
43a94cda5f Don't skip worktree updates if unknown entries are removed
When rejoining a project, if entries were both created and deleted since
joining the project, the guest will receive those entries ids in as
removed.
2023-04-05 15:36:01 -07:00
Max Brunsfeld
661fba8640 Run executor until parked at end of each iteration of random collaboration test
Without this, the server doesn't get dropped at the end of the test, and we eventually run
out of file handles due to sqlite connections being retained.
2023-04-05 15:05:32 -07:00
Max Brunsfeld
781d66f628 Omit operations for non-existent users from serialized test plan 2023-04-05 15:04:27 -07:00
Julia
43b6e7a944 Merge pull request #2360 from zed-industries/maybe-fix-lock-screen-crash
Hesitant possible fix for lock screen crash
2023-04-05 14:10:40 -04:00
Julia
6e3bf7fed4 Hesitant possible fix for lock screen crash
This may cause issues in this situations but as I cannot repro this I'm
making the call to try something and see how it plays out
2023-04-05 14:01:54 -04:00
Joseph Lyons
e4bb5c296c v0.82.x dev 2023-04-05 13:00:52 -04:00
Joseph T. Lyons
3b6c975658 Merge pull request #2357 from zed-industries/update-eula
Update EULA
2023-04-05 12:57:34 -04:00
Joseph Lyons
5becdbdea8 Fix spacing in EULA 2023-04-05 12:45:48 -04:00
Julia
af826f5efd Merge pull request #2359 from zed-industries/prefer-right-statusbar-items
Prioritize displaying right statusbar items overtop left items if needed
2023-04-05 12:16:30 -04:00
Julia
77bb52f72c Prioritize displaying right statusbar items overtop left items if needed 2023-04-05 12:08:52 -04:00
Mikayla Maki
64428bac15 Merge pull request #2358 from zed-industries/more-copilot-fixes
Invalidate copilot suggestion on backspaces
2023-04-05 08:59:30 -07:00
Mikayla Maki
78742d5615 Add additional case to range invalidation test
co-authored-by: antonio <antonio@zed.dev>
2023-04-05 08:52:56 -07:00
Mikayla Maki
b585470518 Invalidate copilot suggestion on backspaces
Restore an observation on initialization

co-authored-by: antonio <antonio@zed.dev>
2023-04-05 08:48:39 -07:00
Antonio Scandurra
e2c690cece Merge pull request #2356 from zed-industries/copilot-on-preview
Disable Copilot entirely for stable releases
2023-04-05 16:20:53 +02:00
Nathan Sobo
0d0f6b5a05 Update EULA 2023-04-05 08:18:51 -06:00
Antonio Scandurra
7ba46a0630 Honor ZED_RELEASE_CHANNEL environment variable only in development
We don't want people to be able to override the release channel in
production.
2023-04-05 15:55:44 +02:00
Antonio Scandurra
15b26e10d4 Disable Copilot entirely for stable releases
This lets us remove the logic for detecting whether a user is a staff
member.
2023-04-05 15:49:59 +02:00
Antonio Scandurra
781d065d0b Merge pull request #2355 from zed-industries/refine-copilot
Iterate some more on Copilot
2023-04-05 14:21:18 +02:00
Antonio Scandurra
03a4c9d6d5 Use the cursor variable instead of selection.start 2023-04-05 14:15:58 +02:00
Antonio Scandurra
dd416cdfd2 📝 2023-04-05 14:14:43 +02:00
Antonio Scandurra
f920e02d96 Indent instead of accepting suggestion if cursor is in leading whitespace 2023-04-05 14:09:09 +02:00
Antonio Scandurra
908a7cf47e 💄 2023-04-05 13:59:19 +02:00
Antonio Scandurra
dcd8bdfc88 Update visible suggestion if edit occurs outside the current editor 2023-04-05 11:06:14 +02:00
Antonio Scandurra
6e821eea4b Prevent tab from accepting a copilot suggestion when it isn't visible 2023-04-05 10:31:11 +02:00
Antonio Scandurra
661be7ba51 Refresh copilot suggestions when accepting a completion 2023-04-05 10:28:00 +02:00
Antonio Scandurra
7a7dc95611 Refresh copilot suggestions when undoing/redoing 2023-04-05 10:27:19 +02:00
Antonio Scandurra
399451b676 Capture copilot behavior in a editor unit test 2023-04-05 10:26:43 +02:00
Max Brunsfeld
1159f5517b Avoid applying outdated UpdateProject methods after rejoining a room 2023-04-04 21:49:37 -07:00
Max Brunsfeld
1ccf174388 Avoid applying outdated UpdateProject messages
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-04-04 18:34:39 -07:00
Antonio Scandurra
808ddc26e7 Merge pull request #2353 from zed-industries/more-intuitive-autocomplete-with-copilot
Match VS Code's behavior when deciding whether to show Copilot suggestion
2023-04-04 20:03:07 +02:00
Antonio Scandurra
65fd605b82 Revert "Return the previous suggestion when replacing it"
This reverts commit 971c88db80.
2023-04-04 18:59:28 +02:00
Nate Butler
e7150d0b66 Merge pull request #2354 from zed-industries/nate/fix-embedded-highlight-in-ruby
Fix embedded highlight in ruby
2023-04-04 12:46:32 -04:00
Nate Butler
7ff97e50a7 Fix embedded highlight in ruby 2023-04-04 12:41:38 -04:00
Antonio Scandurra
b58ac815a8 Trigger copilot only on insertion and deletion
Also, avoid showing the suggestion if a completion is in progress to
avoid flickering.
2023-04-04 17:51:37 +02:00
Antonio Scandurra
971c88db80 Return the previous suggestion when replacing it 2023-04-04 17:14:52 +02:00
Antonio Scandurra
a2aad31cf1 Merge pull request #2352 from zed-industries/debounce-copilot
Debounce copilot completions
2023-04-04 16:52:59 +02:00
Antonio Scandurra
e970d84184 Debounce copilot completions
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-04 16:02:25 +02:00
Antonio Scandurra
5df5973262 Merge pull request #2351 from zed-industries/more-copilot-enhancements
Fix additional Copilot issues
2023-04-04 14:22:12 +02:00
Antonio Scandurra
60955fb8ee Refresh active copilot suggestion when accepting completion 2023-04-04 11:15:14 +02:00
Antonio Scandurra
79d5bb45dc Clear Copilot suggestions when it gets disabled from the settings 2023-04-04 10:45:56 +02:00
Antonio Scandurra
abf158a9e4 Merge pull request #2347 from zed-industries/disable-yaml-key-ordering
Disable key ordering diagnostic for YAML
2023-04-04 10:00:48 +02:00
Max Brunsfeld
bcf9b2f10d Add missing random delays in FakeFs 2023-04-03 22:42:34 -07:00
Mikayla Maki
91d85987b9 Merge pull request #2350 from zed-industries/copilot-disable
Disable copilot unless the staff mode flag is flipped
2023-04-03 22:00:47 -07:00
Mikayla Maki
fa32a20c42 fixup! fixup! fixup! removed copilot from generated schema and command palette 2023-04-03 21:46:59 -07:00
Mikayla Maki
a1abe8d33c fixup! fixup! removed copilot from generated schema and command palette 2023-04-03 21:46:30 -07:00
Mikayla Maki
ae6a671fea fixup! removed copilot from generated schema and command palette 2023-04-03 21:45:18 -07:00
Mikayla Maki
47de4dcd32 removed copilot from generated schema and command palette 2023-04-03 21:38:26 -07:00
Mikayla Maki
6bfecd7f66 Refactor staff mode into a seperate crate and make copilot initialization wait for the staff mode flag to be flipped 2023-04-03 20:16:45 -07:00
Max Brunsfeld
b251e249a7 Check for consistency between clients every time the system quiesces 2023-04-03 19:11:37 -07:00
Max Brunsfeld
7b0a6c0dfa Add an 'on_failure' attribute to gpui tests
This lets us perform a finalization step when a randomized test fails.
2023-04-03 18:16:08 -07:00
Max Brunsfeld
5ecc9606af Use synchronous locks in FakeFs
This way, the state can be accessed without running the deterministic
executor.
2023-04-03 18:15:07 -07:00
Mikayla Maki
55297c1a26 Merge pull request #2348 from zed-industries/copilot-feedback
Fix issues from copilot feedback
2023-04-03 16:29:41 -07:00
Max Brunsfeld
f95732e981 Fix bug where guest would drop BufferSaved messages while opening the buffer 2023-04-03 16:23:44 -07:00
Mikayla Maki
1627cf7eae Add standard copilot keybinding 2023-04-03 16:14:07 -07:00
Mikayla Maki
bab0e88b6f Fix bug where copilot auth window will only be shown once 2023-04-03 16:01:04 -07:00
Max Brunsfeld
543301f949 Avoid repeatedly loading/saving the test plan for each iteration 2023-04-03 15:58:11 -07:00
Mikayla Maki
2e33f8b228 fixup! Remove per-file copilot enable/disable 2023-04-03 15:21:43 -07:00
Mikayla Maki
48d9c30b0e Remove per-file copilot enable/disable 2023-04-03 15:15:42 -07:00
Mikayla Maki
0250898a2b Enable copilot in all file types by default 2023-04-03 15:06:49 -07:00
Max Brunsfeld
c960277349 Merge branch 'main' into randomized-tests-operation-script 2023-04-03 13:09:25 -07:00
Antonio Scandurra
2c0a645f19 Provide workspace_folders capability when initializing LSP
This fixes the YAML language server which was erroring on startup
after adding the `did_change_watched_files` capability in #2258.
2023-04-03 20:12:26 +02:00
Antonio Scandurra
588b2da40a Disable key ordering diagnostic for YAML language server 2023-04-03 20:02:29 +02:00
Petros Amoiridis
69557655ee Merge pull request #2346 from zed-industries/petros/z-360-dragging-file-from-tree-to-split-results
Fix dragging file from tree to split results in empty pane
2023-04-03 16:43:12 +03:00
Petros Amoiridis
5a397726d2 Do not drop the task
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-04-03 16:36:08 +03:00
Nathan Sobo
cdfe873802 Merge pull request #2343 from zed-industries/handles
Make typed handles wrappers around their untyped equivalents
2023-04-03 09:20:37 -04:00
Antonio Scandurra
0cb73b6579 Merge pull request #2345 from zed-industries/autocomplete-vs-copilot
Make autocompletion and copilot mutually exclusive
2023-04-03 14:37:02 +02:00
Antonio Scandurra
b88aa9af1d Clear active copilot suggestion only if there is one 2023-04-03 14:32:41 +02:00
Antonio Scandurra
ec5309b543 Make autocompletion and copilot mutually exclusive 2023-04-03 14:15:21 +02:00
Antonio Scandurra
b6a9d90609 Move creation of GetCompletionsParams entirely to the background 2023-04-03 13:30:57 +02:00
Antonio Scandurra
0b9e609e2a Merge pull request #2344 from zed-industries/copilot-collaboration
Fix Copilot errors when opening buffers that don't exist locally
2023-04-03 13:26:21 +02:00
Antonio Scandurra
b26d4f4f62 🔥 2023-04-03 13:18:16 +02:00
Antonio Scandurra
75ecf92ae4 Fix Copilot errors when opening buffers that don't exist locally 2023-04-03 12:28:32 +02:00
Nathan Sobo
138aa0492a Add downcast_ref to AnyViewHandle
I use unsafe code to transmute an AnyViewHandle to a ViewHandle<T> when
the type matches. Because ViewHandle<T> is repr(transparent) to the
wrapped AnyViewHandle, this is safe.
2023-04-02 16:10:16 -06:00
Nathan Sobo
71cf6ec5ae Use into_any instead of weird 'as' hack 2023-04-02 15:55:30 -06:00
Nathan Sobo
27258a0889 Remove From trait for AnyViewHandle in favor of into_any method
I think it's more explicit.
2023-04-02 15:50:42 -06:00
Nathan Sobo
aed8df96ff Wrap AnyWeak handles with their typed counterparts 2023-04-02 15:42:03 -06:00
Nathan Sobo
82a713fd1d Store AnyViewHandle inside ViewHandle and Deref to it 2023-04-02 14:59:55 -06:00
Julia
59fb4b3d29 Merge pull request #2342 from zed-industries/trust-npm-version-management
Trust NPM instead of managing dirs for different Node server versions
2023-03-31 17:21:16 -04:00
Julia
8c0db17634 Trust NPM instead of managing dirs for different Node server versions 2023-03-31 17:15:44 -04:00
Mikayla Maki
c19e6f8f0e Merge pull request #2338 from zed-industries/more-copilot-bugs
More copilot bugs
2023-03-31 12:45:19 -07:00
Mikayla Maki
297fd5f985 Merge pull request #2340 from zed-industries/fix-json-lsp-remove
Fix bug where JSON LSP would be deleted on installation.
2023-03-31 12:41:28 -07:00
Mikayla Maki
dcaa355ad2 Switch from removing all directories in the container dir to removing the non-version dir 2023-03-31 12:36:23 -07:00
Julia
0ae298a86f Merge pull request #2339 from zed-industries/revert
Revert "Merge pull request #2335 from zed-industries/dont-delete-json…
2023-03-31 15:33:12 -04:00
Julia
0f4f3bfbde Revert "Merge pull request #2335 from zed-industries/dont-delete-json-server-after-downloading-it"
This reverts commit 516e77906e, reversing
changes made to 54582fd77f.
2023-03-31 15:31:50 -04:00
Mikayla Maki
57b5c1ee20 Fix crash on initiating copilot during collaboration. Copilot is now disabled when collaborating. 2023-03-31 12:28:58 -07:00
Mikayla Maki
f616e8bac9 Merge pull request #2336 from zed-industries/respect-languages-alias-in-settings-file
Add support for writing to the langauge_overrides alias in settings
2023-03-31 11:51:25 -07:00
Mikayla Maki
b6882f0cbf Fix typo in copilot button 2023-03-31 11:50:31 -07:00
Mikayla Maki
e5a6b11d8f Merge pull request #2334 from zed-industries/quiet-copilot-loggin
Add handlers for LogMessage and statusNotification to copilot LSP
2023-03-31 11:22:23 -07:00
Mikayla Maki
c1445fe015 Add support for the langauge_overrides alias in the settings file updating code 2023-03-31 11:20:46 -07:00
Mikayla Maki
bdce96b19a Update copilot.rs 2023-03-31 11:16:52 -07:00
Julia
516e77906e Merge pull request #2335 from zed-industries/dont-delete-json-server-after-downloading-it
Don't delete JSON language server directly after downloading it
2023-03-31 14:08:09 -04:00
Julia
0199ffed5f Don't delete JSON language server directly after downloading it
This was accidentally added during the messy NodeRuntime/Copilot rebase

Co-Authored-By: Joseph Lyons <joseph@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-31 14:01:04 -04:00
Mikayla Maki
f561e5ef2c remove spare debug 2023-03-31 11:00:06 -07:00
Mikayla Maki
4865ea2efc Add handlers for LogMessage and statusNotification to copilot LSP 2023-03-31 10:58:18 -07:00
Antonio Scandurra
54582fd77f Merge pull request #2333 from zed-industries/copilot-improvements
Fix several Copilot bugs
2023-03-31 18:14:39 +02:00
Antonio Scandurra
b208d1a489 🎨 2023-03-31 18:10:10 +02:00
Antonio Scandurra
5f579a4287 Fix prefix/suffix calculation when determining copilot suggestion
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-31 18:05:07 +02:00
Antonio Scandurra
b588ba1435 Avoid auto-indenting when accepting copilot suggestion
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-03-31 17:17:35 +02:00
Antonio Scandurra
6e43e77c3f Use copilot's Completion::{range,text} to determine suggestion
Previously, we were using display text, but this isn't always correct. Now,
we just attempt to determine what text Copilot wants to insert by finding
a prefix and suffix in the existing text with the suggested text.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-03-31 17:08:41 +02:00
Mikayla Maki
9b16277cf8 Merge pull request #2316 from zed-industries/copilot
🚨 WIP 🚨 Copilot
2023-03-30 18:27:14 -07:00
Mikayla Maki
713f5f604f Fix leaked handle and failure to update language in context menu 2023-03-30 17:40:11 -07:00
Mikayla Maki
e38f52d595 Fix unrelated panics in tests 2023-03-30 17:19:29 -07:00
Mikayla Maki
c3188be4c1 cargofmt 2023-03-30 16:58:11 -07:00
Mikayla Maki
81411b9114 Merge branch 'main' into copilot 2023-03-30 16:57:18 -07:00
Mikayla Maki
c28d2c490b Remove test modals 2023-03-30 16:52:55 -07:00
Mikayla Maki
afc9b832c8 Finish device code flow for copilot 2023-03-30 16:50:33 -07:00
Mikayla Maki
f5d4bcd934 Added erorr states and first-pass error handling to the copilot status bar item.
Added correct icons
Added a new 'Toast' action which allows other crates to easily pop toasts with an optional click action
2023-03-30 14:10:57 -07:00
Julia
3cfe61a4f4 Merge pull request #2332 from zed-industries/per-server-code-action-kinds
Allow each language adapter to provide their own code action kinds array
2023-03-30 15:54:55 -04:00
Julia
cdde523ea4 Allow each language adapter to provide their own code action kinds array 2023-03-30 15:41:54 -04:00
Nate Butler
f235d9f411 Add zed plus copilot icon 2023-03-30 14:34:33 -04:00
Nate Butler
655897b182 Update icons 2023-03-30 14:32:51 -04:00
Nate Butler
58b453ad6e Add new copilot state icons 2023-03-30 14:18:03 -04:00
Mikayla Maki
b7461c32dd Improve settings writing for more cases 2023-03-30 10:40:53 -07:00
Mikayla Maki
e46cd2def3 Switch to using zed hosted copilot LSP (again)
co-authored-by: antonio <antionio@zed.dev>
2023-03-30 09:29:49 -07:00
Petros Amoiridis
007aa92581 Merge pull request #2323 from zed-industries/petros/z-402-recent-projects-replace-expanded-home
Replace home directory with the tilde substitution
2023-03-30 18:12:39 +03:00
Petros Amoiridis
dc51735112 Fix doctests 2023-03-30 17:57:14 +03:00
Petros Amoiridis
adc5ef911f Remove the Errors section from rust docs
The section does not add anything that we don't already know.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-30 14:04:37 +03:00
Petros Amoiridis
18c6c7ebb7 Fix error 2023-03-30 14:03:59 +03:00
Petros Amoiridis
9ef3e45bcd Update crates/recent_projects/src/highlighted_workspace_location.rs
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2023-03-30 11:35:17 +03:00
Antonio Scandurra
e3a311fda9 Merge pull request #2331 from zed-industries/tab-map-sync
Speed up tab searching in `TabMap::sync`
2023-03-30 10:20:57 +02:00
Antonio Scandurra
af4c4c7cf0 Speed up tab searching in TabMap::sync by looking for \t only
Instead of looking for `\n` as a stopping condition, we cap the range
we pass to `SuggestionSnapshot::chunks` to stop on the next line. This
makes character searching faster, because looking for a single character
uses `memchr`. Also, this avoids an extra conditional in a tight loop such
as the chunk scanning one contained in `TabMap::sync`.
2023-03-30 10:03:13 +02:00
Antonio Scandurra
79346b0706 Use + instead of | to break out of tab expansion in TabMap::sync 2023-03-30 09:49:07 +02:00
Mikayla Maki
5b3b74345d Remove some strays 2023-03-29 22:22:02 -07:00
Mikayla Maki
a8033b266d Fix bug with enable setting, clean up sign in UIs 2023-03-29 21:51:07 -07:00
Mikayla Maki
cc7c5b416c Add status bar icon reflecting copilot state to Zed status bar 2023-03-29 21:31:33 -07:00
Mikayla Maki
8fac32e1eb WIP, not compiling 2023-03-29 17:59:21 -07:00
Max Brunsfeld
ec5ffe9922 Merge pull request #2329 from zed-industries/new-window-on-click-doc
Open a new window when activating Zed from the dock w/ no windows open
2023-03-29 17:33:32 -07:00
Mikayla Maki
76efab005f WIP 2023-03-29 17:25:41 -07:00
Max Brunsfeld
b5f762ab25 Open a new window when activating Zed from the dock w/ no windows open 2023-03-29 17:24:44 -07:00
Nate Butler
e3822a5b5c Add copilot icons 2023-03-29 20:23:32 -04:00
Mikayla Maki
ae3b3ea458 Merge branch 'main' into copilot 2023-03-29 16:57:38 -07:00
Mikayla Maki
ebd06b43f5 Add copilot settings
Add copilot pause / resume
Add copilot statusbar item stub
2023-03-29 16:40:52 -07:00
Max Brunsfeld
7601e7902a Merge pull request #2325 from zed-industries/tab-map-long-lines
Avoid slowdowns with long lines by skipping tab expansion beyond a certain column
2023-03-29 14:48:23 -07:00
Max Brunsfeld
0c07a373a8 🎨 2023-03-29 14:43:01 -07:00
Julia
e558d3f903 Merge pull request #2328 from zed-industries/breadcrumbs-outline-toggle
Open symbol outline when clicking on editor breadcrumbs
2023-03-29 15:51:30 -04:00
Julia
737e2e1b3c Open symbol outline when clicking on editor breadcrumbs 2023-03-29 15:46:43 -04:00
Mikayla Maki
f812796283 Make modal behavior stateless
Co-authored-by: antonio <antonio@zed.dev>
2023-03-29 12:45:53 -07:00
Antonio Scandurra
49447128a9 Make edits smaller when tab expansion changes on a line 2023-03-29 21:40:37 +02:00
Joseph Lyons
6e2a9297ff v0.81.x dev 2023-03-29 14:13:01 -04:00
Antonio Scandurra
b86f8188d1 Expand edit to end of the line when old/new row exceeds max expansion 2023-03-29 16:49:21 +02:00
Petros Amoiridis
b15632bd45 Remove convert_to_shortened_path from gpui platform 2023-03-29 17:41:01 +03:00
Petros Amoiridis
b4593cd90b Use util::paths::compact 2023-03-29 17:40:39 +03:00
Petros Amoiridis
69989d0463 Introduce compact function in util create 2023-03-29 17:32:27 +03:00
Petros Amoiridis
d5f53111e8 Enable doctests in util crate 2023-03-29 17:31:55 +03:00
Petros Amoiridis
a128439699 Move code into the platform
Co-Authored-By: Joseph T. Lyons <19867440+JosephTLyons@users.noreply.github.com>
2023-03-29 16:25:13 +03:00
Petros Amoiridis
87c1b190a8 Replace home directory with the tilde substitution 2023-03-29 16:25:10 +03:00
Antonio Scandurra
719d0f0abf Rename skip_leading_tab to inside_leading_tab 2023-03-29 14:53:28 +02:00
Antonio Scandurra
813f722925 Increment input_column correctly when inside the leading tab 2023-03-29 14:52:50 +02:00
Antonio Scandurra
056f4e914f Merge pull request #2327 from zed-industries/remove-unused-code
Delete unused code
2023-03-29 09:09:47 +02:00
Antonio Scandurra
a64296938d Delete unused code 2023-03-29 09:04:13 +02:00
Mikayla Maki
d60ef03d66 WIP Add copilot disabled setting 2023-03-28 20:52:50 -07:00
Mikayla Maki
0b0c7e4ce9 Move command palette filter into collections crate
Filter out copilot commands from command palette when not active
2023-03-28 20:13:17 -07:00
Mikayla Maki
aea8475d30 Apply cargo fmt 2023-03-28 18:45:37 -07:00
Antonio Scandurra
a5cec18775 Remove copilot smoke test 2023-03-28 18:41:35 -07:00
Antonio Scandurra
12370f120e 🎨 2023-03-28 18:40:51 -07:00
Antonio Scandurra
ce9774be53 Improve detection of common prefix in text_for_active_completion 2023-03-28 18:40:42 -07:00
Mikayla Maki
9d8d2bb8f4 Add rough versions of all 3 modals 2023-03-28 18:00:09 -07:00
Max Brunsfeld
5c1f82ae3d Don't use TabMap::expand_tabs in line_indent_for_buffer_row 2023-03-28 17:37:57 -07:00
Max Brunsfeld
08e93e9321 Only expand tabs up until a limited column 2023-03-28 16:40:04 -07:00
Max Brunsfeld
c23feeab3a 🎨 Make expand_tabs and collapse_tabs instance methods on TabSnapshot 2023-03-28 14:10:43 -07:00
Mikayla Maki
941da24f73 Refactor out the node runtime crate and hook up all related imports 2023-03-28 10:27:31 -07:00
Mikayla Maki
0ef9cefe0f Finish shape of copilot auth UI 2023-03-28 09:42:01 -07:00
Mikayla Maki
6ff09865eb Create copilot auth popup UI 2023-03-28 09:42:01 -07:00
Antonio Scandurra
da81ff3295 Optimize CopilotState::text_for_active_completion 2023-03-28 09:42:01 -07:00
Antonio Scandurra
034bc75467 Refresh copilot suggestions when hitting alt-] if none are showing
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-28 09:42:01 -07:00
Antonio Scandurra
d236d9e8c9 Clear copilot suggestions when hitting escape
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-28 09:42:01 -07:00
Nate Butler
ef6c28326d Update editor.ts 2023-03-28 09:42:01 -07:00
Nate Butler
2fede1c01f Use syntax.predictive.color to style suggestions 2023-03-28 09:42:01 -07:00
Antonio Scandurra
1162615043 Reuse existing suggestion when inserting to avoid flickering 2023-03-28 09:42:01 -07:00
Antonio Scandurra
6715e5247c Rework SuggestionMap to take highlight style when retrieving chunks 2023-03-28 09:42:01 -07:00
Antonio Scandurra
093e0a30e9 Replace editor::CycleCopilotSuggestions with copilot::NextSuggestion 2023-03-28 09:42:01 -07:00
Antonio Scandurra
2f95510a2e Start integrating Copilot with editor
There's still a bit to do in terms of reusing the previous suggestion
when the prefix matches, but we're getting there.
2023-03-28 09:42:01 -07:00
Antonio Scandurra
b16e2169ce WIP: Start on showing window for authenticating with copilot
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-28 09:42:01 -07:00
Antonio Scandurra
9713d1bb31 Fix invalid translation between bottom/top left coordinate spaces
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-28 09:42:01 -07:00
Antonio Scandurra
99cca59c84 Restructure verification code prompting to open a window instead
Also, prevent multiple calls to `sign_in` from racing with each other.
2023-03-28 09:42:01 -07:00
Mikayla Maki
19cc86a2d4 Wait to show the auth modal until the sign request has returned 2023-03-28 09:42:00 -07:00
Mikayla Maki
15e29d44b9 Add basic copilot modal 2023-03-28 09:42:00 -07:00
Mikayla Maki
b57d5174aa Add copilot theme, start sketching out the auth modal 2023-03-28 09:42:00 -07:00
Antonio Scandurra
591e246450 Implement Copilot::completions_cycling
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-28 09:42:00 -07:00
Antonio Scandurra
155594c8b8 Successfully fetch completions from Copilot
We still need to process them and return them into a more Zed-friendly
structure, but we're getting there.
2023-03-28 09:42:00 -07:00
Antonio Scandurra
180371929b Start on copilot completions 2023-03-28 09:42:00 -07:00
Antonio Scandurra
8ba9e63ab8 🎨 2023-03-28 09:42:00 -07:00
Antonio Scandurra
59d9277a74 Implement Copilot sign in and sign out 2023-03-28 09:42:00 -07:00
Antonio Scandurra
797bb7d780 Start copilot and check sign in status 2023-03-28 09:42:00 -07:00
Antonio Scandurra
5471217089 Use the same serde version across the entire workspace 2023-03-28 09:42:00 -07:00
Mikayla Maki
9a99eaee96 Fix bad global 2023-03-28 09:42:00 -07:00
Mikayla Maki
455cdc8b37 Add copilot crate
Refactor HTTP and github release downloading into util
Lazily download / upgrade the copilot LSP from Zed

Co-authored-by: Max <max@zed.dev>
Co-Authored-By: Antonio <antonio@zed.dev>
2023-03-28 09:41:59 -07:00
Julia
35b2aceffb Merge pull request #2324 from zed-industries/download-node
Automatically download Node for Node based language servers
2023-03-28 12:10:24 -04:00
Julia
ee3ac9c344 Rename installation.rs -> github.rs now that is all it concerns 2023-03-28 11:51:09 -04:00
Julia
350f8ed304 Download the JSON LSP package instead of our own bundled binary 2023-03-28 11:48:00 -04:00
Julia
d4560fe321 Prevent deadlock when multiple languages attempt to install Node at once 2023-03-28 10:18:22 -04:00
Max Brunsfeld
c68c8462bb Merge pull request #2322 from zed-industries/project-panel-paste-infinite-loop
Fix infinite loop in ProjectPanel::paste when filename has multiple dots
2023-03-27 17:09:10 -07:00
Max Brunsfeld
17bc83d699 Fix infinite loop in ProjectPanel::paste when filename has multiple dots 2023-03-27 16:45:11 -07:00
Max Brunsfeld
e5d552ef97 Merge pull request #2321 from zed-industries/new-file-with-no-window
Make 'new file' action open a window when there are no windows open
2023-03-27 16:10:30 -07:00
Max Brunsfeld
4a2132bc91 Make 'new file' action open a window when there are no windows open 2023-03-27 16:05:00 -07:00
Joseph T. Lyons
e10338ed17 Merge pull request #2313 from zed-industries/unify-spelling-of-key-binding-to-be-two-words
Unify spelling of `key binding` to be two words
2023-03-27 15:58:12 -04:00
Petros Amoiridis
eb7c6028f4 Merge pull request #2320 from zed-industries/petros/z-349-make-restart-to-update-zed-look
Make "Restart to update Zed" look clickable
2023-03-27 20:19:06 +03:00
Julia
df4380b066 Download aarch64 or x64 Node binary according to system architecture 2023-03-27 11:05:17 -04:00
Petros Amoiridis
b153bf7118 Add a hovered style to lspStatus background 2023-03-27 14:26:56 +03:00
Petros Amoiridis
374b284a3d Run prettier on TS files 2023-03-27 14:26:05 +03:00
Julia
c72d33e029 Initial impl of NodeRuntime w/JSON borked and a deadlock :)
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-27 00:00:16 -04:00
Julia
1a2e509e35 Remove server_args from LspAdapter
Prepare to remove concept of a runtime from greater server startup code,
which is important for future language server extensibility

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-27 00:00:16 -04:00
Julia
ed442cfc8c Invoke npm from downloaded Node 2023-03-27 00:00:16 -04:00
Julia
edd6c85af7 Initial running of servers on downloaded Node 2023-03-27 00:00:16 -04:00
Julia
b579211861 Report if language server requires Node or not 2023-03-27 00:00:16 -04:00
Nathan Sobo
d89936e4a9 Merge pull request #2319 from zed-industries/copy-highlight-json
Add "editor: copy highlight json" command
2023-03-24 17:17:45 -06:00
Nathan Sobo
f0992e7d67 Trim empty tokens; copy selected range if non-empty 2023-03-24 17:10:50 -06:00
Nathan Sobo
3dfedd1b21 Merge adjacent chunks with the same highlight name in copied JSON 2023-03-24 16:52:00 -06:00
Nathan Sobo
195215f1e0 Add "editor: copy highlight json" command
Nate needs this to feed to Figma for highlighted code in designs.
2023-03-24 16:37:57 -06:00
Max Brunsfeld
c74f8eb9e3 Merge pull request #2258 from zed-industries/lsp-file-change-notifications
Implement `DidChangedWatchedFiles` LSP feature
2023-03-24 14:42:23 -07:00
Max Brunsfeld
455ffb17f1 Handle path changes and progress updates from all worker threads during initial scan 2023-03-24 14:35:18 -07:00
Max Brunsfeld
027def6800 Merge branch 'main' into lsp-file-change-notifications 2023-03-24 08:52:43 -07:00
Max Brunsfeld
a0e98ccc35 🎨 BackgroundScanner::run 2023-03-23 18:05:12 -07:00
Max Brunsfeld
89e99d2902 🎨 Don't store path changes statefully on the background scanner 2023-03-23 16:04:47 -07:00
Max Brunsfeld
3ff5aee4a1 Respect LSP servers watch glob patterns 2023-03-23 16:03:07 -07:00
Mikayla Maki
76b75b4b43 Merge pull request #2318 from zed-industries/fix-unknown-in-non-editor-buffers
changed language status bar item to only show on editors
2023-03-23 13:33:42 -07:00
Mikayla Maki
5db11c628b changed language status bar item to only show on editors 2023-03-23 13:29:23 -07:00
Mikayla Maki
5cad3d3a67 Merge pull request #2317 from zed-industries/fix-titlebar-right-spacing
Fix misaligned UI in the right titlebar
2023-03-23 13:16:40 -07:00
Mikayla Maki
bb5c2833a3 Aligned title bar items to the center and fixed left spacing on the sign in button
co-authored-by: max <max@zed.dev>
2023-03-23 13:08:31 -07:00
Petros Amoiridis
566a04ebca Merge pull request #2311 from zed-industries/petros/z-279-add-terminals-count
Add terminals count
2023-03-23 10:52:01 +02:00
Mikayla Maki
f9d3963dbb Merge pull request #2315 from zed-industries/fix-fold-indicator-offsets
Fix fold indicator offsets
2023-03-22 17:13:13 -07:00
Mikayla Maki
e87c3b6dd7 Update element.rs
remove spare parens
2023-03-22 17:05:54 -07:00
Mikayla Maki
e729c4ad4f Fix fold indicator offsets 2023-03-22 17:04:52 -07:00
Max Brunsfeld
361b7c3a0c Clear auto-indent requests when replacing a buffer's entire text 2023-03-22 15:10:16 -07:00
Max Brunsfeld
eaee5571a0 Use a more stable, readable serialization format for neovim-backed vim tests 2023-03-22 14:31:11 -07:00
Joseph Lyons
6de38f7410 v0.80.x dev 2023-03-22 16:33:06 -04:00
Julia
df553de363 Merge pull request #2314 from zed-industries/another-one
Remove another spot with a flag old npm does not like
2023-03-22 15:56:23 -04:00
Julia
4fc37cf982 Remove another spot with a flag old npm does not like 2023-03-22 15:40:51 -04:00
Joseph Lyons
9d88cd8842 Unify spelling of key binding to be two words 2023-03-22 13:34:12 -04:00
Petros Amoiridis
fd9eff3a78 Remove struct 2023-03-22 19:28:06 +02:00
Petros Amoiridis
bd1515cdd2 Only show count when we have terminals
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-03-22 18:23:41 +02:00
Joseph T. Lyons
bd85ef363f Merge pull request #2312 from zed-industries/unkown
Fix typo in "Unknown" language
2023-03-22 11:20:18 -04:00
Nathan Sobo
e017b99384 Fix typo 2023-03-22 09:13:10 -06:00
Petros Amoiridis
15406ff2d9 Remove comment 2023-03-22 16:31:42 +02:00
Petros Amoiridis
d5bb2d13b8 Introduce terminal button count
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-22 16:13:58 +02:00
Petros Amoiridis
aa7254167a Fix typo 2023-03-22 15:31:21 +02:00
Antonio Scandurra
005eb559ee Merge pull request #2310 from zed-industries/fix-sharing-status-indicator
Remove screen sharing indicator when call ends
2023-03-22 09:40:23 +01:00
Antonio Scandurra
7df798ded5 Remove screen sharing indicator when call ends
Previously, we would only remove it when the screen sharing stopped.
2023-03-22 09:32:27 +01:00
Max Brunsfeld
c1f53358ba Remove unnecessary Arc around background scanner's snapshot 2023-03-21 15:47:02 -07:00
Max Brunsfeld
f7b2713b77 Fix error in joining empty paths 2023-03-21 15:41:24 -07:00
Max Brunsfeld
5da2b123b5 Allow refreshing worktree entries while the initial scan is in-progress 2023-03-21 15:15:12 -07:00
Max Brunsfeld
b10b0dbd75 Only mutate background snapshot in the background scanner 2023-03-21 11:26:33 -07:00
Max Brunsfeld
d742c758bc Restructure communication from BackgroundScanner to LocalWorktree
The worktree no longer pulls the background snapshot from the background scanner.
Instead, the background scanner sends both snapshots to the worktree. Along with
these, it sends the path change sets.

Also, add randomized test coverage for the worktree UpdatedEntries events.
2023-03-21 11:26:13 -07:00
Max Brunsfeld
cbeb6e692d Move postage crate version specification to workspace Cargo.toml 2023-03-21 11:26:13 -07:00
Max Brunsfeld
d36b2a3129 🎨 Simplify some worktree methods
* Consolidate local worktree construction into one method
* Simplify remote worktree construction
* Reduce indirection around pulling worktree snapshots from the background
2023-03-21 11:26:13 -07:00
Max Brunsfeld
399f082415 Update wrong assertions after fixing missing event in FakeFs 2023-03-21 11:26:13 -07:00
Max Brunsfeld
51b093197d Add missing import in project tests 2023-03-21 11:26:13 -07:00
Max Brunsfeld
27ad6a57ce Tweak logging in worktree randomized test 2023-03-21 11:26:13 -07:00
Max Brunsfeld
c730dca3c5 Update worktree randomized test to use worktree's public interface and the fake fs 2023-03-21 11:26:13 -07:00
Max Brunsfeld
be5868e1c0 Conservatively report fs events that occurred during initial worktree scan
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-03-21 11:26:13 -07:00
Max Brunsfeld
61172c8478 Notify language servers of FS changes 2023-03-21 11:26:13 -07:00
Max Brunsfeld
9837a6e288 Add failing test for reporting FS change events to language servers 2023-03-21 11:26:13 -07:00
Antonio Scandurra
194c7a3af0 Merge pull request #2309 from zed-industries/suggestion-map
Introduce `DisplayMap::replace_suggestion`
2023-03-21 18:18:50 +01:00
Antonio Scandurra
2893c9bdb7 Don't move up/down by more rows than the requested ones
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-03-21 17:52:53 +01:00
Antonio Scandurra
f7cba4cec4 Make Suggestion fields public 2023-03-21 16:51:33 +01:00
Antonio Scandurra
ba3913df8c Expose a DisplayMap::replace_suggestion method 2023-03-21 16:41:54 +01:00
Antonio Scandurra
9c8732a355 Integrate SuggestionMap into the rest of DisplayMap 2023-03-21 16:39:02 +01:00
Antonio Scandurra
d1978a719b Add a version field to SuggestionSnapshot 2023-03-21 12:47:04 +01:00
Antonio Scandurra
3d165f705f Extract a SuggestionMap::randomly_mutate method 2023-03-21 11:51:06 +01:00
Antonio Scandurra
35830a0271 Implement SuggestionSnapshot::to_{fold,suggestion}_point 2023-03-21 11:39:29 +01:00
Antonio Scandurra
d448a5cb5c Implement SuggestionSnapshot::to_point 2023-03-21 11:28:36 +01:00
Antonio Scandurra
f829ce5641 Implement SuggestionSnapshot::to_offset 2023-03-21 11:28:33 +01:00
Antonio Scandurra
c0e124a55a Implement SuggestionSnapshot::text_summary_for_range 2023-03-21 11:28:30 +01:00
Antonio Scandurra
52a156aebe Implement SuggestionSnapshot::clip_point 2023-03-21 11:28:27 +01:00
Antonio Scandurra
ccb6196224 Implement SuggestionSnapshot::buffer_rows 2023-03-21 11:28:23 +01:00
Antonio Scandurra
1a9dbfa86a Add unit test to verify basic properties of the SuggestionMap 2023-03-21 08:29:33 +01:00
Joseph T. Lyons
8c0dd887ff Merge pull request #2299 from zed-industries/correct-verb-tense-in-default-settings
Correct verb tense in default settings
2023-03-20 14:50:46 -04:00
Antonio Scandurra
3edf83cb99 Implement SuggestionSnapshot::line_len
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-03-20 19:45:39 +01:00
Antonio Scandurra
f44549eb29 Enhance randomized test to verify SuggestionMap::{chunks,sync}
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-03-20 19:29:22 +01:00
Antonio Scandurra
4d6726ef39 WIP: Flesh out more of the suggestions randomized test 2023-03-20 18:06:24 +01:00
Petros Amoiridis
98ae69a61f Merge pull request #2282 from zed-industries/petros/z-283-make-pop-up-positioning-consistent
Consistent pop-up menu positions
2023-03-20 17:55:40 +02:00
Petros Amoiridis
24bbca7326 Position pane new, split, and dock context menus
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-03-20 17:49:33 +02:00
Nathan Sobo
d429ce0f62 Merge pull request #2308 from zed-industries/feedback-icon
Use an envelope as the feedback icon so we can use the speech bubble for discussions
2023-03-20 09:14:34 -06:00
Nathan Sobo
10e6c5b651 Use an envelope as the feedback icon
This makes room to use the speech bubble for discussion threads.
2023-03-20 09:04:30 -06:00
Antonio Scandurra
9970e5f60c Start on randomized test and add SuggestionMapSnapshot::chunks 2023-03-20 15:56:15 +01:00
Antonio Scandurra
fb48854e5a Simplify signature of SuggestionMap::replace 2023-03-20 14:00:14 +01:00
Antonio Scandurra
83051f1e86 Add SuggestionMap::replace 2023-03-20 13:50:14 +01:00
Antonio Scandurra
94a9e28e35 Start on SuggestionMap 2023-03-20 13:22:14 +01:00
Mikayla Maki
2a024a255f Merge pull request #2307 from zed-industries/fix-panic-in-editor-tab-content
Do UTF8-aware truncation on long item names in editor item
2023-03-18 15:49:06 -07:00
Mikayla Maki
436c59d8ef Do UTF8-aware truncation on long item names in editor item 2023-03-18 15:44:23 -07:00
Mikayla Maki
5356ec4730 Merge pull request #2287 from zed-industries/fix-fold-range-finding
Fix code folds with wraps
2023-03-17 17:18:56 -07:00
Mikayla Maki
5a3d5dff42 Make folds tab aware 2023-03-17 17:14:40 -07:00
Mikayla Maki
c39b4ac229 Fix boundary condition in buffer_line_len when at the end of a file
co-authored-by: max <max@zed.dev>
2023-03-17 16:56:44 -07:00
Mikayla Maki
5a1bbb96ba Merge pull request #2302 from zed-industries/fix-dispatch-path-panic
Align dispatch_keystroke with other uses of ancestors iterator
2023-03-17 16:34:00 -07:00
Mikayla Maki
b16e53a577 Merge pull request #2306 from zed-industries/fix-panic-with-multi-line-env
Parse user enviroment using null terminators instead of newlines
2023-03-17 16:18:05 -07:00
Mikayla Maki
109e17b4b2 Parse user enviroment using null terminators instead of newlines 2023-03-17 16:14:07 -07:00
Mikayla Maki
eba119b914 Fix fold tests with new representation
Switch UI code from using display rows to using buffer rows
Make folds only show up on lines with line layouts

co-authored-by: Max <max@zed.dev>
2023-03-17 16:00:22 -07:00
Max Brunsfeld
fc828971f1 collab 0.8.2 2023-03-17 15:00:31 -07:00
Max Brunsfeld
691383ca68 Merge pull request #2305 from zed-industries/faster-access-token-validation
Faster access token validation
2023-03-17 14:56:30 -07:00
Max Brunsfeld
b8e8363a72 Add logging and metric for time spent hashing auth tokens
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2023-03-17 14:32:13 -07:00
Max Brunsfeld
623133ffa0 Reduce scrypt work factor to speed up websocket authentication
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2023-03-17 14:31:39 -07:00
Max Brunsfeld
9633a4b527 Return a 400, not a 500 when token validation fails
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-17 13:56:12 -07:00
Julia
368a6405a1 Increase git diff gutter width slightly 2023-03-17 15:28:38 -04:00
Mikayla Maki
459e320d79 Merge pull request #2303 from zed-industries/add-unknown-language
Add an 'Unknown' state for a mouse-driven way to select a file language
2023-03-17 11:41:40 -07:00
Mikayla Maki
04f52c3d50 Show active buffer language in all cases 2023-03-17 11:34:17 -07:00
Max Brunsfeld
26dae3c04e Lookup access tokens by id when authenticating a connection
This avoids the cost of hashing an access token multiple times,
to compare it to all known access tokens for a given user.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-17 11:13:50 -07:00
Mikayla Maki
578c69476d Align dispatch_keystroke with other uses of ancestors iterator and filter out non-existant views 2023-03-17 11:07:10 -07:00
Mikayla Maki
1125a168f4 Merge pull request #2301 from zed-industries/fix-file-finder-panic
Never call set_selected_index with an invalid index
2023-03-17 10:18:27 -07:00
Antonio Scandurra
d8758658e3 Merge pull request #2300 from zed-industries/ligatures
Allow customization of OpenType features
2023-03-17 17:34:17 +01:00
Mikayla Maki
f7f9b8cffe Never call set_selected_index with an invalid index 2023-03-17 09:32:01 -07:00
Antonio Scandurra
1af8f4be19 Deserialize Theme directly into the heap to avoid stack overflow
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-03-17 15:58:52 +01:00
Antonio Scandurra
786d95b8c8 Avoid storing fonts::Features in TextStyle
We were only using it for debugging purposes and that was causing
the `Theme` struct to become too big to hold on the stack.

Co-Authored-By: Julia Risley <julia@zed.dev>
2023-03-17 15:12:02 +01:00
Antonio Scandurra
4d915f4530 Don't make fonts::Features Copy 2023-03-17 13:54:56 +01:00
Antonio Scandurra
989c9f0196 Mention calt: false in the default settings to disable ligatures 2023-03-17 13:48:34 +01:00
Antonio Scandurra
f9d793cb4a Honor more OpenType features 2023-03-17 13:40:00 +01:00
Petros Amoiridis
3bddf01962 Run prettier to format things 2023-03-17 14:05:49 +02:00
Petros Amoiridis
86ed5b8b83 Position contacts and user menus
Using the new approach for consistency
2023-03-17 14:05:46 +02:00
Antonio Scandurra
9181ac9872 Honor the calt font feature 2023-03-17 12:01:27 +01:00
Antonio Scandurra
76167ca65c Allow setting font features on TextStyle 2023-03-17 11:49:22 +01:00
Antonio Scandurra
7d13b00914 Allow setting font features on the terminal as well 2023-03-17 11:42:24 +01:00
Antonio Scandurra
b2c733baab WIP: Allow specifying font features in the editor
This just lays the foundation for threading through a `fonts::Features`
struct, but it's not used yet.
2023-03-17 09:51:36 +01:00
Joseph Lyons
6eb65eb989 Correct verb tense in default settings 2023-03-17 00:51:03 -04:00
Julia
3464961aa4 Merge pull request #2298 from zed-industries/fix-deadlock
Fix deadlock while initializing JSON language server
2023-03-16 17:41:54 -04:00
Julia
757f05042d Fix deadlock while initializing JSON language server
As it turns out both parking-lot and std's `RwLock` disallows taking
multiple read locks on the same thread

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-03-16 17:32:51 -04:00
Max Brunsfeld
9633732db7 collab 0.8.1 2023-03-16 14:21:35 -07:00
Max Brunsfeld
e34d80cff4 Merge pull request #2296 from zed-industries/tx-serialization-retry-delay
Introduce a delay before retrying a transaction after a serialization failure
2023-03-16 14:16:20 -07:00
Mikayla Maki
f2492666d4 Merge pull request #2297 from zed-industries/fix-random-panics
WIP: Fix random panics
2023-03-16 13:20:54 -07:00
Joseph T. Lyons
b3b20e4c46 Merge pull request #2295 from zed-industries/swap-atom-keybinding-for-CollapseSelectedEntry
Swap atom keybinding for CollapseSelectedEntry
2023-03-16 16:12:28 -04:00
Max Brunsfeld
b9bc66aa9b Log the delay when retrying a transaction 2023-03-16 13:07:38 -07:00
Max Brunsfeld
35280f7d80 Introduce a delay before retrying a transaction after a serialization failure
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-16 13:07:38 -07:00
Mikayla Maki
6571555c4d Fix unwrap in git2 library causing panics in Zed 2023-03-16 13:06:23 -07:00
Joseph Lyons
a252c2a15b Swap atom keybinding for CollapseSelectedEntry
This is a temporary solution to this bug:

https://linear.app/zed-industries/issue/Z-340/the-project-panel-shouldnt-be-listening-to-key-commands-when-editing-a
2023-03-16 15:59:14 -04:00
Mikayla Maki
c3325430ca Fix divide by 0 in terminal
Fix fail to remove contact in contact list
2023-03-16 12:31:50 -07:00
Julia
1fbdea6a03 Merge pull request #2294 from zed-industries/remove-flag-old-npm-does-not-like
Remove CLI flag which old versions of NPM do not like
2023-03-16 13:11:45 -04:00
Julia
24dba2157f Remove CLI flag which old versions of NPM do not like
TODO: Bundle or version restrict Node
2023-03-16 13:07:09 -04:00
Mikayla Maki
c427a8c584 WIP - DEBUGGING 2023-03-16 08:41:19 -07:00
Antonio Scandurra
356b8c6980 Merge pull request #2293 from zed-industries/yaml-hover-bug
Fix hover popover rendering lots of `&emsp` for YAML
2023-03-16 16:15:14 +01:00
Antonio Scandurra
9498f02f2c Retrieve workspace configuration before initializing language server 2023-03-16 15:01:31 +01:00
Antonio Scandurra
f5a4c6a7c1 Provide editor.tabSize in workspace configuration for YAML
This fixes a bug that caused the hover popover to display lots of
`&emsp;` occurrences.
2023-03-16 10:46:55 +01:00
Antonio Scandurra
88e664bfd9 Add test for language registration and loading 2023-03-16 10:46:55 +01:00
Antonio Scandurra
8a685fa52a Use LanguageRegistry::workspace_configuration everywhere 2023-03-16 10:46:55 +01:00
Antonio Scandurra
4d52fc0d12 Remove available language only when it has loaded
This also ensures that, if you load the same language more than once,
a future that resolves to the language (or an error) is returned at
all times. Previously, we would only return it the first time the language
was loaded.
2023-03-16 10:46:55 +01:00
Antonio Scandurra
a8ac08f5bd Coalesce multiple RwLocks into one LanguageRegistryState struct 2023-03-16 10:46:55 +01:00
Antonio Scandurra
e30ea43a14 Include loaded languages when computing lsp workspace configuration 2023-03-16 10:46:55 +01:00
Antonio Scandurra
60d3fb48e2 Start computing workspace configuration more dynamically 2023-03-16 10:46:55 +01:00
Max Brunsfeld
ed9927b495 Merge pull request #2292 from zed-industries/restart-app
Make 'restart' action more reliable
2023-03-15 18:01:22 -07:00
Max Brunsfeld
d69868fa44 Make restart action more reliable 2023-03-15 17:44:50 -07:00
Julia
1ed3aedb16 Merge pull request #2291 from zed-industries/change-LSHandlerRank
Change `LSHandlerRank` to `Alternate`
2023-03-15 19:33:33 -04:00
Julia
905e2586e9 Change LSHandlerRank to Alternate 2023-03-15 19:18:39 -04:00
Max Brunsfeld
51eb53be0d Merge pull request #2290 from zed-industries/close-remote-projects-when-leaving-call
Close remote project windows when leaving a call
2023-03-15 15:34:51 -07:00
Max Brunsfeld
b34477458e Close remote project windows when leaving a call 2023-03-15 15:24:58 -07:00
Nathan Sobo
385dfe1661 Merge pull request #2289 from zed-industries/sort-language-names-case-agnostically
Sort language names case agnostically
2023-03-14 20:00:52 -06:00
Joseph Lyons
3c7237e600 Sort language names case agnostically 2023-03-14 21:45:17 -04:00
Nathan Sobo
44a2506c40 Merge pull request #2288 from zed-industries/cut-off-collaborator-avatars
Fix collaborator avatars being clipped and not centered
2023-03-14 19:39:01 -06:00
Max Brunsfeld
c4e7611d04 Fix collaborator avatars being clipped and not centered
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Julia Risley <julia@zed.dev>
2023-03-14 17:59:33 -07:00
Mikayla Maki
75bea91245 Convert code folding to be in terms of buffer points instead of display points
Co-authored-by: max <max@zed.dev>
2023-03-14 16:48:03 -07:00
Max Brunsfeld
828e9c1bb8 v0.79.x dev 2023-03-14 12:49:33 -07:00
Max Brunsfeld
2042188f5a Merge pull request #2286 from zed-industries/discoverable-sign-in
Make sign-in more discoverable
2023-03-14 11:08:18 -07:00
Max Brunsfeld
0bbb4b22c6 Rename 'Authenticate' action to 'Sign In'
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-14 11:01:23 -07:00
Max Brunsfeld
75901f1c33 Show sign in button directly in titlebar when not signed in
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-14 10:59:39 -07:00
Antonio Scandurra
a6ebc9bd26 collab 0.8.0 2023-03-14 18:21:16 +01:00
Antonio Scandurra
9e3085b0c4 Merge pull request #2284 from zed-industries/automatic-user-creation
Create user record automatically when someone logs in on the website
2023-03-14 18:20:13 +01:00
Mikayla Maki
7af9dda869 Merge pull request #2285 from zed-industries/fix-failed-theme-setting
Fix failed theme setting
2023-03-14 10:10:39 -07:00
Mikayla Maki
2a5ac4f203 Merge pull request #2283 from zed-industries/fix-code-fold-indicator-scaling
Change fold icon width to scale with font size
2023-03-14 10:07:25 -07:00
Mikayla Maki
d8a3f16891 Refactor load into a seperate function 2023-03-14 09:56:27 -07:00
Mikayla Maki
99257a8213 Fix failed initialization of setting file in welcome experience 2023-03-14 09:46:28 -07:00
Antonio Scandurra
0f429243d7 Fix seed binary 2023-03-14 12:37:56 +01:00
Antonio Scandurra
cba41ef7c5 Create user record automatically when someone logs in on the website
Now that we are moving out of the private alpha, we should let everyone
in when they try to log into zed.dev.
2023-03-14 12:25:04 +01:00
Mikayla Maki
2ba38b2fca Change icon width to scale with font size 2023-03-14 00:42:15 -07:00
Petros Amoiridis
e7f78c4f74 Merge pull request #2281 from zed-industries/petros/z-298-the-terminal-button-is-not-shown-for
Remove check for staffmode
2023-03-14 00:12:13 -07:00
Petros Amoiridis
8980df1f5d Remove feature flag
It wasn't working in production anyway
2023-03-14 09:05:04 +02:00
Nathan Sobo
2db8ac4a6f Merge pull request #2280 from zed-industries/terms
Add terms of use to DMG in the bundle script
2023-03-13 16:08:07 -06:00
Nathan Sobo
818a514110 Add terms of use to DMG in the bundle script
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-03-13 15:47:59 -06:00
Mikayla Maki
1b4f783b97 Merge pull request #2279 from zed-industries/remove-invite-link
Remove UI for invite link in prep for beta launch
2023-03-13 14:35:52 -07:00
Mikayla Maki
88599add56 Remove UI for invite link in prep for beta launch 2023-03-13 12:54:20 -07:00
Max Brunsfeld
05f6747132 v0.78.x dev 2023-03-13 12:00:56 -07:00
Max Brunsfeld
1096720b41 Merge pull request #2244 from zed-industries/less-surprising-defaults
Clean up some default settings
2023-03-13 11:54:46 -07:00
Julia
5c7c4dd4dd Clean up some default settings 2023-03-13 14:54:28 -04:00
Max Brunsfeld
da35202bbf Merge pull request #2278 from zed-industries/screenshares-from-before-joining
Fix failure to see screenshare tracks that were started prior to join…
2023-03-13 11:22:40 -07:00
Max Brunsfeld
f5c4a2a0dd Fix failure to see screenshare tracks that were started prior to joining a call
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-13 11:15:22 -07:00
Mikayla Maki
77a63c6598 Merge pull request #2277 from zed-industries/switch-invite-person-icon
Update Collab + icon
2023-03-13 10:54:33 -07:00
Nate Butler
edd925f77b Format 2023-03-13 13:49:00 -04:00
Nate Butler
6d0f8290a4 Merge pull request #2276 from zed-industries/improve-picker-state-contrast
Improve picker state contrast
2023-03-13 13:48:04 -04:00
Nate Butler
6497ca8ccb Update icon 2023-03-13 13:47:58 -04:00
Max Brunsfeld
e60dea7049 collab 0.7.2 2023-03-13 10:11:44 -07:00
Nate Butler
e64fe6d660 Improve contrast of project panel active state in light themes 2023-03-13 13:10:46 -04:00
Antonio Scandurra
f6f09e8661 Merge pull request #2274 from zed-industries/leave-on-quit
Leave room on quit
2023-03-13 18:08:01 +01:00
Max Brunsfeld
ef7d8f46df Merge pull request #2273 from zed-industries/fix-dock-opening-in-collaboration
Fix dock opening on collaboration
2023-03-13 10:04:43 -07:00
Nate Butler
7df2440757 Format 2023-03-13 12:59:23 -04:00
Nate Butler
6fd4e28813 Update picker active and hover styles
Thanks for pointing this out @ForLoveOfCats

Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-03-13 12:59:17 -04:00
Antonio Scandurra
bca1acf6d3 Leave room on quit
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-03-13 17:52:10 +01:00
Mikayla Maki
097a768725 Remove panic in recent projects picker 2023-03-13 09:44:42 -07:00
Mikayla Maki
404dd43c30 Fix dock opening on collaboration 2023-03-13 09:36:45 -07:00
Petros Amoiridis
c6f27903cc Merge pull request #2271 from zed-industries/petros/z-278-lock-pop-up-to-the-terminal-button
A new approach for positioning pop-up menus tied to an icon/button
2023-03-13 08:46:44 -07:00
Antonio Scandurra
f6b0c56a47 Merge pull request #2268 from zed-industries/mention-username-of-user-in-prompt-when-removing-a-contact
Mention username of user in prompt when removing a contact
2023-03-13 14:28:11 +01:00
Antonio Scandurra
e45d680126 Merge pull request #2272 from zed-industries/add-textmate-keymap
Add TextMate keymap
2023-03-13 14:26:32 +01:00
Antonio Scandurra
e993d32900 Merge pull request #2270 from zed-industries/add-default-keybindings-for-reveal-in-finder
Add default keybindings for reveal in finder
2023-03-13 14:25:26 +01:00
Antonio Scandurra
09911d43bc Merge pull request #2269 from zed-industries/unify-action-names-with-keybinding-names
Unify action names with keybinding name
2023-03-13 14:24:42 +01:00
Joseph Lyons
c8696149b8 Add TextMate keymap 2023-03-13 08:27:04 -04:00
Petros Amoiridis
db73d831c7 Use local overlay position mode and alignment
When we show the context menu, we don't specify an explicit position other than the default one which is equal to the origin in the context of a local overlay position mode. We then rely on `AnchorCorner` and aligning the context menu child view in the stack with `top().right()` for pop-ups that need to appear at the top of the icon/button.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-13 12:50:12 +02:00
Petros Amoiridis
d2411a6c86 Merge pull request #2253 from zed-industries/joseph/z-226-add-terminal-popup-menu
Add terminal pop up menu
2023-03-13 02:47:44 -07:00
Petros Amoiridis
726c8eb43f Use type_id to determine what has the focus
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-13 11:42:40 +02:00
Joseph Lyons
c59dafab7e Update method names to match action names 2023-03-12 06:08:12 -04:00
Joseph Lyons
e272a1a18f Switch github_login to String
One of our macros, `impl_actions!`, didn't like that `RemoveContact` had a lifetime.
2023-03-12 05:03:31 -04:00
Joseph Lyons
90bca1b94a Add default keybindings for reveal in finder 2023-03-12 04:58:17 -04:00
Joseph Lyons
06ad3a7f7b Unify action names with keybinding name 2023-03-12 04:37:39 -04:00
Joseph Lyons
c18f1b6246 Mention username of user in prompt when removing a contact 2023-03-11 19:28:35 -05:00
Joseph Lyons
46efb844af Remove hardcoding of "Terminal" string 2023-03-11 16:27:00 -05:00
Petros Amoiridis
29f0078084 Show tooltip for Give Feedback icon 2023-03-11 17:40:47 +02:00
Petros Amoiridis
432aeeac56 Remove comment
I know @JosephTLyons you had added that, but I am not entirely sure this is how the view should be called. Let's discuss this further if you fill strong about it.
2023-03-11 17:22:21 +02:00
Petros Amoiridis
8440a98850 Activate terminal button when a terminal is focus
This is code I brought over from https://github.com/zed-industries/zed/pull/2267 by @mikayla-maki after fixing the conflicts.

Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-03-11 16:45:28 +02:00
Petros Amoiridis
bccc34c61a Merge branch 'main' into joseph/z-226-add-terminal-popup-menu 2023-03-11 16:42:42 +02:00
Max Brunsfeld
e8b3d4e0fa Encode db-max-connections env var as a string in k8s manifest 2023-03-10 17:19:16 -08:00
Max Brunsfeld
ff1c7db38f collab 0.7.1 2023-03-10 16:36:03 -08:00
Mikayla Maki
30a08467b0 Merge pull request #2263 from zed-industries/language-status-bar
Language status bar
2023-03-10 16:26:42 -08:00
Mikayla Maki
c8de738972 Align feedback button styles with other sidebar buttons
Make feedback button reflect whether you're in a feedback buffer
2023-03-10 16:19:33 -08:00
Mikayla Maki
87ac409e51 Merge pull request #2265 from zed-industries/fix-menu-bar-greying-out
Fix too-agressive menu bar greying
2023-03-10 16:05:07 -08:00
Mikayla Maki
badfe70a93 Merge pull request #2267 from zed-industries/fix-terminal-icon-active-state
Activate and deactivate the terminal icon based on focused view
2023-03-10 16:02:34 -08:00
Mikayla Maki
11d8394af2 Fix the terminal icon button to only be active when a terminal is focused 2023-03-10 15:54:42 -08:00
Mikayla Maki
c24194156e Merge pull request #2257 from zed-industries/check-all-contexts
Fix keyboard shortcuts not showing
2023-03-10 15:52:56 -08:00
Mikayla Maki
ece2af1e22 Fix a corner case in available action resolution
Add tests for new keybinding resolution behavior

co-authored-by: max <max@zed.dev>
2023-03-10 15:36:20 -08:00
Mikayla Maki
adf94a1681 Switch from using the key window to the main window mac platform API
When the help menu is open, the help menu's search field is the key window, and this was causing menu item action resolution to fail

co-authored-by: Max <max@zed.dev>
2023-03-10 14:43:28 -08:00
Julia
09d306df85 Merge pull request #2266 from zed-industries/avoid-panic
Avoid panic scanning recursive symlink before gitignore is encountered
2023-03-10 17:19:55 -05:00
Julia
0a5cf4b831 Avoid panic scanning recursive symlink before gitignore is encountered 2023-03-10 16:54:57 -05:00
Mikayla Maki
9398de6a57 Add feedback for telemetry item when there's no data 2023-03-10 13:15:36 -08:00
Mikayla Maki
e45104a1c0 Move feedback to overflow menu and help menu 2023-03-10 12:48:11 -08:00
Mikayla Maki
74b10e4ba5 Merge pull request #2264 from zed-industries/make-terminal-default-better
Make terminal fallback correctly when unable to deserialize a cwd
2023-03-10 12:27:54 -08:00
Mikayla Maki
ddbffd2c41 Make terminal fallback correctly when unable to deserialize your cwd 2023-03-10 12:23:29 -08:00
Mikayla Maki
00a38e4c3b Bound the search range for the keybindings by the highest handler path 2023-03-10 12:12:32 -08:00
Mikayla Maki
37d01c7fb3 Merge pull request #2199 from zed-industries/welcome-experience
Welcome experience
2023-03-10 10:48:30 -08:00
Mikayla Maki
281ff92236 Stub out blank pane experience 2023-03-10 09:58:11 -08:00
Antonio Scandurra
bb721a08f5 💄 2023-03-10 17:43:48 +01:00
Antonio Scandurra
f50b51bdad Adjust styling 2023-03-10 17:37:45 +01:00
Antonio Scandurra
693172854c Show active buffer's language on the right in the status bar 2023-03-10 17:37:34 +01:00
Antonio Scandurra
b3c7526fb5 Return last excerpt in MultiBuffer::excerpt_containing if overshooting 2023-03-10 17:28:08 +01:00
Antonio Scandurra
6e37ff880f Replace "Give Feedback" with an icon and move it to the left
This is so we can show the current language in the status bar on
the right, and having two pieces of text sitting next to each other
felt too busy.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-03-10 17:02:52 +01:00
Antonio Scandurra
f08685f65f Merge pull request #2262 from zed-industries/manual-language-selection
Introduce language selector
2023-03-10 16:38:17 +01:00
Antonio Scandurra
ce828d55d5 Bind language_selector::Toggle to cmd-k m
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-03-10 16:32:18 +01:00
Antonio Scandurra
f28806d09b Emphasize currently-selected language 2023-03-10 15:48:39 +01:00
Antonio Scandurra
686f5439ad Set buffer language when confirming selection in language selector
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-03-10 15:34:26 +01:00
Antonio Scandurra
b402f27d50 Introduce a new language picker that displays available languages
Right now this panics when trying to select a language, so that's
what we're going to implement next.

Co-Authored-By: Julia Risley <julia@zed.dev>
2023-03-10 15:28:10 +01:00
Antonio Scandurra
d39c761de5 Merge pull request #2261 from zed-industries/async-language-loading
Allow waiting for language to be loaded in LanguageRegistry APIs
2023-03-10 15:27:08 +01:00
Antonio Scandurra
7a600e7a65 Allow waiting for language to be loaded in LanguageRegistry APIs 2023-03-10 12:17:47 +01:00
Antonio Scandurra
221bb54e48 Introduce a new TryFutureExt::unwrap method 2023-03-10 11:41:13 +01:00
Antonio Scandurra
431e11a033 Merge pull request #2260 from zed-industries/increase-max-connections
Increase the amount of max connections to the database
2023-03-10 10:27:26 +01:00
Antonio Scandurra
8b7273e46e Increase the amount of max connections to the database 2023-03-10 10:10:59 +01:00
Mikayla Maki
9dc608dc4b Switch from changing the meaning of the predicate to adding an additional match_dispatch_path_context API for UI elements 2023-03-09 19:32:09 -08:00
Mikayla Maki
648f0e5b7b Remove new logo from style tree 2023-03-09 19:18:17 -08:00
Julia
b40ea4df14 Merge pull request #2259 from zed-industries/preserve-contacts-editor-contents
Preserve contacts popover editor contents when switching to search mode
2023-03-09 22:10:46 -05:00
Julia
01e3173ed0 Preserve contacts popover editor contents when switching to search mode 2023-03-09 22:05:32 -05:00
Nate Butler
8ee25be7b9 Update empty pane styling
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-03-09 20:18:29 -05:00
Mikayla Maki
0384456e7d Change context matcher to search the entire stack 2023-03-09 16:18:37 -08:00
Mikayla Maki
20064b5629 Add welcome to menu
remove debug
2023-03-09 15:38:28 -08:00
Mikayla Maki
daed75096e Fix editor test to clearly show trailing whitespace
Adjsut default dock size to be a multiple of 16
2023-03-09 13:18:03 -08:00
Mikayla Maki
718052bb72 Undo accidental indent change of hoverpopover.ts 2023-03-09 13:02:25 -08:00
Mikayla Maki
4eb75f058f Fix bug with wrong view ids being passed 2023-03-09 12:00:58 -08:00
Petros Amoiridis
6c68a3e709 Remove unneeded code 2023-03-09 20:02:40 +02:00
Nate Butler
e7af3f223a Merge pull request #2254 from zed-industries/nate/update-themes
WIP: More theme updates
2023-03-09 11:00:20 -05:00
Nate Butler
baff428de5 Re-add Ayu 2023-03-09 10:51:28 -05:00
Nate Butler
3952e98320 Remove Zed Pro theme 2023-03-09 10:50:11 -05:00
Nate Butler
51be0efa1f Format 2023-03-09 10:47:58 -05:00
Nate Butler
5bfd5e35b3 Add light themes 2023-03-09 10:47:01 -05:00
Petros Amoiridis
d53c18cc57 Open menu relative to the mouse cursor 2023-03-09 16:57:38 +02:00
Petros Amoiridis
5b7d0ee6fe Show button in a normal state 2023-03-09 16:54:47 +02:00
Petros Amoiridis
e2bdd261a1 Remove debugging statement 2023-03-09 16:53:34 +02:00
Mikayla Maki
9187863d0e re-add spaces removed by new setting 2023-03-09 00:45:05 -08:00
Antonio Scandurra
3daeabc1d6 collab 0.7.0 2023-03-09 09:30:04 +01:00
Antonio Scandurra
bebfe53e89 Merge pull request #2256 from zed-industries/liveness-probe
Introduce Kubernetes liveness probe to ensure database works
2023-03-09 09:26:21 +01:00
Antonio Scandurra
9328bb0153 Introduce Kubernetes liveness probe to ensure database works 2023-03-09 09:17:55 +01:00
Antonio Scandurra
89c283ecf0 Merge pull request #2252 from zed-industries/limit-messages-processed-in-parallel
Prevent collab server from being overwhelmed with messages
2023-03-09 08:51:48 +01:00
Antonio Scandurra
a00ce3f286 Add randomized test to remove active selections from buffer 2023-03-09 07:47:05 +01:00
Antonio Scandurra
4ce51c8138 Limit dirty buffer save optimization to multi-buffers 2023-03-09 07:26:22 +01:00
Mikayla Maki
f626920af1 Remove permanent Zed stateless 2023-03-08 19:03:50 -08:00
Mikayla Maki
325827699e Adjust styling for blank page experience 2023-03-08 19:02:13 -08:00
Julia
a3b1980a5e Merge pull request #2255 from zed-industries/sort-collaborators-alphabetical
Sort collaborators in titlebar alphabetically instead of by replica id
2023-03-08 21:54:29 -05:00
Mikayla Maki
709c101834 Adjust styles on usage note 2023-03-08 18:50:17 -08:00
Mikayla Maki
943ea61452 Add a note on how to check the telemetry 2023-03-08 18:47:52 -08:00
Julia
981b3a459f Sort collaborators in titlebar alphabetically instead of by replica id 2023-03-08 21:38:30 -05:00
Mikayla Maki
a65dd0fd98 Restore correct checkbox text 2023-03-08 18:15:29 -08:00
Mikayla Maki
cf6ea6d698 Fix bug with action keybindings not being resolved 2023-03-08 18:11:11 -08:00
Mikayla Maki
152755b043 Add blank pane experience 2023-03-08 17:56:39 -08:00
Mikayla Maki
dad66eb3fb Make the workspace always open the dock 2023-03-08 14:49:52 -08:00
Mikayla Maki
f62e0b502a Remove welcome experience action
Make logo switch between light and dark

co-authored-by: Nathan <nathan@zed.dev>
2023-03-08 14:49:48 -08:00
Nate Butler
344f59adf7 Tweak welcome design
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-03-08 17:14:15 -05:00
Nate Butler
cc33f83e4e Add Zed logo icon
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-03-08 16:45:35 -05:00
Nate Butler
9842b7ad1a WIP
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-03-08 16:34:27 -05:00
Max Brunsfeld
14497027d4 collab 0.6.2 2023-03-08 12:22:16 -08:00
Joseph Lyons
ae510c80db v0.77.x dev 2023-03-08 13:25:32 -05:00
Petros Amoiridis
ad7e49ed06 Give focus to the selected terminal
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2023-03-08 19:47:57 +02:00
Antonio Scandurra
b687aec9d9 Avoid saving buffer if it's neither dirty nor in conflict
However, keep emitting `Saved` events so that the language server
is notified and can perform tasks related to saving (e.g., running
`cargo check` in the case of rust-analyzer).
2023-03-08 17:04:01 +01:00
Antonio Scandurra
a435dc1339 Clear selections on buffer only if they hadn't been cleared already 2023-03-08 17:04:01 +01:00
Antonio Scandurra
b4561b848d Limit the number of parallel messages handled for any given connection 2023-03-08 17:04:01 +01:00
Petros Amoiridis
baa9e271d5 Make pop up open on the side of the button 2023-03-08 11:00:30 +02:00
Mikayla Maki
350ddf2025 Add keymap picker UI
Co-authored-by: Max <max@zed.dev>
2023-03-07 17:29:08 -08:00
Mikayla Maki
3594243644 Fix bug where open would offer to hang up a remote call
Co-authored-by: max <max@zed.dev>
2023-03-07 17:29:08 -08:00
Mikayla Maki
904993dfc9 Change open paths to replace the existing window if dispatched from a window
co-authored-by: Max <max@zed.dev>
2023-03-07 17:28:52 -08:00
Julia
4179ed66a6 Merge pull request #2251 from zed-industries/clear-follow-state-on-project-close
Update db followers table when user leaves a project
2023-03-07 19:09:09 -05:00
Julia
d173b1d412 Update db followers table when user leaves a project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-03-07 18:56:03 -05:00
Mikayla Maki
ab4b3293d1 Fix project panel button and style it
Co-authored-by: max <max@zed.dev>
2023-03-07 14:49:13 -08:00
Mikayla Maki
5892f16602 Add test for base keymap setting 2023-03-07 14:02:42 -08:00
Nate Butler
84aefb9dcb Add the rest of the Atelier dark themes 2023-03-07 13:47:18 -08:00
Nate Butler
4e81513af1 Add more Atelier themes 2023-03-07 13:35:32 -08:00
Nate Butler
90296667b0 Remove current staff themes 2023-03-07 13:35:23 -08:00
Nate Butler
e0f9b2b40f Update Atelier Dune 2023-03-07 13:27:01 -08:00
Nate Butler
477453c396 Update existing Atelier themes 2023-03-07 13:22:07 -08:00
Mikayla Maki
19fc143209 Add base keymap setting
Format all files

Co-Authored-by: Nathan <nathan@zed.dev>
2023-03-07 12:19:51 -08:00
Joseph Lyons
ca03d871a6 Add a separator between the New Terminal button and existing terminal buttons 2023-03-07 15:09:06 -05:00
Joseph Lyons
0a3f0c5252 Use terminal titles for buttons 2023-03-07 15:04:12 -05:00
Joseph Lyons
c80942ea00 Begin work to dynamically add terminal names to menu 2023-03-07 14:41:18 -05:00
Joseph Lyons
caa6a75238 Show a pop up menu for terminals
Co-Authored-By: Joseph T. Lyons <19867440+JosephTLyons@users.noreply.github.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-07 20:16:08 +02:00
Julia
4f4af55329 Merge pull request #2248 from zed-industries/increase-reconnect-timeout
Increase room reconnect timeout
2023-03-07 12:30:20 -05:00
Julia
1e5aff9e51 Update collab integration test to new reconnect timeout 2023-03-07 12:23:18 -05:00
Nate Butler
ee154feda4 Merge pull request #2231 from zed-industries/nate/add-gruvbox
Add Gruvbox Theme
2023-03-06 18:49:26 -08:00
Mikayla Maki
3b31f10c6f Made the theme picker sort from dark to light
Added a layer into 'ConstrainedBox' to clip it
's children

Made the welcome experience responsive to small and large sizes
2023-03-06 18:36:18 -08:00
Mikayla Maki
8db7e17ac5 Move install_cli function to a seperate crate
Add install cli button to welcome experience
Add toast pop ups for CLI installation status
2023-03-06 17:55:58 -08:00
Mikayla Maki
1f6bd0ea77 Fix edge case where the welcome page might open in the dock if the user's actions race the welcome experience action 2023-03-06 16:35:15 -08:00
Mikayla Maki
ba652fc033 Finish basic welcome experience 2023-03-06 16:28:23 -08:00
Max Brunsfeld
7163ba429b Merge pull request #2250 from zed-industries/syntax-highlighting-tweaks
Syntax highlighting tweaks
2023-03-06 16:05:10 -08:00
Max Brunsfeld
c832e4406e Remove more colors from default syntax theme
These default colors weren't consistent with the rest of the
syntax theme.
2023-03-06 15:57:04 -08:00
Max Brunsfeld
515724821e Make racket highlight query more consistent with other langs 2023-03-06 15:56:20 -08:00
Max Brunsfeld
0867162c87 Fix lua highlight query
* Fix regex predicate on constants.
* Remove 'function.call' highlight name. In other languages, we
differentiate calls from definitions with the 'function.definition'
highlight name. We actually don't use this in any themes though.
2023-03-06 15:54:17 -08:00
Max Brunsfeld
aba2914a31 Fix constant highlighting in JS, TypeScript
Previously, SCREAMING_SNAKE_CASE identifiers were highlighted as
types due to a mistake in the order of patterns in the highlight
queries.
2023-03-06 15:38:12 -08:00
Max Brunsfeld
246a6adab7 Merge pull request #2239 from zed-industries/add-constructor-to-syntax-overrides
Add constructor to syntax overrides
2023-03-06 15:27:09 -08:00
Mikayla Maki
020a0965b0 WIP 2023-03-06 14:26:32 -08:00
Mikayla Maki
b74553455f Add an element to pane to take care of wiring initial mouse handlers 2023-03-06 14:26:32 -08:00
Mikayla Maki
4a8527478d Add child item alignment to flex implementation
Fix checkbox styling

co-authored-by: Nathan <nathan@zed.dev>
2023-03-06 14:26:32 -08:00
Mikayla Maki
4c179875ab Add png image loading to gpui
add zed logo into welcome experience

Co-authored-by: Nathan <nathan@zed.dev>
2023-03-06 14:26:32 -08:00
Mikayla Maki
f89f33347d Added CTA buttons to welcome experience
Co-authored-by: Nathan <nathan@zed.dev>
2023-03-06 14:26:32 -08:00
Mikayla Maki
9dee2ca2be WIP 2023-03-06 14:26:32 -08:00
Mikayla Maki
62aeb6b8b3 Added background to welcome page 2023-03-06 14:26:32 -08:00
Mikayla Maki
5210be95fe Added welcome experience sketch
Made toolbar hideable
2023-03-06 14:26:32 -08:00
Mikayla Maki
7d7053b990 Move to using stateless 2023-03-06 14:26:31 -08:00
Mikayla Maki
118435a348 Added basic styling for checkboxes, yay
Co-authored-by: Max <max@zed.dev>
2023-03-06 14:25:10 -08:00
Mikayla Maki
86e2101592 Added the ability to nested values to the settings file, while preserving user formatting
co-authored-by: max <max@zed.dev>
2023-03-06 14:25:10 -08:00
Mikayla Maki
50586812ec Make generate licenses quieter 2023-03-06 14:25:10 -08:00
Mikayla Maki
416c793076 Start on welcome experience settings 2023-03-06 14:25:10 -08:00
Mikayla Maki
a0637a769c WIP 2023-03-06 14:25:10 -08:00
Mikayla Maki
9401ef223d Add welcome crate and associated types 2023-03-06 14:25:10 -08:00
Julia
620890c411 Merge pull request #2247 from zed-industries/tidy-up-sprite-cache
Tidy up `SpriteCache::render_glyph`
2023-03-06 11:29:51 -05:00
Antonio Scandurra
0ec984f924 Tidy up SpriteCache::render_glyph 2023-03-06 17:08:35 +01:00
Max Brunsfeld
01bbf20962 Merge pull request #2235 from zed-industries/no-panic-uploads-in-debug
Don't upload panic files when running in a PTY
2023-03-04 09:42:46 -08:00
Mikayla Maki
996294ba67 Merge pull request #2246 from zed-industries/fix-lsp-derive-error
Make diagnostic processing order independent
2023-03-04 02:25:47 -08:00
Mikayla Maki
ddf2f2cb0a Update test to use new group ids and new ordering of diagnostics. 2023-03-04 02:21:55 -08:00
Mikayla Maki
bd4d7551a5 Make diagnostic processing order independent
Co-authored-by: max <max@zed.dev>
2023-03-03 16:35:12 -08:00
Julia
5097cf5cb7 Merge pull request #2245 from zed-industries/confirm-restart-unsaved
Confirm restart if prompt-quit is enabled or there are unsaved changes
2023-03-03 16:10:40 -08:00
Julia
13212d274e Confirm restart if prompt-quit is enabled or there are unsaved changes 2023-03-03 16:06:03 -08:00
Julia
b9110c9268 Increase reconnect timeout
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-03 13:10:08 -08:00
Joseph T. Lyons
b9573872e1 Merge pull request #2243 from zed-industries/joseph/z-225-track-open-terminals
Keep track of open terminals
2023-03-03 12:55:28 -08:00
Joseph Lyons
3ec71a742d Keep track of open terminals
Co-Authored-By: Petros Amoiridis <petros@hey.com>
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-03-03 12:50:08 -08:00
Mikayla Maki
50682dc685 Merge pull request #2233 from zed-industries/fix-code-folding-initialization
Initialize code fold indicators on buffer startup
2023-03-03 12:30:53 -08:00
Julia
2bca64f13b Merge pull request #2242 from zed-industries/mouse-event-handlers-yes
Fix surprising mouse propagation & avoid focusing tab while closing
2023-03-03 12:29:50 -08:00
Mikayla Maki
606d683f29 Add interactable fold markers
Change fold handlers to be driven by the fold map
Switch to a mouse region based implementation for click regions

Co-authored-by: Max <max@zed.dev>
2023-03-03 12:26:36 -08:00
Julia
ff2e6bc3bd Fix surprising mouse propagation & avoid focusing tab while closing
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-03 12:22:58 -08:00
Joseph T. Lyons
218f2fd0fe Merge pull request #2241 from zed-industries/joseph/z-223-add-terminal-button-to-status-bar
Add a terminal button to status bar
2023-03-03 12:15:59 -08:00
Max Brunsfeld
bb0257bbac Merge branch 'main' into no-panic-uploads-in-debug 2023-03-03 12:02:44 -08:00
Joseph Lyons
929ebd7175 Add a terminal button to status bar
Co-Authored-By: Petros Amoiridis <petros@hey.com>
2023-03-03 12:00:41 -08:00
Max Brunsfeld
124aa74b03 Merge pull request #2234 from zed-industries/error-on-combined-injections-in-injections
Fix range relativization when combined injections occur inside of other injections
2023-03-03 11:58:13 -08:00
Petros Amoiridis
a2f75eb031 Merge pull request #2240 from zed-industries/petros/update-setup-instructions
Add missing steps to the setup instructions
2023-03-03 11:47:38 -08:00
Petros Amoiridis
6194c5df16 Add missing steps to the setup instructions 2023-03-03 11:36:26 -08:00
Max Brunsfeld
d14b684237 Merge pull request #2236 from zed-industries/avoid-clobbering-panic-file
Avoid clobbering panic files when they happen at the same time
2023-03-03 11:15:48 -08:00
Max Brunsfeld
7a8cba0544 Merge pull request #2227 from zed-industries/strip-trailing-whitespace
Add settings to normalize whitespace on save
2023-03-03 11:15:32 -08:00
Nate Butler
f1b5bf051a Fornat 2023-03-03 10:58:43 -08:00
Nate Butler
ad4201f768 Hack to fix syntax.constructor causing TS error 2023-03-03 10:58:25 -08:00
Nate Butler
75a9cfdabe Remove leftover log 2023-03-03 10:22:50 -08:00
Julia
3b6f66791f Merge pull request #2238 from zed-industries/subpixel-variant-incorrectly-wrapping
Avoid wrapping to the 0th glyph variant when the 4th should be used
2023-03-03 13:13:34 -05:00
Julia
9311e01271 Avoid wrapping to the 0th glyph variant when the 4th should be used
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-03 10:04:44 -08:00
Nate Butler
6d068e926b Merge pull request #2237 from zed-industries/revert-2232-tab-bar-background-focus-drag
Revert "Avoid tab bar background activating an item at the end of a tab drag"
2023-03-03 09:49:55 -08:00
Nate Butler
6854063d0b Revert "Avoid tab bar background activating an item at the end of a tab drag" 2023-03-03 09:47:58 -08:00
Mikayla Maki
7ca0b38048 Made fold inline styles be driven by the fold map
co-authored-by: Max <max@zed.dev>
2023-03-03 09:32:58 -08:00
Max Brunsfeld
a598f0b13c Avoid clobbering panic files when they happen at the same time
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-02 20:51:29 -08:00
Max Brunsfeld
eb6088701e Don't upload panic files when running in a PTY 2023-03-02 20:32:49 -08:00
Mikayla Maki
24ba47e75d Merge pull request #2230 from zed-industries/fix-tab-x
Fix tab bar x
2023-03-02 19:48:08 -08:00
Mikayla Maki
3dd5b3f426 Attempted to initialize code-fold indicators, does not work 2023-03-02 19:42:59 -08:00
Mikayla Maki
9f86ca8574 Update tabBar.ts 2023-03-02 15:48:31 -08:00
Julia
bc2ea58c6a Merge pull request #2232 from zed-industries/tab-bar-background-focus-drag
Avoid tab bar background activating an item at the end of a tab drag
2023-03-02 16:18:04 -05:00
Julia
b343e8056a Avoid tab bar background activating an item at the end of a tab drag 2023-03-02 13:06:58 -08:00
Mikayla Maki
6a2a1303c4 Fix failing license
co-authored-by: nate <nate@zed.dev>
2023-03-02 12:32:47 -08:00
Max Brunsfeld
a366ba19af Fix range relativization when combined injections occur inside of other injections
For example, ERB template inside of a markdown code block

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-01 14:38:35 -08:00
Max Brunsfeld
70cb2fa8d7 Apply external command formatting if buffer has changed while computing it 2023-03-01 10:17:04 -08:00
Nate Butler
f67c3f1f1d Add Gruvbox syntax overrides 2023-03-01 11:49:13 -05:00
Nate Butler
bde0456111 Init gruvbox theme 2023-03-01 10:16:45 -05:00
Mikayla Maki
8734bd8435 Seperate out x-mark width 2023-03-01 00:18:45 -08:00
Mikayla Maki
34fbffb4cc Fix tab bar x 2023-02-28 22:48:31 -08:00
Max Brunsfeld
368d2a73ea Perform whitespace formatting regardless of whether buffer has a language server or path 2023-02-28 21:52:00 -08:00
Max Brunsfeld
e7b56f6342 adjust buffer-formatting assertion to reflect final newline addition 2023-02-28 21:52:00 -08:00
Max Brunsfeld
1deff43639 Avoid calling edits_since in apply_diff 2023-02-28 21:52:00 -08:00
Max Brunsfeld
a890b8f3b7 Add a setting for ensuring a single final newline on save 2023-02-28 21:52:00 -08:00
Max Brunsfeld
7faa0da5c7 Avoid finalizing transactions inside Buffer::apply_diff 2023-02-28 21:52:00 -08:00
Max Brunsfeld
ff85bc6d42 Add setting for removing trailing whitespace on save 2023-02-28 21:52:00 -08:00
Max Brunsfeld
b00e467ede Add APIs for stripping trailing whitespace from a buffer 2023-02-28 21:52:00 -08:00
Mikayla Maki
2e1adb0724 Merge pull request #2229 from zed-industries/fix-click-range-bug
Fix off by one error in click ranges
2023-02-28 20:33:00 -08:00
Mikayla Maki
269df10a16 Fix off by one error in click ranges 2023-02-28 20:27:34 -08:00
Mikayla Maki
8358efbd6c Merge pull request #2228 from zed-industries/make-folds-show-on-active-lines
Made code fold indicators show up on active line indicators
2023-02-28 20:01:09 -08:00
Mikayla Maki
dc11d2726e Made code fold indicators show up on active line indicators 2023-02-28 19:53:53 -08:00
Mikayla Maki
41d3c5287b Merge pull request #2220 from zed-industries/add-fold-indicators
Add code folding indicators into the gutter.
2023-02-28 17:30:17 -08:00
Mikayla Maki
2198c295b3 Fix comments 2023-02-28 17:25:35 -08:00
Mikayla Maki
6cf62a5b02 Update tests to use new fold indicator 2023-02-28 17:17:29 -08:00
Mikayla Maki
f8401394f5 Removed DisplayRow abstraction 2023-02-28 17:12:48 -08:00
Mikayla Maki
b53d1eef71 Added background styling of the ... 2023-02-28 16:35:44 -08:00
Mikayla Maki
c397fd9a71 Added click regions and cursor styles 2023-02-28 16:34:28 -08:00
Mikayla Maki
9b8adecf05 Adjusted code-folding behavior 2023-02-28 16:34:28 -08:00
Mikayla Maki
e0f553c0f5 WIp 2023-02-28 16:34:28 -08:00
Mikayla Maki
37a2ef9d41 Make chevrons and lightning bolt interactive 2023-02-28 16:34:28 -08:00
Mikayla Maki
89b93d4f6f Added fold changes on gutter hover 2023-02-28 16:34:28 -08:00
Mikayla Maki
2036fc48b5 moved code action indicator to the left 2023-02-28 16:34:28 -08:00
Mikayla Maki
cb3e873a67 Fixed autoscroll timing 2023-02-28 16:34:28 -08:00
Mikayla Maki
da78abd99f Added DisplayRow abstraction to make folding code more readable 2023-02-28 16:34:28 -08:00
Mikayla Maki
637e8ada42 Fix bugs in code folding 2023-02-28 16:34:28 -08:00
Mikayla Maki
e3061066c9 Add code folding indicators into the gutter. 2023-02-28 16:34:28 -08:00
Nate Butler
514da604d7 Merge pull request #2223 from zed-industries/nate/extend-syntax
Extend syntax styles available in the theme
2023-02-28 11:26:47 -05:00
Nate Butler
b9811e48e4 One family tune up + tidy 2023-02-28 11:20:16 -05:00
Nate Butler
fb69611568 Fix order of template_substitution in highlights.scm 2023-02-28 11:19:55 -05:00
Nate Butler
a8a045e8bf Merge branch 'main' into nate/extend-syntax 2023-02-28 11:07:35 -05:00
Nate Butler
59bd503696 Tidy theme names 2023-02-28 10:55:08 -05:00
Nate Butler
fb7818f93c Revert changes to Andromeda 2023-02-28 10:50:03 -05:00
Joseph T. Lyons
3fb426e8b2 Merge pull request #2209 from zed-industries/add-link-to-community-repo-in-feedback-editor
Add link to community repo in feedback editor text
2023-02-28 09:03:21 -05:00
Kay Simmons
f0a31f86c7 remove commented line 2023-02-27 12:06:10 -08:00
Kay Simmons
dc7fe72f18 Merge pull request #2226 from zed-industries/fix-infinite-loop-in-path-distance
fix infinite loop in path distance for fuzzy finder
2023-02-27 12:03:40 -08:00
Kay Simmons
b3dffeaf2a fix infinite loop in path distance for fuzzy finder 2023-02-27 11:57:21 -08:00
Kay Simmons
81cbefec22 Merge pull request #2225 from zed-industries/vim-go-to-definition
add go to definition binding to vim normal mode
2023-02-27 11:10:23 -08:00
Joseph Lyons
4f9a07cffc Merge branch 'main' into add-link-to-community-repo-in-feedback-editor 2023-02-27 13:56:01 -05:00
Kay Simmons
184f37015a add go to definition binding to vim normal mode 2023-02-27 10:23:30 -08:00
Nate Butler
c9997a81a3 Move syntax types to syntax.ts 2023-02-27 11:01:32 -05:00
Nate Butler
df798c1a7f Remove punctuation.special until bug is fixed 2023-02-27 10:52:53 -05:00
Nate Butler
465fcec36d Format 2023-02-27 10:48:55 -05:00
Nate Butler
40c2409b80 Add missing variable property to Syntax 2023-02-27 10:47:52 -05:00
Nate Butler
46dc347a1a Bring andromeda in line with it's correct colors 2023-02-27 10:47:30 -05:00
Nate Butler
f84046b74f use @boolean in all flavors of js 2023-02-27 10:40:01 -05:00
Nate Butler
8c51a62a8d Unify regex highlight style under @string.regex 2023-02-27 10:08:24 -05:00
Nate Butler
794e6e22a6 Format 2023-02-26 17:12:48 -05:00
Nate Butler
504d88d56c Remove unused code 2023-02-26 17:12:11 -05:00
Nate Butler
94c76c45e6 Style One Dark with new properties 2023-02-26 17:11:02 -05:00
Nate Butler
f2d6a03dff Finish adding default properties 2023-02-26 17:10:52 -05:00
Nate Butler
3b19a409f8 Add some comments 2023-02-26 15:01:18 -05:00
Nate Butler
7854f4a1ef WIP need to finish default styles 2023-02-26 14:57:43 -05:00
Nate Butler
6cb35536b3 Start on syntax organization 2023-02-26 14:15:06 -05:00
Nate Butler
161373710c WIP 2023-02-26 13:24:41 -05:00
Joseph T. Lyons
11e2caff15 Merge pull request #2222 from zed-industries/update-app-icons
Update app icons
2023-02-26 11:07:07 -05:00
Joseph Lyons
36ada13966 Update app-icon@2x.png 2023-02-26 11:03:43 -05:00
Joseph Lyons
2c61eeb56d Update app-icon.png 2023-02-26 11:03:31 -05:00
Joseph Lyons
ccae9448d4 Update app-icon-preview@2x.png 2023-02-26 11:03:22 -05:00
Joseph Lyons
bb46b26494 Update app-icon-preview.png 2023-02-26 11:03:03 -05:00
Nate Butler
098e6969f7 Merge pull request #2221 from zed-industries/theme-syntax-overrides
Theme syntax overrides 🎉
2023-02-26 10:56:45 -05:00
Nate Butler
d910eed1f1 Format 2023-02-26 10:31:19 -05:00
Nate Butler
64b07dbfeb Add syntax overrides for One Light 2023-02-26 10:09:16 -05:00
Nate Butler
4f307c7601 Use syntax as merged name instead of mergedSyntax
This lets us retain the existing uses of syntax, and fixes colors that were being assigned incorrectly.
2023-02-26 01:20:44 -05:00
Nate Butler
23c967418a Add a syntax override style for One Dark 2023-02-26 01:07:45 -05:00
Nate Butler
77ed437cda Add the ability to override the system syntax config 2023-02-26 01:07:21 -05:00
Kay Simmons
0b1334b8c5 Merge pull request #2218 from zed-industries/file-finder-distance-sorting
Sort matches in file finder by distance to active item after score
2023-02-25 14:26:05 -08:00
Kay Simmons
cdc6566d87 fixup poor utility naming 2023-02-25 14:12:25 -08:00
Kay Simmons
36f3d3d738 Add test for new sorting behavior 2023-02-25 14:06:54 -08:00
Nate Butler
27712c25ef Merge pull request #2219 from zed-industries/nate/theme-tidying
Tidy `styles` app
2023-02-25 12:07:02 -05:00
Nate Butler
68af726ee4 Update packages
Tested post update.
2023-02-25 11:53:01 -05:00
Nate Butler
0ea7959ba4 Remove unused/old base16 theme code
Neither of these files have anything in them that is used anywhere else in the styles app.

Tested both `build` and `build-licenses` after removing these.
2023-02-25 11:50:22 -05:00
Nate Butler
bcb7b80517 Don't format package or package-lock 2023-02-25 11:47:27 -05:00
Nate Butler
10a30cf330 Format styles with updated prettier config
In the system color PR I updated the prettier config to match what we use on zed.dev. I didn't want to format all of styles as it would add a lot of unrelated line changes to that PR.

Doing that format now.
2023-02-25 11:46:33 -05:00
Nate Butler
06a86162bb Merge pull request #2150 from zed-industries/nate/system-colors
Add system color palette
2023-02-25 11:43:02 -05:00
Nate Butler
b986c38a31 Format using new prettier config 2023-02-25 11:33:57 -05:00
Nate Butler
69fd273367 Add the same prettier config as zed.dev 2023-02-25 11:33:16 -05:00
Nate Butler
8e828947fb Add missing dep 2023-02-25 11:32:04 -05:00
Nate Butler
2d8adf4c56 Remove theme tool for now
This is likely the biggest thing I'm unsure about for this PR, so I'm going to pull it into a seperate branch so I can merge the system color library in.

I think a better approach for this will be one of two things:
- Have a single next app that covers everything to do with themes (previewing ramps, generated themes, components etc.)
- Create a mono or turborepo that splits things up into packages (system, theme, themes, theme-tool, etc)
2023-02-25 11:27:18 -05:00
Kay Simmons
0b48e238f2 Sort file finder matches by distance to the active item after match score 2023-02-24 18:13:26 -08:00
Max Brunsfeld
04495aa8cd Merge pull request #2217 from zed-industries/format-on-save-trigger
Pass the 'Save' format trigger when formatting on save
2023-02-24 17:29:52 -08:00
Max Brunsfeld
5fea49e639 Pass the 'Save' format trigger when formatting on save
In an earlier refactor, I accidentally caused the 'Manual'
trigger to *always* be passed.

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2023-02-24 17:11:35 -08:00
Mikayla Maki
0704d9dcdb Merge pull request #2216 from zed-industries/update-bromberg
Update bromberg dependency to have alloc
2023-02-24 14:41:32 -08:00
Mikayla Maki
a57fcf5afc Update bromberg dependency to have alloc 2023-02-24 14:34:24 -08:00
Max Brunsfeld
e910fd8493 collab 0.6.1 2023-02-24 09:44:23 -08:00
Mikayla Maki
d5123bc832 Merge pull request #2215 from zed-industries/revert-2214-fix-reveal-path-panic
Revert "Remove borrow from reveal_path()"
2023-02-24 09:40:03 -08:00
Mikayla Maki
8656708de4 Revert "Remove borrow from reveal_path()" 2023-02-24 09:39:52 -08:00
Joseph Lyons
72197802a2 Tweak code to remove duplication 2023-02-24 08:53:58 -05:00
Joseph Lyons
f8f1a3f86e Unify text style names 2023-02-24 08:46:28 -05:00
Mikayla Maki
2ec25bef84 Merge pull request #2214 from zed-industries/fix-reveal-path-panic
Remove borrow from reveal_path()
2023-02-23 21:48:09 -08:00
Mikayla Maki
89ddf14b0e Remove borrow from reveal_path() 2023-02-23 21:36:17 -08:00
Julia
be86cb35ba Merge pull request #2213 from zed-industries/per-project-follow-status
Differentiate between follow state on a per-project basis
2023-02-24 00:26:41 -05:00
Julia
465d8cc2ff Differentiate between follow state on a per-project basis 2023-02-24 00:07:17 -05:00
Max Brunsfeld
93b9e762ec Merge pull request #2212 from zed-industries/initial-traffic-light-position
Adjust window's traffic light position when setting its title
2023-02-23 15:02:05 -08:00
Max Brunsfeld
fbc934b884 Adjust window's traffic light position when setting its title 2023-02-23 14:44:45 -08:00
Mikayla Maki
350b7b82f7 Merge pull request #2207 from zed-industries/project-panel-actions
Fix project panel actions
2023-02-23 14:31:29 -08:00
Mikayla Maki
b179fc2b99 Remove comment 2023-02-23 14:24:53 -08:00
Mikayla Maki
8860346324 Fix broken dock command 2023-02-23 14:15:29 -08:00
Mikayla Maki
9004640586 Convert keymap context to use generics and Cow<'static> so we don't have to add .to_string() and .into() for each usage 2023-02-23 14:10:55 -08:00
Kay Simmons
03498314fa Merge pull request #2211 from zed-industries/hover-binding
add hover binding from vscode
2023-02-23 14:05:28 -08:00
Kay Simmons
ce4b672a14 add hover binding from vscode 2023-02-23 13:50:43 -08:00
Kay Simmons
3f9405f8f1 Merge pull request #2210 from zed-industries/fix-enter-vim-normal-mode
Fix enter in normal mode acting incorrectly
2023-02-23 13:46:15 -08:00
Kay Simmons
2276d25bdf Fix enter in normal mode acting incorrectly 2023-02-23 13:40:31 -08:00
Mikayla Maki
ffe53bed87 Reverts keymap precedence order change 2023-02-23 13:32:45 -08:00
Joseph Lyons
37f910949d Add link to community repo in feedback editor 2023-02-23 16:30:00 -05:00
Julia
1e3b4f0387 Merge pull request #2208 from zed-industries/new-collab-ui-3
Add same grayscale logic to followers which leaders have; new call UI [3/N]
2023-02-23 16:05:42 -05:00
Julia
e1df85e86d Add same grayscale logic to followers which leaders have 2023-02-23 15:59:37 -05:00
Mikayla Maki
f6601f64e5 Added editor-in-project-panel overrides to the default keymap 2023-02-23 09:36:30 -08:00
Antonio Scandurra
6ccc90327c Merge pull request #2206 from zed-industries/fix-refresh-room
Fix error when deleting rooms containing projects on refresh
2023-02-23 16:03:14 +01:00
Antonio Scandurra
bbeb33bc7e Fix error when deleting rooms containing projects on refresh
A foreign key violation was causing the server to never delete stale
rooms during `Database::refresh_room` due to having one or more project
records referencing the room.
2023-02-23 15:54:35 +01:00
Antonio Scandurra
e74db2d180 Merge pull request #2205 from zed-industries/call-ui-follow-up
Refine new call UI
2023-02-23 15:39:59 +01:00
Antonio Scandurra
74e0bed38f Fix compilation errors after restructuring room_transaction 2023-02-23 15:17:22 +01:00
Antonio Scandurra
832549f1a3 Merge branch 'main' into call-ui-follow-up 2023-02-23 15:15:46 +01:00
Antonio Scandurra
b965333325 Show avatar in user menu 2023-02-23 15:09:32 +01:00
Joseph T. Lyons
2be0283bf2 Merge pull request #2204 from zed-industries/fix-description-of-telemetry-setting
Fix description of telemetry setting
2023-02-23 08:59:30 -05:00
Antonio Scandurra
59a66190e5 Avoid trying to reconnect to a room if client is signed out 2023-02-23 14:53:10 +01:00
Antonio Scandurra
9334267bd0 Tear down peer when signing out 2023-02-23 14:47:02 +01:00
Antonio Scandurra
a0daf47134 Don't panic when rendering collab titlebar item while signed out 2023-02-23 14:46:02 +01:00
Petros Amoiridis
9a729a2e64 Merge pull request #2202 from zed-industries/petros/z-86-replace-terminal-tab-title-with-an-icon
Replace terminal tab title with an icon
2023-02-23 11:04:43 +02:00
Antonio Scandurra
1c636500de Merge pull request #2200 from zed-industries/fix-slow-project-join
Hold room lock through the entirety of a `room_transaction`
2023-02-23 09:11:58 +01:00
Max Brunsfeld
65a9ac449f Remove leave button from the title bar 2023-02-22 23:30:32 -08:00
Max Brunsfeld
bf5c3d963a Rearrange collab titlebar items to avoid movement of the toggle contacts button
* Replace username in titelbar with a `...` user menu that shows
  the current user name and contains a sign-in/sign-out button.
* Move the '+' (toggle contacts) button back to the right side.
* Move the collaborators back to the right side.
* Move the share/unshare button to the left side, beside the project title
* Only show the share/unshare button when in a call.
2023-02-22 22:56:11 -08:00
Joseph Lyons
c33d0f940a Fix description of telemetry setting 2023-02-22 23:50:20 -05:00
Max Brunsfeld
24e0a027ee Run check-formatting CI job on a mac mini 2023-02-22 15:35:05 -08:00
Max Brunsfeld
d49e35f947 Merge pull request #2203 from zed-industries/collab-ui-fixes
Fix minor issues with new collab UI
2023-02-22 14:22:05 -08:00
Max Brunsfeld
40aee8d7bc Add missing tooltip for contacts menu button
Co-authored-by: Joseph Lyons <joseph@zed.dev>
2023-02-22 14:18:17 -08:00
Max Brunsfeld
d33d27faa4 Fix ToggleContactsMenu action name in keymap
Co-authored-by: Joseph Lyons <joseph@zed.dev>
2023-02-22 14:17:59 -08:00
Max Brunsfeld
46ead28971 Bump RPC protocol version number 2023-02-22 13:40:14 -08:00
Max Brunsfeld
111aff29cc collab 0.6.0 2023-02-22 12:35:15 -08:00
Max Brunsfeld
e2a2e40599 v0.76.x dev 2023-02-22 12:34:29 -08:00
Max Brunsfeld
b73423daaa Merge pull request #2114 from zed-industries/new-collaboration-ui
New collaboration UI part 1/N
2023-02-22 12:32:41 -08:00
Julia
0324ca3b08 Be more specific about clearing (leader, follower) row
Previously anyone unfollowing someone would clear all other rows for
other followers leading to an incorrect state, fix and test

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 15:29:20 -05:00
Julia
36040cd0e1 Add top level leave call button
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 14:44:23 -05:00
Julia
a07867d628 Fiddle with titlebar item spacing
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 14:13:29 -05:00
Julia
812145f9ab Only show in-call share/unshare button if own project
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 13:40:43 -05:00
Julia
dbe5b0205c Add style leader selection container
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 13:36:06 -05:00
Petros Amoiridis
3d6c81584f Add an icon to the terminal view tab
The terminal icon already existed in `assets/icons`

Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-02-22 20:30:44 +02:00
Petros Amoiridis
81ece4fd44 Deduplicate tab theme related code
We've noticed that the search theme struct had two fields for a tab icon width and spacing. But we already have those in the tab theme struct. We decided to remove the duplicate and reuse the tab fields.

We also wanted to move where the spacing is being used. Instead of doing it at the left of the label, we do it at the right of the icon to match how it is done in other areas of the UI.

Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-02-22 20:28:57 +02:00
Petros Amoiridis
2ec5c88f98 Make icon width match other areas
This was 8 but we've seen areas where this was 14, like the project search tab icon. We want to match this.

Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-02-22 20:25:39 +02:00
Mikayla Maki
7b559176f1 Merge pull request #2201 from zed-industries/save-shortcuts
Add OS UI Keybindings
2023-02-22 09:16:19 -08:00
Mikayla Maki
d7305077bf Merge pull request #2198 from zed-industries/more-item-defaults
Add more default impls to the item trait
2023-02-22 09:14:12 -08:00
Mikayla Maki
4798b72cb8 Fixed keyboard shortcuts in mac os native panels
co-authored-by: Antonio <antonio@zed.dev>
2023-02-22 09:10:16 -08:00
Mikayla Maki
71d8ead318 Introduce an OSAction that can be associated with menu items for mac platform compatibility.
Co-authored-by: Antonio <antonio@zed.dev>
2023-02-22 09:02:31 -08:00
Julia
9b92a8e3fe Add mockup accurate avatar background
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 11:34:55 -05:00
Julia
7f4da80386 Initial dedicated face pile element
Rather than overload Flex with yet another special case, add a dedicated
element to handle this overlap instead

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 11:34:55 -05:00
Julia
6a731233c5 Remove Flex::with_reversed_pain_order 2023-02-22 11:34:55 -05:00
Max Brunsfeld
b7cf426908 Start work on styling of follower avatars in facepiles
* Make follower avatars smaller than top-level avatars
* Make avatars in facepiles overlap
* Render an opaque background behind avatars in facepiles.
2023-02-22 11:34:55 -05:00
Max Brunsfeld
0dc92bec5c Retrieve room id from the project when following/unfollowing
Previously, we were accidentally using the project id as the room id.
2023-02-22 11:34:55 -05:00
Julia
c75aca25b6 Remove left side collaborator list
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 11:34:55 -05:00
Julia
ae87961a77 Close contacts popover when call ends
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-02-22 11:34:55 -05:00
Julia
e9464815e0 Make tooltip lie less 2023-02-22 11:34:55 -05:00
Julia
1ed47663ef Avoid moving contacts popover during call start & add button style state
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-02-22 11:34:55 -05:00
Julia
dd02bc7748 Initial adding of contact menu to call-less share button 2023-02-22 11:22:37 -05:00
Julia
e403b868b7 Add followers table to sqlite scheme for tests
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-02-22 11:22:37 -05:00
Julia
3105ecd0bd Shuffle share/unshare button back to the right side 2023-02-22 11:22:37 -05:00
Julia
05e9615507 Highlight face pile which local user is following 2023-02-22 11:22:37 -05:00
Julia
1abb7794cb Handle case where follower is local user 2023-02-22 11:22:37 -05:00
Julia
50e681bbb1 Add username to right side 2023-02-22 11:22:37 -05:00
Julia
3fb8395085 Make things a bit more infallible 2023-02-22 11:22:37 -05:00
Julia
4513c40993 Following face piles finally take their first breath 2023-02-22 11:21:23 -05:00
Julia
4ffc8cd9fd Fix deadlock in db get_room
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-22 11:21:23 -05:00
Julia
33c265d3cf Abuse a closure instead of abusing options/iterators quite so much 2023-02-22 11:21:23 -05:00
Julia
58c41778e7 Absolute pain of the iterator kind (start laying out a user's followers) 2023-02-22 11:21:23 -05:00
Julia
2592ec7265 Initial tracking of unfollows on collab server 2023-02-22 11:21:23 -05:00
Julia
d6462c611c Begin tracking follow states on collab server
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-02-22 11:21:23 -05:00
Julia
28786a3c18 Add Flex with_reversed_paint_order & initially move face piles to left
Co-Authored-By: Petros Amoiridis <petros@zed.dev>
2023-02-22 11:21:23 -05:00
Julia
a5fd0250ab Start fleshing out layout of collaborator list entries
Co-Authored-By: Petros Amoiridis <petros@zed.dev>
2023-02-22 11:21:23 -05:00
Julia
f68eda97fb Tell project when it has been unshared
Co-Authored-By: Petros Amoiridis <petros@zed.dev>
2023-02-22 11:21:23 -05:00
Julia
99236f1875 Add collaborators to collaborator list, including self user 2023-02-22 11:21:23 -05:00
Julia
bf8658067f Add collaborator count to collaborator list button 2023-02-22 11:21:23 -05:00
Julia
c697c1a96a Switch collaborator list to using own style 2023-02-22 11:21:23 -05:00
Julia
2b6aa3f5d1 Begin adding collaborator list popover
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-02-22 11:21:23 -05:00
Julia
e96d52f35a Move share button and support unsharing 2023-02-22 11:21:23 -05:00
Julia
ed2f1ddd2d Move workspace title into collaboration titlebar item render 2023-02-22 11:21:11 -05:00
Antonio Scandurra
8dd249a7cd Hold room lock through the entirety of a room_transaction
Previously, when the host repeatedly sent `UpdateWorktree` messages,
new guests attempting to join a project would observe a severe slowdown
caused by a database serialization error (e.g., the coherence of the data
would get violated midway through `Database::join_project` due to worktree
entries being mutated as the user joined). Writing entries is pretty fast,
whereas reading all of them for a project can take more than 100ms.
Transactions that failed due to a serialization error are retried, but the guest
would keep retrying until the host finished writing because the guest's read
was slow.

This commit changes the semantics of `room_transaction` to acquire a room
lock before even starting the transaction and holding it all the way after
commit (storing it, as before, in the `RoomGuard`). This ensures that a fast
writer (the host) can't starve a slow reader (the guest), allowing the latter
to make progress by temporarily pausing writes by the former.
2023-02-22 16:04:29 +01:00
Kay Simmons
24fcad3fa2 Merge pull request #2189 from zed-industries/labeled-tasks
Labeled Tasks
2023-02-21 21:31:47 -08:00
Kay Simmons
46af9a90ce fix test warning 2023-02-21 21:13:03 -08:00
Kay Simmons
1c69e289b7 Fix formatting 2023-02-21 21:07:45 -08:00
Mikayla Maki
9d782be4c8 Remove now-default stubs 2023-02-21 17:51:49 -08:00
Mikayla Maki
cae9e733a1 Add more default impls to the item trait
Change pane to not split if the underlying item cannot be cloned
2023-02-21 17:29:39 -08:00
Mikayla Maki
77c396a0ab Merge pull request #2197 from zed-industries/label-text-cow
Changed label and text to be generic over static and owned strings
2023-02-21 17:05:57 -08:00
Mikayla Maki
b500ed3171 Changed label and text to be generic over static strings and owned strings 2023-02-21 16:47:29 -08:00
Kay Simmons
6b6e4e3bfe Add basic test for labeled tasks 2023-02-21 16:14:22 -08:00
Joseph T. Lyons
1683a54698 Merge pull request #2195 from zed-industries/add-reveal-in-finder-to-additional-locations 2023-02-21 18:48:16 -05:00
Mikayla Maki
14488619a3 Merge pull request #2196 from zed-industries/open_urls
Fix open URLs, restarts, and make bundling easier to use
2023-02-21 15:36:50 -08:00
Mikayla Maki
cf4e719484 Fixes a race condition in the restart implementation
Fixes open_urls racing workspace initialization and causing a double-open (community#927)
Adds a -d flag to the bundle script to compile in debug mode

Co-Authored-by: Max <max@zed.dev>
2023-02-21 15:28:16 -08:00
Joseph Lyons
8c3232bb9b Add reveal in finder to additional locations
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-02-21 16:09:11 -05:00
Joseph Lyons
ebf1da1de8 Remove print macros 2023-02-21 10:46:12 -05:00
Kay Simmons
3564e95f27 Add labeled tasks to gpui and observe them in the activity status to give feedback when we are still waiting for the language server 2023-02-20 20:28:48 -08:00
Max Brunsfeld
ecf77a510a Merge pull request #2194 from zed-industries/window-position-env-vars
Fix handling of ZED_WINDOW_{SIZE,POSITION} env vars
2023-02-20 15:29:51 -08:00
Max Brunsfeld
927f7b3363 Fix handling of ZED_WINDOW_{SIZE,POSITION} env vars
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-02-20 15:11:20 -08:00
Max Brunsfeld
07bb42898f Merge pull request #2193 from zed-industries/autoclose-fixes
Restructure scope-specific auto-close pairs, fix regression in skipping over auto-closed brackets
2023-02-20 13:51:29 -08:00
Max Brunsfeld
a11165ad0a Add unit test for auto-closing quotation marks with overrides 2023-02-20 13:46:17 -08:00
Max Brunsfeld
ab82e13167 Run cargo fmt 2023-02-20 11:10:30 -08:00
Julia
0e0170712e Merge pull request #2192 from zed-industries/format-ci-enforcement
Enforce rustfmt on CI & clean up some let-else format errors
2023-02-20 13:55:34 -05:00
Max Brunsfeld
8be844a13f Add test that loads all bundled languages 2023-02-20 10:53:37 -08:00
Max Brunsfeld
7c98395e77 Add missing comment pattern to TSX overrides query 2023-02-20 10:53:37 -08:00
Max Brunsfeld
8922156923 Restructure how bracket pairs are overridden to unify lists
This way, a bracket pair that is disabled in a given scope can still be skipped, if
it was auto-closed before that scope existed.
2023-02-20 10:53:37 -08:00
Max Brunsfeld
51cea1b1fb Merge branch 'main' into randomized-tests-operation-script 2023-02-20 10:39:00 -08:00
Julia
bda37ffb9c Enforce rustfmt on CI & clean up some let-else format errors 2023-02-20 13:27:35 -05:00
Max Brunsfeld
2982a98d1c Merge pull request #2187 from zed-industries/save-untitled-buffer-bugs
Fix newly-discovered bugs in saving untitled buffers
2023-02-20 10:05:58 -08:00
Max Brunsfeld
010eba509c Make Project::save_buffer and ::save_buffers into methods 2023-02-20 09:42:44 -08:00
Max Brunsfeld
56b7eb6b6f Only send UpdateBufferFile messages for buffers whose files have changed
Send that message when saving a buffer as a new path.
2023-02-20 09:41:59 -08:00
Petros Amoiridis
6551742c58 Merge pull request #2191 from zed-industries/petros/z-53-reveal-in-finder-crashes-zed
Move reveal_path to ForegroundPlatform
2023-02-20 19:09:54 +02:00
Petros Amoiridis
4bb986b3be Move reveal_path to ForegroundPlatform
So that we can use spawn to use the OS API call.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-02-20 18:57:37 +02:00
Kay Simmons
efafd1d8d3 Merge pull request #2188 from zed-industries/dont-open-project-items-in-dock
Dont open project items in dock
2023-02-18 13:53:29 -08:00
Kay Simmons
0981244797 further tweak comment 2023-02-18 13:53:13 -08:00
Kay Simmons
159d3ab00c Add comment explaining push_keystroke 2023-02-18 13:49:08 -08:00
Kay Simmons
3fb6e31b92 revert for loop change and store matched actions in a sorted set instead 2023-02-18 13:42:28 -08:00
Kay Simmons
04df00b221 Iterate over keymap then dispatch path when matching keybindings to make precedence more intuitive
Rename action which adds the active tab to the dock to be more intuitive
Add action which moves the active tab out of the dock and bind it to the same keybinding
2023-02-18 13:10:01 -08:00
Kay Simmons
dc6f7fd577 pull toggle button into its own file 2023-02-18 12:32:19 -08:00
Kay Simmons
ac3e8f61ef Merge pull request #2186 from zed-industries/better-vim-matching-motion
Better vim matching motion
2023-02-17 22:10:28 -08:00
Kay Simmons
fc811d14b1 Fix failing test 2023-02-17 22:00:39 -08:00
Max Brunsfeld
cdf64b6cad Unify save and save_as for local worktrees
This fixes state propagation bugs due to missing RPC calls in save_as.
2023-02-17 17:21:48 -08:00
Max Brunsfeld
3a7cfc3901 Move the save and save_as code paths close together 2023-02-17 17:21:48 -08:00
Kay Simmons
5e4d113308 fix bracket ranges failing test 2023-02-17 17:19:23 -08:00
Max Brunsfeld
de6eb00e2b Start work on making save and save_as code paths more similar 2023-02-17 15:52:13 -08:00
Max Brunsfeld
76975c29a9 Refactor: split Project::format logic into local and remote cases 2023-02-17 15:29:54 -08:00
Kay Simmons
57a7ff9a6f fix vim percent motion to better match the docs and observed behavior 2023-02-17 14:55:19 -08:00
Max Brunsfeld
eebce28b32 Respect UpdateBufferFile messages on guest buffers without file
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-02-17 12:38:04 -08:00
Max Brunsfeld
31dac39e34 Fix assignment of language to formerly-untitled buffers
When lazy-loading a language, check if it matches plain text buffers.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-02-17 11:12:57 -08:00
Mikayla Maki
5cfe206433 Merge pull request #2185 from zed-industries/refactor-restart
Used the pre-existing app_path call in the GPUI platform
2023-02-17 10:39:45 -08:00
Mikayla Maki
ff2fb06b2c Used the pre-existing app_path call in the GPUI platform 2023-02-17 10:30:28 -08:00
Mikayla Maki
a5ad2f544e Update README.md 2023-02-16 16:51:57 -08:00
Mikayla Maki
7b291df21f Merge pull request #2184 from zed-industries/relaunch
Restart
2023-02-16 16:50:20 -08:00
Mikayla Maki
6e33f33da1 Switch to open based restarting 2023-02-16 16:47:43 -08:00
Mikayla Maki
4ea7a24b93 Made the 'update zed to collaborate' button clickable 2023-02-16 14:53:50 -08:00
Julia
48b76f96fc Merge pull request #2183 from zed-industries/default-settings-yaml-casing
Use correct case for YAML in default settings
2023-02-16 16:37:37 -05:00
Julia
c72a50e203 Use correct case for YAML in default settings 2023-02-16 16:37:07 -05:00
Mikayla Maki
43f61ab413 Added action to autoupdate 2023-02-16 13:35:32 -08:00
Mikayla Maki
cf83ecccbb Added workspace restart command 2023-02-16 13:28:56 -08:00
Kay Simmons
848c6b78d5 Merge pull request #2181 from zed-industries/update-typesript-tree-sitter
update tree-sitter-typescript to add support for new satisfies operator
2023-02-16 12:56:40 -08:00
Max Brunsfeld
b90fc046ca Merge pull request #2180 from zed-industries/turbofish-highlight
Highlight functions called with a turbofish in Rust
2023-02-16 12:52:37 -08:00
Max Brunsfeld
98b51634c4 Merge pull request #2182 from zed-industries/faster-injections
Fix syntax-related performance problems on gigantic files
2023-02-16 12:52:13 -08:00
Max Brunsfeld
28eb69e74e Bump tree-sitter for optimization of querying in range 2023-02-16 12:35:35 -08:00
Kay Simmons
b03eebeb6c update tree-sitter-typescript to add support for new satisfies operator 2023-02-16 12:24:35 -08:00
Kay Simmons
eac33d732e wip 2023-02-16 12:23:45 -08:00
Max Brunsfeld
2d39358323 rust: Highlight functions called with a turbofish 2023-02-16 12:11:57 -08:00
Joseph T. Lyons
a4a179763a Merge pull request #2171 from zed-industries/add-option-to-advance-cursor-downward-when-toggling-comment
Add option to advance cursor downward when toggling comment
2023-02-16 15:03:38 -05:00
Julia
19b686ad65 Merge pull request #2177 from zed-industries/check-before-test
Cargo check before test to catch warnings/errors
2023-02-16 14:43:33 -05:00
Antonio Scandurra
ac882c7db5 Merge pull request #2179 from zed-industries/debounce-diagnostics
Simulate disk-based diagnostics finishing 1s after saving buffer
2023-02-16 16:34:19 +01:00
Antonio Scandurra
baee6d0342 Simulate disk-based diagnostics finishing 1s after saving buffer
Previously, we would simulate disk-based diagnostics finishing after
saving a buffer. However, the language server may produce diagnostics
right after emitting the event, causing the diagnostics status bar item
to not reflect the latest state of the buffer.

With this change, we will instead simulate disk-based diagnostics finishing
after 1s after saving the buffer (only for language servers that
don't have the concept of disk-based diagnostics, such as TypeScript). This
ensures we always reflect the latest state and doesn't cause the UI to flicker
as a result of the LSP sending us diagnostics after every input.
2023-02-16 16:04:08 +01:00
Julia
50ccf16de1 Cargo check before test to catch warnings/errors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-02-15 17:53:28 -05:00
Kay Simmons
bef2013c7f wip 2023-02-15 14:40:14 -08:00
Kay Simmons
2c904cb0bf Merge pull request #2176 from zed-industries/better-move-to-brackets
Make jump to matching bracket action more predictable
2023-02-15 14:32:51 -08:00
Kay Simmons
33306846a6 add tree-sitter-typescript to editor crate test support features 2023-02-15 14:28:50 -08:00
Kay Simmons
30caeeaeb5 fix comment typo 2023-02-15 14:11:00 -08:00
Kay Simmons
0ba051a754 use more predictable rules for selecting which bracket to jump to and where 2023-02-15 14:04:16 -08:00
Max Brunsfeld
32191e318e Merge pull request #2175 from zed-industries/restore-toggle-dock-binding
Put back shift-escape binding for FocusDock action
2023-02-15 14:04:01 -08:00
Max Brunsfeld
7037842bef Put back shift-escape binding for FocusDock action 2023-02-15 13:57:07 -08:00
Julia
8bd20d8c3a Merge pull request #2173 from zed-industries/tab-bar-background-focus-pane
Focus pane when clicking on tab bar background
2023-02-15 16:07:10 -05:00
Julia
df1775326c Merge pull request #2172 from zed-industries/window-title-shenanigans
Window title shenanigans
2023-02-15 16:03:30 -05:00
Julia
df0715e7c9 Indicate in native window title if project is shared or remote 2023-02-15 15:56:16 -05:00
Julia
e56dfd9177 Tell OS about window title 2023-02-15 15:55:55 -05:00
Joseph Lyons
afb375f909 v0.75.x dev 2023-02-15 14:57:51 -05:00
Joseph Lyons
5fbc9736e5 Add option to advance cursor downward when toggling comment
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-02-15 14:00:49 -05:00
Julia
3a7ac9c0ff Focus pane when clicking on tab bar background 2023-02-14 12:39:29 -05:00
Max Brunsfeld
ea663f3017 Bump tree-sitter for tree-balancing bugfix 2023-02-13 23:46:44 -08:00
Antonio Scandurra
6703264600 Limit BufferSnapshot::chunks to the outline item range
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-13 19:57:15 +01:00
Nate Butler
5ce147a2ad Remove unneeded API from theme-tool 2023-02-12 21:04:54 -05:00
Nate Butler
a32c0d1c9b Update colors. 2023-02-12 21:04:31 -05:00
Nate Butler
e65c0810ba Add gray color families 2023-02-12 20:02:51 -05:00
Nate Butler
1fcfa5d272 Generate color meta, document functions and tidy. 2023-02-12 19:45:16 -05:00
Nate Butler
addfcdc1f4 Remove bezier-easing from styles
This was installed in the wrong app
2023-02-12 11:59:36 -05:00
Nate Butler
4501a5a7ee Add initial system palette reference colors 2023-02-12 00:15:41 -05:00
Nate Butler
a120996f0d Test using HSL + curves to build a scale 2023-02-11 23:34:46 -05:00
Nate Butler
187fac1579 Allow passing a chroma color as a start/mid/end color 2023-02-11 21:10:47 -05:00
Nate Butler
0acb820f04 Document ref/color further 2023-02-11 08:14:13 -05:00
Nate Butler
dda0febf39 Organize 2023-02-11 07:56:41 -05:00
Nate Butler
0e238210bb Update chip style 2023-02-10 22:06:03 -05:00
Nate Butler
76685406ed Add remaining colors 2023-02-09 23:26:44 -05:00
Nate Butler
70eedbb48e Group light and dark scales 2023-02-09 13:41:37 -05:00
Nate Butler
42b5fa1fa3 WIP: Use algorithm to generate reference color palette
Adapted from @k-vyn/coloralgorithm
Generate colors for our reference palette.
2023-02-09 12:37:05 -05:00
Nate Butler
f787f6054b List colors for reference palette in theme tool 2023-02-09 00:39:57 -05:00
Nate Butler
6f342bb2c6 Remove leftovers from create-next-app 2023-02-09 00:10:32 -05:00
Nate Butler
0ba44c6dc4 Start on system colors 2023-02-09 00:09:52 -05:00
Nate Butler
2ff82732b9 Init theme tool 2023-02-09 00:09:44 -05:00
Nate Butler
cbfdfa8124 Remove comment 2023-02-08 22:52:27 -05:00
Max Brunsfeld
9c25d37dfc Merge branch 'main' into randomized-tests-operation-script
In randomized integration test, incorporate random updates of existing
files into the test's new structure.
2023-01-24 12:39:24 -08:00
Max Brunsfeld
2c84b74126 Avoid retaining project in randomized test while LSP request is outstanding 2023-01-16 09:48:54 -08:00
Max Brunsfeld
1a9ff2420e Clean up how applications are marked as inapplicable 2023-01-12 22:09:36 -08:00
Max Brunsfeld
e04d0be853 Remove unneeded log messages in randomized test 2023-01-12 14:30:53 -08:00
Max Brunsfeld
00e8625037 Simplify management of entity ids for different app contexts in randomized test 2023-01-12 14:30:10 -08:00
Max Brunsfeld
a3c7416218 Don't include user ids with MutateClients ops in serialized test plans 2023-01-12 14:28:31 -08:00
Max Brunsfeld
576a9bb92c Drop project's buffers when closing a remote project 2023-01-09 14:49:36 -08:00
Max Brunsfeld
5a4fa4b11e Merge branch 'main' into randomized-tests-operation-script 2023-01-09 12:26:11 -08:00
Max Brunsfeld
3e3a703b60 Skip inapplicable operations when running an edited test plan 2023-01-09 11:36:53 -08:00
Max Brunsfeld
c503ba00b6 Add env vars to store and load test plan from JSON files 2023-01-06 17:51:25 -08:00
Max Brunsfeld
2351f2bd0c Tolerate failure to join remote projects in randomized test 2023-01-06 15:40:42 -08:00
Max Brunsfeld
99390a7237 Represent all randomized test actions as operations 2023-01-06 15:32:11 -08:00
Max Brunsfeld
210286da48 Make operations for all buffer manipulations 2023-01-06 15:32:11 -08:00
Max Brunsfeld
f1b3692a35 Tweak operation rates 2023-01-06 15:32:11 -08:00
Max Brunsfeld
f243633f3e Set up flow for mutating clients via explicit operation values 2023-01-06 15:32:11 -08:00
Max Brunsfeld
ce8dd5a286 wip 2023-01-06 15:32:11 -08:00
Max Brunsfeld
a74c5073a4 Start work on allowing random collab test to be minimized
Represent operations as an explicit enum.
2023-01-06 15:32:11 -08:00
554 changed files with 43215 additions and 16385 deletions

View File

@@ -1,9 +0,0 @@
## Description of feature or change
## Link to related issues from zed or community
## Before Merging
- [ ] Does this have tests or have existing tests been updated to cover this change?
- [ ] Have you added the necessary settings to configure this feature?
- [ ] Has documentation been created or updated (including above changes to settings)?

View File

@@ -17,6 +17,26 @@ env:
RUST_BACKTRACE: 1
jobs:
rustfmt:
name: Check formatting
runs-on:
- self-hosted
- test
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update stable
- name: Checkout repo
uses: actions/checkout@v2
with:
clean: false
submodules: 'recursive'
- name: cargo fmt
run: cargo fmt --all -- --check
tests:
name: Run tests
runs-on:
@@ -34,7 +54,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'
- name: Checkout repo
uses: actions/checkout@v2
@@ -42,6 +62,9 @@ jobs:
clean: false
submodules: 'recursive'
- name: Run check
run: cargo check --workspace
- name: Run tests
run: cargo test --workspace --no-fail-fast
@@ -79,7 +102,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'
- name: Checkout repo
uses: actions/checkout@v2

43
.github/workflows/randomized_tests.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Randomized Tests
concurrency: randomized-tests
on:
push:
branches:
- randomized-tests-runner
schedule:
- cron: '0 * * * *'
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
ZED_SERVER_URL: https://zed.dev
ZED_CLIENT_SECRET_TOKEN: ${{ secrets.ZED_CLIENT_SECRET_TOKEN }}
jobs:
tests:
name: Run randomized tests
runs-on:
- self-hosted
- randomized-tests
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update stable
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Checkout repo
uses: actions/checkout@v2
with:
clean: false
submodules: 'recursive'
- name: Run randomized tests
run: script/randomized-test-ci

209
Cargo.lock generated
View File

@@ -518,6 +518,7 @@ dependencies = [
"menu",
"project",
"serde",
"serde_derive",
"serde_json",
"settings",
"smol",
@@ -784,6 +785,7 @@ dependencies = [
"gpui",
"itertools",
"language",
"outline",
"project",
"search",
"settings",
@@ -794,7 +796,7 @@ dependencies = [
[[package]]
name = "bromberg_sl2"
version = "0.6.0"
source = "git+https://github.com/zed-industries/bromberg_sl2?rev=dac565a90e8f9245f48ff46225c915dc50f76920#dac565a90e8f9245f48ff46225c915dc50f76920"
source = "git+https://github.com/zed-industries/bromberg_sl2?rev=950bc5482c216c395049ae33ae4501e08975f17f#950bc5482c216c395049ae33ae4501e08975f17f"
dependencies = [
"digest 0.9.0",
"lazy_static",
@@ -1097,6 +1099,7 @@ dependencies = [
"ipc-channel",
"plist",
"serde",
"serde_derive",
]
[[package]]
@@ -1111,7 +1114,6 @@ dependencies = [
"futures 0.3.25",
"gpui",
"image",
"isahc",
"lazy_static",
"log",
"parking_lot 0.11.2",
@@ -1119,8 +1121,10 @@ dependencies = [
"rand 0.8.5",
"rpc",
"serde",
"serde_derive",
"settings",
"smol",
"staff_mode",
"sum_tree",
"tempfile",
"thiserror",
@@ -1188,7 +1192,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.5.4"
version = "0.8.3"
dependencies = [
"anyhow",
"async-tungstenite",
@@ -1209,6 +1213,7 @@ dependencies = [
"git",
"gpui",
"hyper",
"indoc",
"language",
"lazy_static",
"lipsum",
@@ -1228,6 +1233,7 @@ dependencies = [
"sea-orm",
"sea-query",
"serde",
"serde_derive",
"serde_json",
"settings",
"sha-1 0.9.8",
@@ -1252,11 +1258,14 @@ name = "collab_ui"
version = "0.1.0"
dependencies = [
"anyhow",
"auto_update",
"call",
"client",
"clock",
"collections",
"context_menu",
"editor",
"feedback",
"futures 0.3.25",
"fuzzy",
"gpui",
@@ -1266,6 +1275,7 @@ dependencies = [
"postage",
"project",
"serde",
"serde_derive",
"settings",
"theme",
"util",
@@ -1324,6 +1334,50 @@ dependencies = [
"theme",
]
[[package]]
name = "copilot"
version = "0.1.0"
dependencies = [
"anyhow",
"async-compression",
"async-tar",
"clock",
"collections",
"context_menu",
"fs",
"futures 0.3.25",
"gpui",
"language",
"log",
"lsp",
"node_runtime",
"rpc",
"serde",
"serde_derive",
"settings",
"smol",
"theme",
"util",
"workspace",
]
[[package]]
name = "copilot_button"
version = "0.1.0"
dependencies = [
"anyhow",
"context_menu",
"copilot",
"editor",
"futures 0.3.25",
"gpui",
"settings",
"smol",
"theme",
"util",
"workspace",
]
[[package]]
name = "core-foundation"
version = "0.9.3"
@@ -1736,6 +1790,7 @@ dependencies = [
"log",
"parking_lot 0.11.2",
"serde",
"serde_derive",
"smol",
"sqlez",
"sqlez_macros",
@@ -1779,6 +1834,7 @@ dependencies = [
"editor",
"gpui",
"language",
"lsp",
"postage",
"project",
"serde_json",
@@ -1923,6 +1979,7 @@ dependencies = [
"clock",
"collections",
"context_menu",
"copilot",
"ctor",
"db",
"drag_and_drop",
@@ -1944,6 +2001,7 @@ dependencies = [
"rand 0.8.5",
"rpc",
"serde",
"serde_derive",
"settings",
"smallvec",
"smol",
@@ -1956,6 +2014,7 @@ dependencies = [
"tree-sitter-html",
"tree-sitter-javascript",
"tree-sitter-rust",
"tree-sitter-typescript 0.20.2",
"unindent",
"util",
"workspace",
@@ -2096,6 +2155,7 @@ dependencies = [
"project",
"search",
"serde",
"serde_derive",
"settings",
"sysinfo",
"theme",
@@ -2292,6 +2352,7 @@ dependencies = [
"regex",
"rope",
"serde",
"serde_derive",
"serde_json",
"smol",
"tempfile",
@@ -2578,9 +2639,9 @@ dependencies = [
[[package]]
name = "glob"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "globset"
@@ -2660,8 +2721,10 @@ dependencies = [
"postage",
"rand 0.8.5",
"resvg",
"schemars",
"seahash",
"serde",
"serde_derive",
"serde_json",
"simplelog",
"smallvec",
@@ -3015,6 +3078,17 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adab1eaa3408fb7f0c777a73e7465fd5656136fc93b670eb6df3c88c2c1344e3"
[[package]]
name = "install_cli"
version = "0.1.0"
dependencies = [
"anyhow",
"gpui",
"log",
"smol",
"util",
]
[[package]]
name = "instant"
version = "0.1.12"
@@ -3154,6 +3228,7 @@ dependencies = [
name = "journal"
version = "0.1.0"
dependencies = [
"anyhow",
"chrono",
"dirs 4.0.0",
"editor",
@@ -3249,6 +3324,7 @@ dependencies = [
"fuzzy",
"git",
"gpui",
"indoc",
"lazy_static",
"log",
"lsp",
@@ -3258,6 +3334,7 @@ dependencies = [
"regex",
"rpc",
"serde",
"serde_derive",
"serde_json",
"settings",
"similar",
@@ -3275,12 +3352,28 @@ dependencies = [
"tree-sitter-python",
"tree-sitter-ruby",
"tree-sitter-rust",
"tree-sitter-typescript",
"tree-sitter-typescript 0.20.1",
"unicase",
"unindent",
"util",
]
[[package]]
name = "language_selector"
version = "0.1.0"
dependencies = [
"anyhow",
"editor",
"fuzzy",
"gpui",
"language",
"picker",
"project",
"settings",
"theme",
"workspace",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@@ -3437,6 +3530,7 @@ dependencies = [
"parking_lot 0.11.2",
"postage",
"serde",
"serde_derive",
"serde_json",
"sha2 0.10.6",
"simplelog",
@@ -3457,6 +3551,7 @@ dependencies = [
"prost-types 0.8.0",
"reqwest",
"serde",
"serde_derive",
"sha2 0.10.6",
]
@@ -3497,6 +3592,7 @@ dependencies = [
"parking_lot 0.11.2",
"postage",
"serde",
"serde_derive",
"serde_json",
"smol",
"unindent",
@@ -3862,6 +3958,23 @@ dependencies = [
"memoffset 0.6.5",
]
[[package]]
name = "node_runtime"
version = "0.1.0"
dependencies = [
"anyhow",
"async-compression",
"async-tar",
"futures 0.3.25",
"gpui",
"parking_lot 0.11.2",
"serde",
"serde_derive",
"serde_json",
"smol",
"util",
]
[[package]]
name = "nom"
version = "7.1.1"
@@ -4416,6 +4529,7 @@ dependencies = [
"bincode",
"plugin_macros",
"serde",
"serde_derive",
]
[[package]]
@@ -4426,6 +4540,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"serde_derive",
"syn",
]
@@ -4437,6 +4552,7 @@ dependencies = [
"bincode",
"pollster",
"serde",
"serde_derive",
"serde_json",
"smol",
"wasi-common",
@@ -4478,14 +4594,15 @@ checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7"
[[package]]
name = "postage"
version = "0.4.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a63d25391d04a097954b76aba742b6b5b74f213dfe3dbaeeb36e8ddc1c657f0b"
checksum = "af3fb618632874fb76937c2361a7f22afd393c982a2165595407edc75b06d3c1"
dependencies = [
"atomic",
"crossbeam-queue",
"futures 0.3.25",
"log",
"parking_lot 0.12.1",
"pin-project",
"pollster",
"static_assertions",
@@ -4574,12 +4691,16 @@ dependencies = [
"client",
"clock",
"collections",
"copilot",
"ctor",
"db",
"env_logger",
"fs",
"fsevent",
"futures 0.3.25",
"fuzzy",
"git",
"glob",
"gpui",
"ignore",
"language",
@@ -4588,11 +4709,13 @@ dependencies = [
"lsp",
"parking_lot 0.11.2",
"postage",
"pretty_assertions",
"pulldown-cmark",
"rand 0.8.5",
"regex",
"rpc",
"serde",
"serde_derive",
"serde_json",
"settings",
"sha2 0.10.6",
@@ -4958,6 +5081,7 @@ dependencies = [
"settings",
"smol",
"text",
"util",
"workspace",
]
@@ -5215,6 +5339,7 @@ dependencies = [
"rand 0.8.5",
"rsa",
"serde",
"serde_derive",
"smol",
"smol-timeout",
"tempdir",
@@ -5638,6 +5763,7 @@ dependencies = [
"postage",
"project",
"serde",
"serde_derive",
"serde_json",
"settings",
"smallvec",
@@ -5824,11 +5950,14 @@ dependencies = [
"gpui",
"json_comments",
"postage",
"pretty_assertions",
"schemars",
"serde",
"serde_derive",
"serde_json",
"serde_path_to_error",
"sqlez",
"staff_mode",
"theme",
"toml",
"tree-sitter",
@@ -6239,6 +6368,14 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "staff_mode"
version = "0.1.0"
dependencies = [
"anyhow",
"gpui",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
@@ -6446,6 +6583,7 @@ dependencies = [
"procinfo",
"rand 0.8.5",
"serde",
"serde_derive",
"settings",
"shellexpand",
"smallvec",
@@ -6477,6 +6615,7 @@ dependencies = [
"project",
"rand 0.8.5",
"serde",
"serde_derive",
"settings",
"shellexpand",
"smallvec",
@@ -6536,6 +6675,7 @@ dependencies = [
"indexmap",
"parking_lot 0.11.2",
"serde",
"serde_derive",
"serde_json",
"serde_path_to_error",
"toml",
@@ -6554,6 +6694,7 @@ dependencies = [
"postage",
"settings",
"smol",
"staff_mode",
"theme",
"util",
"workspace",
@@ -7002,7 +7143,7 @@ dependencies = [
[[package]]
name = "tree-sitter"
version = "0.20.9"
source = "git+https://github.com/tree-sitter/tree-sitter?rev=36b5b6c89e55ad1a502f8b3234bb3e12ec83a5da#36b5b6c89e55ad1a502f8b3234bb3e12ec83a5da"
source = "git+https://github.com/tree-sitter/tree-sitter?rev=c51896d32dcc11a38e41f36e3deb1a6a9c4f4b14#c51896d32dcc11a38e41f36e3deb1a6a9c4f4b14"
dependencies = [
"cc",
"regex",
@@ -7190,6 +7331,15 @@ dependencies = [
"tree-sitter",
]
[[package]]
name = "tree-sitter-typescript"
version = "0.20.2"
source = "git+https://github.com/tree-sitter/tree-sitter-typescript?rev=5d20856f34315b068c41edaee2ac8a100081d259#5d20856f34315b068c41edaee2ac8a100081d259"
dependencies = [
"cc",
"tree-sitter",
]
[[package]]
name = "tree-sitter-yaml"
version = "0.0.1"
@@ -7429,11 +7579,15 @@ dependencies = [
"dirs 3.0.2",
"futures 0.3.25",
"git2",
"isahc",
"lazy_static",
"log",
"rand 0.8.5",
"serde",
"serde_json",
"smol",
"tempdir",
"url",
]
[[package]]
@@ -7520,6 +7674,7 @@ dependencies = [
"project",
"search",
"serde",
"serde_derive",
"serde_json",
"settings",
"tokio",
@@ -7999,6 +8154,26 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]]
name = "welcome"
version = "0.1.0"
dependencies = [
"anyhow",
"db",
"editor",
"fuzzy",
"gpui",
"install_cli",
"log",
"picker",
"project",
"settings",
"theme",
"theme_selector",
"util",
"workspace",
]
[[package]]
name = "wepoll-ffi"
version = "0.1.2"
@@ -8274,6 +8449,7 @@ dependencies = [
"futures 0.3.25",
"gpui",
"indoc",
"install_cli",
"language",
"lazy_static",
"log",
@@ -8282,9 +8458,11 @@ dependencies = [
"postage",
"project",
"serde",
"serde_derive",
"serde_json",
"settings",
"smallvec",
"terminal",
"theme",
"util",
"uuid 1.2.2",
@@ -8344,7 +8522,7 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]]
name = "zed"
version = "0.74.0"
version = "0.83.1"
dependencies = [
"activity_indicator",
"anyhow",
@@ -8365,7 +8543,10 @@ dependencies = [
"collections",
"command_palette",
"context_menu",
"copilot",
"copilot_button",
"ctor",
"db",
"diagnostics",
"easy-parallel",
"editor",
@@ -8381,13 +8562,16 @@ dependencies = [
"ignore",
"image",
"indexmap",
"install_cli",
"isahc",
"journal",
"language",
"language_selector",
"lazy_static",
"libc",
"log",
"lsp",
"node_runtime",
"num_cpus",
"outline",
"parking_lot 0.11.2",
@@ -8404,12 +8588,14 @@ dependencies = [
"rust-embed",
"search",
"serde",
"serde_derive",
"serde_json",
"serde_path_to_error",
"settings",
"simplelog",
"smallvec",
"smol",
"staff_mode",
"sum_tree",
"tempdir",
"terminal_view",
@@ -8437,7 +8623,7 @@ dependencies = [
"tree-sitter-rust",
"tree-sitter-scheme",
"tree-sitter-toml",
"tree-sitter-typescript",
"tree-sitter-typescript 0.20.2",
"tree-sitter-yaml",
"unindent",
"url",
@@ -8445,6 +8631,7 @@ dependencies = [
"util",
"uuid 1.2.2",
"vim",
"welcome",
"workspace",
]

View File

@@ -13,6 +13,8 @@ members = [
"crates/collections",
"crates/command_palette",
"crates/context_menu",
"crates/copilot",
"crates/copilot_button",
"crates/db",
"crates/diagnostics",
"crates/drag_and_drop",
@@ -26,13 +28,16 @@ members = [
"crates/go_to_line",
"crates/gpui",
"crates/gpui_macros",
"crates/install_cli",
"crates/journal",
"crates/language",
"crates/language_selector",
"crates/live_kit_client",
"crates/live_kit_server",
"crates/lsp",
"crates/media",
"crates/menu",
"crates/node_runtime",
"crates/outline",
"crates/picker",
"crates/plugin",
@@ -49,6 +54,7 @@ members = [
"crates/snippet",
"crates/sqlez",
"crates/sqlez_macros",
"crates/staff_mode",
"crates/sum_tree",
"crates/terminal",
"crates/text",
@@ -58,6 +64,7 @@ members = [
"crates/util",
"crates/vim",
"crates/workspace",
"crates/welcome",
"crates/zed",
]
default-members = ["crates/zed"]
@@ -65,11 +72,14 @@ resolver = "2"
[workspace.dependencies]
serde = { version = "1.0", features = ["derive", "rc"] }
serde_derive = { version = "1.0", features = ["deserialize_in_place"] }
serde_json = { version = "1.0", features = ["preserve_order", "raw_value"] }
rand = { version = "0.8" }
postage = { version = "0.5", features = ["futures-traits"] }
smallvec = { version = "1.6", features = ["union"] }
[patch.crates-io]
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "36b5b6c89e55ad1a502f8b3234bb3e12ec83a5da" }
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "c51896d32dcc11a38e41f36e3deb1a6a9c4f4b14" }
async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" }
# TODO - Remove when a version is released with this PR: https://github.com/servo/core-foundation-rs/pull/457

View File

@@ -23,10 +23,18 @@ Welcome to Zed, a lightning-fast, collaborative code editor that makes your drea
git clone https://github.com/zed-industries/zed.dev
```
* Set up a local `zed` database and seed it with some initial users:
* Initialize submodules
```
script/bootstrap
git submodule update --init --recursive
```
* Set up a local `zed` database and seed it with some initial users:
Create a personal GitHub token to run `script/bootstrap` once successfully. Then delete that token.
```
GITHUB_TOKEN=<$token> script/bootstrap
```
### Testing against locally-running servers
@@ -51,7 +59,7 @@ If you trigger `cmd-alt-i`, Zed will copy a JSON representation of the current w
### Licensing
We use `[cargo-about](https://github.com/EmbarkStudios/cargo-about)` to automatically comply with open source licenses. If CI is failing, check the following:
We use [`cargo-about`](https://github.com/EmbarkStudios/cargo-about) to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a `no license specified` error for a crate you've created? If so, add `publish = false` under `[package]` in your crate's Cargo.toml.
- Is the error `failed to satisfy license requirements` for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to the `accepted` array in `script/licenses/zed-licenses.toml`.

View File

@@ -0,0 +1,12 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.2926 3.48996C3.79162 3.79616 3.44871 4.26316 3.44871 4.93872C3.44871 5.75753 3.65302 6.19648 3.88658 6.43349C4.11948 6.66983 4.47018 6.79529 4.95638 6.79529C5.64158 6.79529 6.23176 6.65786 6.64548 6.37099C7.03216 6.10286 7.32149 5.66636 7.35698 4.91278C7.38386 4.34213 7.36863 3.96084 7.21748 3.68905C7.09721 3.47279 6.81682 3.2089 5.96976 3.11109C5.4731 3.05374 4.81346 3.17162 4.2926 3.48996ZM3.72539 2.5525C4.46348 2.10138 5.36842 1.93724 6.09436 2.02107C7.1336 2.14107 7.8142 2.51324 8.17039 3.15373C8.49569 3.73867 8.47238 4.43479 8.44743 4.96466C8.39736 6.02772 7.95809 6.7938 7.26541 7.27411C6.59976 7.73566 5.75982 7.89249 4.95638 7.89249C4.2936 7.89249 3.61755 7.71967 3.11095 7.20558C2.605 6.69216 2.35705 5.92853 2.35705 4.93872C2.35705 3.80566 2.96744 3.01576 3.72539 2.5525Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.69546 8.97734C7.02432 8.97734 7.29091 9.24528 7.29091 9.57581V10.8725C7.29091 11.203 7.02432 11.471 6.69546 11.471C6.3666 11.471 6.1 11.203 6.1 10.8725V9.57581C6.1 9.24528 6.3666 8.97734 6.69546 8.97734Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.45301 7.32072C2.56382 6.90477 2.81104 6.35118 3.40175 6.17048L3.74851 7.31556C3.74509 7.31822 3.73425 7.32798 3.71842 7.35038C3.68409 7.39897 3.64151 7.48723 3.6034 7.6303C3.52629 7.91973 3.49839 8.31081 3.4984 8.73318V10.8761C3.5122 10.9688 3.52011 11.0083 3.53501 11.0478C3.5474 11.0807 3.57295 11.1339 3.6523 11.2153C3.83266 11.4004 4.24428 11.6866 5.21016 12.1174C5.99398 12.467 6.35125 12.6243 6.68361 12.7078C6.99799 12.7869 7.30564 12.8031 7.99999 12.8031V14C7.31311 14 6.86876 13.9882 6.3946 13.869C5.95125 13.7575 5.49691 13.5549 4.78914 13.2391C4.76868 13.23 4.74801 13.2208 4.72712 13.2115C3.73729 12.77 3.14865 12.4092 2.80139 12.0527C2.61692 11.8634 2.49682 11.6721 2.42136 11.4719C2.35507 11.2961 2.33141 11.1302 2.31663 11.0266C2.31561 11.0194 2.31463 11.0126 2.31369 11.0061L2.30749 10.9632V8.73321C2.30748 8.28334 2.33457 7.76532 2.45301 7.32072Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.83439 7.54965C2.14812 7.21281 2.52306 6.88008 2.81315 6.70729L3.42031 7.737C3.27036 7.82631 2.98468 8.06607 2.7038 8.36764C2.43565 8.65553 2.2592 8.90729 2.19783 9.04784C2.18425 9.16608 2.18871 9.38528 2.22654 9.6452C2.26959 9.94104 2.33715 10.1608 2.37974 10.2387L2.42237 10.3167L2.44057 10.4038C2.46806 10.5353 2.60072 10.7284 2.96139 10.9852C3.24332 11.1859 3.57562 11.3661 3.93098 11.5588C4.00968 11.6015 4.0895 11.6448 4.17017 11.689C4.56251 11.8768 5.17152 12.1512 5.7408 12.3785C6.02948 12.4938 6.30016 12.5938 6.5233 12.664C6.63493 12.6991 6.72826 12.7247 6.802 12.7411C6.87402 12.7571 6.90715 12.7597 6.91166 12.76L6.91213 13.957C6.68654 13.957 6.40667 13.8815 6.16744 13.8062C5.90465 13.7235 5.60351 13.6116 5.30115 13.4909C4.69547 13.2491 4.05361 12.9594 3.64268 12.7623L3.62786 12.7552L3.61345 12.7473C3.54294 12.7085 3.46868 12.6683 3.39187 12.6268C3.03384 12.433 2.62042 12.2092 2.27302 11.9619C1.88328 11.6844 1.44476 11.2894 1.29544 10.735C1.17095 10.4701 1.09192 10.1191 1.04817 9.81844C0.999401 9.48332 0.975841 9.08189 1.03513 8.7778L1.04265 8.73927L1.05511 8.70206C1.18745 8.30673 1.53258 7.87368 1.83439 7.54965Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.59243 10.4347V8.41995H2.78334V10.4347H1.59243Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.7074 3.48996C12.2084 3.79616 12.5513 4.26316 12.5513 4.93872C12.5513 5.75753 12.347 6.19648 12.1134 6.43349C11.8805 6.66983 11.5298 6.79529 11.0436 6.79529C10.3584 6.79529 9.76824 6.65786 9.35452 6.37099C8.96784 6.10286 8.67851 5.66636 8.64302 4.91278C8.61614 4.34213 8.63137 3.96084 8.78252 3.68905C8.90279 3.47279 9.18318 3.2089 10.0302 3.11109C10.5269 3.05374 11.1865 3.17162 11.7074 3.48996ZM12.2746 2.5525C11.5365 2.10138 10.6316 1.93724 9.90564 2.02107C8.8664 2.14107 8.1858 2.51324 7.82961 3.15373C7.50431 3.73867 7.52762 4.43479 7.55258 4.96466C7.60264 6.02772 8.04191 6.7938 8.73459 7.27411C9.40024 7.73566 10.2402 7.89249 11.0436 7.89249C11.7064 7.89249 12.3824 7.71967 12.889 7.20558C13.395 6.69216 13.643 5.92853 13.643 4.93872C13.643 3.80566 13.0326 3.01576 12.2746 2.5525Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.30454 8.97734C8.97568 8.97734 8.70909 9.24528 8.70909 9.57581V10.8725C8.70909 11.203 8.97568 11.471 9.30454 11.471C9.6334 11.471 9.9 11.203 9.9 10.8725V9.57581C9.9 9.24528 9.6334 8.97734 9.30454 8.97734Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.547 7.32072C13.4362 6.90477 13.189 6.35118 12.5982 6.17048L12.2515 7.31556C12.2549 7.31822 12.2658 7.32798 12.2816 7.35038C12.3159 7.39897 12.3585 7.48723 12.3966 7.6303C12.4737 7.91973 12.5016 8.31081 12.5016 8.73318V10.8761C12.4878 10.9688 12.4799 11.0083 12.465 11.0478C12.4526 11.0807 12.427 11.1339 12.3477 11.2153C12.1673 11.4004 11.7557 11.6866 10.7898 12.1174C10.006 12.467 9.64875 12.6243 9.31639 12.7078C9.00201 12.7869 8.69433 12.8031 7.99999 12.8031V14C8.68686 14 9.13124 13.9882 9.6054 13.869C10.0488 13.7575 10.5031 13.5549 11.2109 13.2391C11.2313 13.23 11.252 13.2208 11.2729 13.2115C12.2627 12.77 12.8513 12.4092 13.1986 12.0527C13.3831 11.8634 13.5032 11.6721 13.5786 11.4719C13.6449 11.2961 13.6686 11.1302 13.6834 11.0266C13.6844 11.0194 13.6854 11.0126 13.6863 11.0061L13.6925 10.9632V8.73321C13.6925 8.28334 13.6654 7.76532 13.547 7.32072Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.1656 7.54965C13.8519 7.21281 13.4769 6.88008 13.1868 6.70729L12.5797 7.737C12.7296 7.82631 13.0153 8.06607 13.2962 8.36764C13.5643 8.65553 13.7408 8.90729 13.8022 9.04784C13.8158 9.16608 13.8113 9.38528 13.7735 9.6452C13.7304 9.94104 13.6628 10.1608 13.6203 10.2387L13.5776 10.3167L13.5594 10.4038C13.5319 10.5353 13.3993 10.7284 13.0386 10.9852C12.7567 11.1859 12.4244 11.3661 12.069 11.5588C11.9903 11.6015 11.9105 11.6448 11.8298 11.689C11.4375 11.8768 10.8285 12.1512 10.2592 12.3785C9.97052 12.4938 9.69984 12.5938 9.4767 12.664C9.36507 12.6991 9.27174 12.7247 9.198 12.7411C9.12598 12.7571 9.09285 12.7597 9.08834 12.76L9.08787 13.957C9.31345 13.957 9.59333 13.8815 9.83256 13.8062C10.0953 13.7235 10.3965 13.6116 10.6989 13.4909C11.3045 13.2491 11.9464 12.9594 12.3573 12.7623L12.3721 12.7552L12.3865 12.7473C12.4571 12.7085 12.5313 12.6683 12.6081 12.6268C12.9662 12.433 13.3796 12.2092 13.727 11.9619C14.1167 11.6844 14.5552 11.2894 14.7046 10.735C14.829 10.4701 14.9081 10.1191 14.9518 9.81844C15.0006 9.48332 15.0242 9.08189 14.9649 8.7778L14.9574 8.73927L14.9449 8.70206C14.8126 8.30673 14.4674 7.87368 14.1656 7.54965Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4076 10.4347V8.41995H13.2167V10.4347H14.4076Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,9 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.5">
<path d="M2.38084 5.44737C2.42754 5.92437 2.54311 6.33779 2.72903 6.68417C2.70043 6.72678 2.67414 6.77043 2.64995 6.81463C2.39071 6.9994 2.09192 7.27314 1.83439 7.54965C1.53258 7.87368 1.18745 8.30673 1.05511 8.70206L1.04265 8.73927L1.03513 8.7778C0.975841 9.08189 0.999401 9.48332 1.04817 9.81844C1.09192 10.1191 1.17095 10.4701 1.29544 10.735C1.44476 11.2894 1.88328 11.6844 2.27302 11.9619C2.6204 12.2092 3.03378 12.4329 3.39179 12.6267C3.4686 12.6683 3.54294 12.7085 3.61345 12.7473L3.62786 12.7552L3.64268 12.7623C4.05361 12.9594 4.69547 13.2491 5.30115 13.4909C5.60351 13.6116 5.90465 13.7235 6.16744 13.8062C6.39236 13.877 6.6532 13.948 6.87108 13.9562C7.19351 13.9948 7.54309 14 7.99999 14C8.45688 14 8.80648 13.9948 9.12892 13.9562C9.34679 13.948 9.60764 13.877 9.83256 13.8062C10.0953 13.7235 10.3965 13.6116 10.6989 13.4909C11.0041 13.369 11.3186 13.235 11.6081 13.1067L10.5467 12.2257C9.92791 12.5006 9.61228 12.6334 9.31639 12.7078C9.00201 12.7869 8.69433 12.8031 7.99999 12.8031C7.30564 12.8031 6.99799 12.7869 6.68361 12.7078C6.35125 12.6243 5.99398 12.467 5.21016 12.1174C4.24428 11.6866 3.83266 11.4004 3.6523 11.2153C3.57295 11.1339 3.5474 11.0807 3.53501 11.0478C3.52011 11.0083 3.5122 10.9688 3.4984 10.8761V8.73318C3.49839 8.31081 3.52629 7.91973 3.6034 7.6303C3.60757 7.61463 3.6118 7.59961 3.61607 7.58523C4.02831 7.80894 4.49555 7.89249 4.95638 7.89249C5.07488 7.89249 5.19417 7.88908 5.31358 7.88178L2.38084 5.44737Z" fill="white"/>
<path d="M6.63684 8.9802C6.3355 9.00979 6.1 9.26516 6.1 9.57581V10.8725C6.1 11.203 6.3666 11.471 6.69546 11.471C7.02432 11.471 7.29091 11.203 7.29091 10.8725V9.57581C7.29091 9.55736 7.29008 9.53911 7.28846 9.52109L6.63684 8.9802Z" fill="white"/>
<path d="M8.70909 10.7003V10.8725C8.70909 11.203 8.97568 11.471 9.30454 11.471C9.39795 11.471 9.48633 11.4493 9.56501 11.4108L8.70909 10.7003Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.09436 2.02107C5.38898 1.93962 4.51459 2.09228 3.78849 2.51486L4.71538 3.28426C5.1409 3.1227 5.6004 3.06844 5.96976 3.11109C6.81682 3.2089 7.09721 3.4728 7.21748 3.68905C7.36863 3.96084 7.38386 4.34213 7.35698 4.91278C7.34816 5.1 7.32368 5.26765 7.28592 5.41801L10.1885 7.82737C10.4719 7.87295 10.76 7.89249 11.0436 7.89249C11.5044 7.89249 11.9717 7.80894 12.3839 7.58523C12.3882 7.59961 12.3924 7.61463 12.3966 7.6303C12.4737 7.91973 12.5016 8.31081 12.5016 8.73318V9.74745L14.4065 11.3287C14.5379 11.1547 14.6446 10.9577 14.7046 10.735C14.829 10.4701 14.9081 10.1191 14.9518 9.81844C15.0006 9.48332 15.0242 9.08189 14.9649 8.7778L14.9574 8.73927L14.9449 8.70206C14.8126 8.30673 14.4674 7.87368 14.1656 7.54965C13.9081 7.27314 13.6093 6.9994 13.35 6.81463C13.3259 6.77043 13.2996 6.72678 13.271 6.68417C13.5201 6.21998 13.643 5.63537 13.643 4.93872C13.643 3.80567 13.0326 3.01576 12.2746 2.5525C11.5365 2.10138 10.6316 1.93724 9.90564 2.02107C9.01315 2.12413 8.38516 2.41316 8 2.89841C7.61484 2.41316 6.98685 2.12413 6.09436 2.02107ZM11.7074 3.48996C12.2084 3.79616 12.5513 4.26316 12.5513 4.93872C12.5513 5.75753 12.347 6.19648 12.1134 6.43349C11.8805 6.66983 11.5298 6.79529 11.0436 6.79529C10.3584 6.79529 9.76824 6.65786 9.35452 6.37099C8.96784 6.10286 8.67851 5.66636 8.64302 4.91278C8.61614 4.34213 8.63137 3.96084 8.78252 3.68905C8.90279 3.4728 9.18318 3.2089 10.0302 3.11109C10.5269 3.05374 11.1865 3.17162 11.7074 3.48996Z" fill="white"/>
</g>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.1225 13.809C14.0341 13.9146 13.877 13.9289 13.7711 13.8409L1.1931 3.40021C1.08658 3.31178 1.0722 3.15362 1.16103 3.04743L1.87751 2.19101C1.96587 2.0854 2.12299 2.07112 2.22894 2.15906L14.8069 12.5998C14.9134 12.6882 14.9278 12.8464 14.839 12.9526L14.1225 13.809Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,7 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.5">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.09436 2.02107C5.36842 1.93724 4.46348 2.10138 3.72539 2.5525C2.96744 3.01576 2.35705 3.80567 2.35705 4.93872C2.35705 5.63537 2.47988 6.21998 2.72903 6.68417C2.70043 6.72678 2.67414 6.77043 2.64995 6.81463C2.39071 6.9994 2.09192 7.27314 1.83439 7.54965C1.53258 7.87368 1.18745 8.30673 1.05511 8.70206L1.04265 8.73927L1.03513 8.7778C0.975841 9.08189 0.999401 9.48332 1.04817 9.81844C1.09192 10.1191 1.17095 10.4701 1.29544 10.735C1.44476 11.2894 1.88328 11.6844 2.27302 11.9619C2.6204 12.2092 3.03378 12.4329 3.39179 12.6267C3.4686 12.6683 3.54294 12.7085 3.61345 12.7473L3.62786 12.7552L3.64268 12.7623C4.05361 12.9594 4.69547 13.2491 5.30115 13.4909C5.60351 13.6116 5.90465 13.7235 6.16744 13.8062C6.39236 13.877 6.6532 13.948 6.87108 13.9562C7.19351 13.9948 7.54309 14 7.99999 14C8.01293 14 8.02579 14 8.03857 14C7.97904 13.903 7.99191 13.7743 8.07655 13.6911L9.0197 12.7639C8.77857 12.7952 8.48273 12.8031 7.99999 12.8031C7.30564 12.8031 6.99799 12.7869 6.68361 12.7078C6.35125 12.6243 5.99398 12.467 5.21016 12.1174C4.24428 11.6866 3.83266 11.4004 3.6523 11.2153C3.57295 11.1339 3.5474 11.0807 3.53501 11.0478C3.52011 11.0083 3.5122 10.9688 3.4984 10.8761V8.73318C3.49839 8.31081 3.52629 7.91973 3.6034 7.6303C3.60757 7.61463 3.6118 7.59961 3.61607 7.58523C4.02831 7.80894 4.49555 7.89249 4.95638 7.89249C5.75982 7.89249 6.59976 7.73566 7.26541 7.27411C7.55937 7.07027 7.8077 6.81497 8 6.50734C8.1923 6.81497 8.44063 7.07027 8.73459 7.27411C9.40024 7.73566 10.2402 7.89249 11.0436 7.89249C11.5044 7.89249 11.9717 7.80894 12.3839 7.58523C12.3882 7.59961 12.3924 7.61463 12.3966 7.6303C12.4737 7.91973 12.5016 8.31081 12.5016 8.73318V9.34082L14.1266 7.7433C14.169 7.70159 14.2225 7.67811 14.2775 7.67276C14.2398 7.63028 14.2024 7.58915 14.1656 7.54965C13.9081 7.27314 13.6093 6.9994 13.35 6.81463C13.3259 6.77043 13.2996 6.72678 13.271 6.68417C13.5201 6.21998 13.643 5.63537 13.643 4.93872C13.643 3.80567 13.0326 3.01576 12.2746 2.5525C11.5365 2.10138 10.6316 1.93724 9.90564 2.02107C9.01315 2.12413 8.38516 2.41316 8 2.89841C7.61484 2.41316 6.98685 2.12413 6.09436 2.02107ZM3.44871 4.93872C3.44871 4.26316 3.79162 3.79616 4.2926 3.48996C4.81346 3.17162 5.4731 3.05374 5.96976 3.11109C6.81682 3.2089 7.09721 3.4728 7.21748 3.68905C7.36863 3.96084 7.38386 4.34213 7.35698 4.91278C7.32149 5.66636 7.03216 6.10286 6.64548 6.37099C6.23176 6.65786 5.64158 6.79529 4.95638 6.79529C4.47018 6.79529 4.11948 6.66983 3.88658 6.43349C3.65302 6.19648 3.44871 5.75753 3.44871 4.93872ZM12.5513 4.93872C12.5513 4.26316 12.2084 3.79616 11.7074 3.48996C11.1865 3.17162 10.5269 3.05374 10.0302 3.11109C9.18318 3.2089 8.90279 3.4728 8.78252 3.68905C8.63137 3.96084 8.61614 4.34213 8.64302 4.91278C8.67851 5.66636 8.96784 6.10286 9.35452 6.37099C9.76824 6.65786 10.3584 6.79529 11.0436 6.79529C11.5298 6.79529 11.8805 6.66983 12.1134 6.43349C12.347 6.19648 12.5513 5.75753 12.5513 4.93872Z" fill="white"/>
<path d="M7.29091 9.57581C7.29091 9.24528 7.02432 8.97734 6.69546 8.97734C6.3666 8.97734 6.1 9.24528 6.1 9.57581V10.8725C6.1 11.203 6.3666 11.471 6.69546 11.471C7.02432 11.471 7.29091 11.203 7.29091 10.8725V9.57581Z" fill="white"/>
</g>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6668 14.9102C13.7644 15.0078 13.9227 15.0078 14.0203 14.9102L14.908 14.0224C15.0056 13.9248 15.0056 13.7665 14.908 13.6688L13.2229 11.9836L14.908 10.2983C15.0057 10.2007 15.0057 10.0424 14.908 9.94474L14.0203 9.05695C13.9227 8.95931 13.7644 8.95931 13.6668 9.05695L11.9817 10.7422L10.2966 9.05693C10.199 8.95929 10.0407 8.95929 9.94306 9.05693L9.05535 9.94473C8.95773 10.0424 8.95773 10.2007 9.05535 10.2983L10.7405 11.9836L9.05537 13.6688C8.95775 13.7665 8.95775 13.9248 9.05537 14.0224L9.94308 14.9102C10.0407 15.0079 10.199 15.0079 10.2966 14.9102L11.9817 13.225L13.6668 14.9102Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M3.44872 4.93872C3.44872 4.26316 3.79163 3.79616 4.29261 3.48996C4.81346 3.17162 5.47311 3.05374 5.96976 3.11109C6.81683 3.2089 7.09722 3.4728 7.21749 3.68905C7.36864 3.96084 7.38387 4.34213 7.35699 4.91278C7.3215 5.66636 7.03217 6.10286 6.64549 6.37099C6.23177 6.65786 5.64159 6.79529 4.95639 6.79529C4.47019 6.79529 4.11949 6.66983 3.88658 6.43349C3.65303 6.19648 3.44872 5.75753 3.44872 4.93872ZM6.09437 2.02107C5.36843 1.93724 4.46349 2.10138 3.7254 2.5525C2.96745 3.01576 2.35706 3.80567 2.35706 4.93872C2.35706 5.63537 2.47988 6.21998 2.72904 6.68417C2.70044 6.72678 2.67415 6.77043 2.64996 6.81463C2.39072 6.9994 2.09193 7.27314 1.83439 7.54965C1.53259 7.87368 1.18745 8.30673 1.05511 8.70206L1.04266 8.73927L1.03514 8.7778C0.975849 9.08189 0.999409 9.48332 1.04818 9.81844C1.09193 10.1191 1.17096 10.4701 1.29545 10.735C1.44476 11.2894 1.88329 11.6844 2.27303 11.9619C2.6204 12.2092 3.03379 12.4329 3.3918 12.6267L3.39183 12.6267L3.39185 12.6267L3.39188 12.6268C3.46869 12.6683 3.54295 12.7085 3.61346 12.7473L3.62787 12.7552L3.64269 12.7623C4.05362 12.9594 4.69548 13.2491 5.30115 13.4909C5.60352 13.6116 5.90466 13.7235 6.16745 13.8062C6.39237 13.877 6.65321 13.948 6.87108 13.9562C7.19351 13.9948 7.5431 14 8 14C8.45052 14 8.79672 13.9949 9.11543 13.9578C9.04001 13.6509 9.00001 13.3301 9.00001 13C9.00001 12.9213 9.00229 12.8431 9.00677 12.7656C8.76798 12.7955 8.47414 12.8031 8 12.8031C7.30565 12.8031 6.998 12.7869 6.68362 12.7078C6.35125 12.6243 5.99399 12.467 5.21017 12.1174C4.24429 11.6866 3.83267 11.4004 3.6523 11.2153C3.57296 11.1339 3.54741 11.0807 3.53502 11.0478C3.52011 11.0083 3.51221 10.9688 3.4984 10.8761V8.73318C3.49839 8.31081 3.5263 7.91973 3.6034 7.6303C3.60758 7.61463 3.61181 7.59961 3.61608 7.58523C4.02832 7.80894 4.49556 7.89249 4.95639 7.89249C5.75982 7.89249 6.59977 7.73566 7.26541 7.27411C7.55938 7.07027 7.8077 6.81497 8.00001 6.50734C8.19231 6.81497 8.44064 7.07027 8.7346 7.27411C9.40025 7.73566 10.2402 7.89249 11.0436 7.89249C11.5045 7.89249 11.9717 7.80894 12.3839 7.58523C12.3882 7.59961 12.3924 7.61463 12.3966 7.6303C12.4737 7.91973 12.5016 8.31081 12.5016 8.73318V9.03072C12.6649 9.01043 12.8312 8.99997 13 8.99997C13.7226 8.99997 14.4004 9.19157 14.9855 9.52673C15.0073 9.26739 15.0077 8.99725 14.9649 8.7778L14.9574 8.73927L14.9449 8.70206C14.8126 8.30673 14.4674 7.87368 14.1656 7.54965C13.9081 7.27314 13.6093 6.9994 13.3501 6.81463C13.3259 6.77043 13.2996 6.72678 13.271 6.68417C13.5201 6.21998 13.643 5.63537 13.643 4.93872C13.643 3.80567 13.0326 3.01576 12.2746 2.5525C11.5365 2.10138 10.6316 1.93724 9.90565 2.02107C9.01315 2.12413 8.38517 2.41316 8.00001 2.89841C7.61485 2.41316 6.98686 2.12413 6.09437 2.02107ZM9.9 10.4719V9.57581C9.9 9.24528 9.63341 8.97734 9.30455 8.97734C8.97569 8.97734 8.7091 9.24528 8.7091 9.57581V10.8725C8.7091 11.2024 8.97466 11.4699 9.30265 11.471C9.45294 11.1079 9.65515 10.7718 9.9 10.4719ZM7.29092 9.57581C7.29092 9.24528 7.02433 8.97734 6.69547 8.97734C6.36661 8.97734 6.10001 9.24528 6.10001 9.57581V10.8725C6.10001 11.203 6.36661 11.471 6.69547 11.471C7.02433 11.471 7.29092 11.203 7.29092 10.8725V9.57581ZM12.5513 4.93872C12.5513 4.26316 12.2084 3.79616 11.7074 3.48996C11.1866 3.17162 10.5269 3.05374 10.0303 3.11109C9.18318 3.2089 8.90279 3.4728 8.78253 3.68905C8.63138 3.96084 8.61615 4.34213 8.64303 4.91278C8.67852 5.66636 8.96785 6.10286 9.35453 6.37099C9.76825 6.65786 10.3584 6.79529 11.0436 6.79529C11.5298 6.79529 11.8805 6.66983 12.1134 6.43349C12.347 6.19648 12.5513 5.75753 12.5513 4.93872Z" fill="white"/>
<circle cx="13" cy="13" r="3" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,3 @@
<svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.125 2C3.125 2.62132 2.62132 3.125 2 3.125C1.37868 3.125 0.875 2.62132 0.875 2C0.875 1.37868 1.37868 0.875 2 0.875C2.62132 0.875 3.125 1.37868 3.125 2ZM8.125 2C8.125 2.62132 7.62132 3.125 7 3.125C6.37868 3.125 5.875 2.62132 5.875 2C5.875 1.37868 6.37868 0.875 7 0.875C7.62132 0.875 8.125 1.37868 8.125 2ZM12 3.125C12.6213 3.125 13.125 2.62132 13.125 2C13.125 1.37868 12.6213 0.875 12 0.875C11.3787 0.875 10.875 1.37868 10.875 2C10.875 2.62132 11.3787 3.125 12 3.125Z" fill="#ABB2BF"/>
</svg>

After

Width:  |  Height:  |  Size: 637 B

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9083 3.19699L7.99999 10.3949L0.0916311 3.1969C0.346537 2.49164 1.10447 1.98018 2 1.98018H14C14.8943 1.98018 15.653 2.49168 15.9083 3.19699ZM16 4.7153L12.1526 8.21715L16 11.688V4.7153ZM8.52024 11.5232L11.4199 8.88404L15.9081 12.933C15.6528 13.6378 14.8941 14.1501 14 14.1501H2C1.10461 14.1501 0.346779 13.6378 0.0917535 12.9331L4.58012 8.88404L7.47975 11.5232L7.99999 11.9967L8.52024 11.5232ZM3.84742 8.21715L0 4.71532V11.688L3.84742 8.21715Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 614 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1.24em" height="1em" viewBox="0 0 256 208"><path d="M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.548 17.548 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36Zm-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106.26 106.26 0 0 0-10.24-.544Zm-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408Zm53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408ZM81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32Zm68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32ZM128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32c2.56 0 5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48Z"/></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,3 @@
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 1C0 0.585786 0.335786 0.25 0.75 0.25H7.25C7.66421 0.25 8 0.585786 8 1C8 1.41421 7.66421 1.75 7.25 1.75H1.5V10.25H7.25C7.66421 10.25 8 10.5858 8 11C8 11.4142 7.66421 11.75 7.25 11.75H0.75C0.335786 11.75 0 11.4142 0 11V1ZM8.78148 2.91435C9.10493 2.65559 9.57689 2.70803 9.83565 3.03148L11.8357 5.53148C12.0548 5.80539 12.0548 6.19461 11.8357 6.46852L9.83565 8.96852C9.57689 9.29197 9.10493 9.34441 8.78148 9.08565C8.45803 8.82689 8.40559 8.35493 8.66435 8.03148L9.68953 6.75H3.75C3.33579 6.75 3 6.41421 3 6C3 5.58579 3.33579 5.25 3.75 5.25H9.68953L8.66435 3.96852C8.40559 3.64507 8.45803 3.17311 8.78148 2.91435Z" fill="#ABB2BF"/>
</svg>

After

Width:  |  Height:  |  Size: 784 B

View File

@@ -0,0 +1,5 @@
<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.5 1H7.5H8.75C8.88807 1 9 1.11193 9 1.25V4.5" stroke="#838994" stroke-linecap="round"/>
<path d="M3.64645 5.64645C3.45118 5.84171 3.45118 6.15829 3.64645 6.35355C3.84171 6.54882 4.15829 6.54882 4.35355 6.35355L3.64645 5.64645ZM8.64645 0.646447L3.64645 5.64645L4.35355 6.35355L9.35355 1.35355L8.64645 0.646447Z" fill="#838994"/>
<path d="M7.5 6.5V9C7.5 9.27614 7.27614 9.5 7 9.5H1C0.723858 9.5 0.5 9.27614 0.5 9V3C0.5 2.72386 0.723858 2.5 1 2.5H3.5" stroke="#838994" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 605 B

3
assets/icons/logo_96.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg width="96" height="96" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 6C7.34315 6 6 7.34315 6 9V75H0V9C0 4.02944 4.02944 0 9 0H89.3787C93.3878 0 95.3955 4.84715 92.5607 7.68198L43.0551 57.1875H57V51H63V58.6875C63 61.1728 60.9853 63.1875 58.5 63.1875H37.0551L26.7426 73.5H73.5V36H79.5V73.5C79.5 76.8137 76.8137 79.5 73.5 79.5H20.7426L10.2426 90H87C88.6569 90 90 88.6569 90 87V21H96V87C96 91.9706 91.9706 96 87 96H6.62132C2.61224 96 0.604504 91.1529 3.43934 88.318L52.7574 39H39V45H33V37.5C33 35.0147 35.0147 33 37.5 33H58.7574L69.2574 22.5H22.5V60H16.5V22.5C16.5 19.1863 19.1863 16.5 22.5 16.5H75.2574L85.7574 6H9Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 715 B

View File

@@ -0,0 +1,3 @@
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.6667 0.400196H1.33346C0.819658 0.400196 0.399658 0.820196 0.399658 1.3326V10.6658C0.399658 11.181 0.816998 11.5982 1.33206 11.5982C1.58966 11.5982 1.82206 11.4932 1.99146 11.3238L4.51706 8.79684H10.6639C11.1763 8.79684 11.5963 8.37544 11.5963 7.86304V1.3298C11.5963 0.815996 11.1749 0.395996 10.6625 0.395996L10.6667 0.400196ZM2.2667 2.2664H6.00008V3.1988H2.26628V2.265L2.2667 2.2664ZM7.8667 6.93316H2.2667V5.99936H7.8667V6.93176V6.93316ZM9.7329 5.06556H2.26488V4.13176H9.73164V5.06416L9.7329 5.06556Z" fill="#282C34"/>
</svg>

After

Width:  |  Height:  |  Size: 636 B

View File

@@ -1,3 +1,5 @@
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4.2 6.00001C5.52563 6.00001 6.6 4.92545 6.6 3.60001C6.6 2.27457 5.52563 1.20001 4.2 1.20001C2.87438 1.20001 1.8 2.27457 1.8 3.60001C1.8 4.92545 2.87438 6.00001 4.2 6.00001ZM5.15063 6.90001H3.24938C1.45519 6.90001 0 8.35501 0 10.1494C0 10.5094 0.291 10.8 0.649875 10.8H7.7505C8.10938 10.8 8.4 10.5094 8.4 10.1494C8.4 8.35501 6.945 6.90001 5.15063 6.90001ZM11.55 4.95001H10.65V4.05001C10.65 3.80251 10.4494 3.60001 10.2 3.60001C9.95063 3.60001 9.75 3.80157 9.75 4.05001V4.95001H8.85C8.6025 4.95001 8.4 5.15251 8.4 5.40001C8.4 5.64751 8.60156 5.85001 8.85 5.85001H9.75V6.75001C9.75 6.99939 9.9525 7.20001 10.2 7.20001C10.4475 7.20001 10.65 6.99845 10.65 6.75001V5.85001H11.55C11.7994 5.85001 12 5.64939 12 5.40001C12 5.15064 11.7994 4.95001 11.55 4.95001Z" fill="white"/>
<path d="M5.75062 7.09998H3.24938C1.45519 7.09998 0 8.55498 0 10.3493C0 10.7093 0.291 11 0.649875 11H8.3505C8.70938 11 9 10.7093 9 10.3493C9 8.55498 7.545 7.09998 5.75062 7.09998Z" fill="white"/>
<path d="M7 3.5C7 4.82544 5.82562 6 4.5 6C3.17438 6 2 4.82544 2 3.5C2 2.17456 3.17438 1 4.5 1C5.82562 1 7 2.17456 7 3.5Z" fill="white"/>
<path d="M9.5 3.75V5.5M9.5 7.25V5.5M9.5 5.5H11.25M9.5 5.5H7.75" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 564 B

View File

@@ -1,3 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.9 8.00002C7.44656 8.00002 8.7 6.74637 8.7 5.20002C8.7 3.65368 7.44656 2.40002 5.9 2.40002C4.35344 2.40002 3.1 3.65368 3.1 5.20002C3.1 6.74637 4.35344 8.00002 5.9 8.00002ZM7.00906 9.05002H4.79094C2.69772 9.05002 1 10.7475 1 12.841C1 13.261 1.3395 13.6 1.75819 13.6H10.0422C10.4609 13.6 10.8 13.261 10.8 12.841C10.8 10.7475 9.1025 9.05002 7.00906 9.05002ZM14.475 6.77502H13.425V5.72502C13.425 5.43627 13.1909 5.20002 12.9 5.20002C12.6091 5.20002 12.375 5.43518 12.375 5.72502V6.77502H11.325C11.0363 6.77502 10.8 7.01127 10.8 7.30002C10.8 7.58877 11.0352 7.82502 11.325 7.82502H12.375V8.87502C12.375 9.16596 12.6112 9.40002 12.9 9.40002C13.1887 9.40002 13.425 9.16487 13.425 8.87502V7.82502H14.475C14.7659 7.82502 15 7.59096 15 7.30002C15 7.00909 14.7659 6.77502 14.475 6.77502Z" fill="white"/>
<path d="M7.00906 8.99999H4.79094C2.69772 8.99999 1 11.1475 1 13.2409C1 13.6609 1.3395 14 1.75819 14H10.0422C10.4609 14 10.8 13.6609 10.8 13.2409C10.8 11.1475 9.1025 8.99999 7.00906 8.99999Z" fill="white"/>
<path d="M9 5C9 6.54634 7.44657 7.99998 5.90001 7.99998C4.35344 7.99998 3 6.54634 3 5C3 3.45366 4.45344 2 6 2C7.54656 2 9 3.45366 9 5Z" fill="white"/>
<path d="M13.025 6H14.475C14.7659 6 15 6.20906 15 6.5C15 6.79094 14.7659 7 14.475 7H13V8.49995C13 8.7898 12.7638 9.02495 12.475 9.02495C12.1863 9.02495 11.95 8.79089 11.95 8.49995V7H10.525C10.2352 7 10 6.78875 10 6.5C10 6.21125 10.2362 6 10.525 6H11.975V4.525C11.975 4.23516 12.2091 4 12.5 4C12.7909 4 13.025 4.23625 13.025 4.525V6Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 810 B

View File

@@ -0,0 +1,14 @@
<svg width="93" height="32" viewBox="0 0 93 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.03996 7.04962C8.00936 7.67635 7.30396 8.63219 7.30396 10.0149C7.30396 11.6908 7.72425 12.5893 8.2047 13.0744C8.68381 13.5581 9.40526 13.8149 10.4054 13.8149C11.815 13.8149 13.0291 13.5336 13.8802 12.9464C14.6756 12.3977 15.2708 11.5042 15.3438 9.96182C15.3991 8.79382 15.3678 8.01341 15.0568 7.45711C14.8094 7.01449 14.2326 6.47436 12.4901 6.27416C11.4684 6.15678 10.1114 6.39804 9.03996 7.04962ZM7.87312 5.13084C9.39147 4.2075 11.2531 3.87155 12.7464 4.04312C14.8843 4.28874 16.2844 5.05049 17.0171 6.36142C17.6863 7.55867 17.6384 8.98348 17.587 10.068C17.484 12.2439 16.5804 13.8118 15.1554 14.7949C13.7861 15.7396 12.0582 16.0606 10.4054 16.0606C9.04201 16.0606 7.65128 15.7069 6.60913 14.6547C5.56832 13.6038 5.05825 12.0408 5.05825 10.0149C5.05825 7.6958 6.3139 6.07903 7.87312 5.13084Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.983 18.2811C14.6595 18.2811 15.2079 18.8295 15.2079 19.506V22.16C15.2079 22.8365 14.6595 23.385 13.983 23.385C13.3065 23.385 12.758 22.8365 12.758 22.16V19.506C12.758 18.8295 13.3065 18.2811 13.983 18.2811Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.25566 14.8903C5.48361 14.039 5.99218 12.9059 7.20734 12.5361L7.92068 14.8798C7.92068 14.8798 7.91996 14.8801 7.92068 14.8798L7.92375 14.8785C7.92411 14.8783 7.92375 14.8785 7.92375 14.8785C7.92374 14.8785 7.92322 14.8778 7.92068 14.8798C7.91364 14.8852 7.89133 14.9052 7.85878 14.951C7.78816 15.0505 7.70057 15.2311 7.62216 15.524C7.46354 16.1164 7.40614 16.9168 7.40616 17.7813V22.1675C7.43456 22.3571 7.45082 22.438 7.48148 22.5189C7.50697 22.5862 7.55954 22.695 7.72276 22.8617C8.09379 23.2406 8.94055 23.8264 10.9275 24.7081C12.5399 25.4236 13.2749 25.7456 13.9586 25.9166C14.6053 26.0784 15.2382 26.1115 16.6666 26.1115V28.5613C15.2536 28.5613 14.3395 28.5372 13.3641 28.2932C12.452 28.0651 11.5174 27.6502 10.0614 27.004C10.0193 26.9853 9.97679 26.9664 9.93382 26.9474C7.8976 26.0438 6.68669 25.3053 5.97232 24.5757C5.59284 24.1882 5.34578 23.7967 5.19055 23.387C5.05418 23.0271 5.0055 22.6875 4.97509 22.4754C4.973 22.4608 4.97099 22.4468 4.96905 22.4335L4.95629 22.3458V17.7814C4.95629 17.7814 4.95629 17.7814 4.95629 17.7814C4.95627 16.8606 5.012 15.8003 5.25566 14.8903Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.98306 15.3589C4.62844 14.6695 5.39976 13.9884 5.99652 13.6348L7.24552 15.7424C6.93706 15.9252 6.34938 16.4159 5.77155 17.0332C5.21994 17.6224 4.85695 18.1377 4.73071 18.4254C4.70277 18.6674 4.71195 19.116 4.78977 19.648C4.87834 20.2536 5.01731 20.7033 5.10492 20.8628L5.19261 21.0224L5.23006 21.2007C5.28661 21.4698 5.55952 21.8651 6.30146 22.3907C6.88143 22.8015 7.56502 23.1703 8.29605 23.5648C8.45794 23.6521 8.62215 23.7407 8.78809 23.8313C9.5952 24.2156 10.848 24.7773 12.0191 25.2425C12.613 25.4784 13.1698 25.6831 13.6288 25.8268C13.8584 25.8987 14.0505 25.9512 14.2021 25.9847C14.3503 26.0175 14.4185 26.0227 14.4277 26.0234C14.4288 26.0234 14.4281 26.0234 14.4277 26.0234L14.4287 28.4733C13.9646 28.4733 13.3889 28.3188 12.8968 28.1648C12.3562 27.9955 11.7367 27.7664 11.1147 27.5193C9.86871 27.0244 8.54832 26.4314 7.70298 26.028L7.67249 26.0135L7.64284 25.9973C7.49779 25.918 7.34502 25.8357 7.18702 25.7506C6.4505 25.354 5.60004 24.896 4.88539 24.3898C4.08363 23.8219 3.18153 23.0135 2.87437 21.8785C2.61828 21.3365 2.4557 20.618 2.3657 20.0026C2.26537 19.3167 2.2169 18.4951 2.33888 17.8727L2.35434 17.7938L2.37996 17.7176C2.6522 16.9085 3.36219 16.0221 3.98306 15.3589Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.48531 21.264V17.1402H5.93518V21.264H3.48531Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.2932 7.04962C25.3238 7.67635 26.0292 8.63219 26.0292 10.0149C26.0292 11.6908 25.609 12.5893 25.1285 13.0744C24.6494 13.5581 23.9279 13.8149 22.9278 13.8149C21.5182 13.8149 20.3041 13.5336 19.453 12.9464C18.6576 12.3977 18.0624 11.5042 17.9894 9.96182C17.9341 8.79382 17.9654 8.01341 18.2764 7.45711C18.5238 7.01449 19.1006 6.47436 20.8431 6.27416C21.8648 6.15678 23.2218 6.39804 24.2932 7.04962ZM25.4601 5.13084C23.9417 4.2075 22.0801 3.87155 20.5868 4.04312C18.4489 4.28874 17.0488 5.05049 16.3161 6.36142C15.6469 7.55867 15.6948 8.98348 15.7462 10.068C15.8492 12.2439 16.7528 13.8118 18.1778 14.7949C19.5471 15.7396 21.275 16.0606 22.9278 16.0606C24.2912 16.0606 25.6819 15.7069 26.7241 14.6547C27.7649 13.6038 28.275 12.0408 28.275 10.0149C28.275 7.6958 27.0193 6.07903 25.4601 5.13084Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.3502 18.2811C18.6737 18.2811 18.1253 18.8295 18.1253 19.506V22.16C18.1253 22.8365 18.6737 23.385 19.3502 23.385C20.0267 23.385 20.5752 22.8365 20.5752 22.16V19.506C20.5752 18.8295 20.0267 18.2811 19.3502 18.2811Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.0775 14.8903C27.8496 14.039 27.341 12.9059 26.1259 12.5361L25.4125 14.8798C25.4125 14.8798 25.4132 14.8801 25.4125 14.8798L25.4095 14.8785C25.4091 14.8783 25.4095 14.8785 25.4095 14.8785C25.4095 14.8785 25.41 14.8778 25.4125 14.8798C25.4196 14.8852 25.4419 14.9052 25.4744 14.951C25.545 15.0505 25.6326 15.2311 25.711 15.524C25.8697 16.1164 25.9271 16.9168 25.927 17.7813V22.1675C25.8986 22.3571 25.8824 22.438 25.8517 22.5189C25.8262 22.5862 25.7737 22.695 25.6104 22.8617C25.2394 23.2406 24.3927 23.8264 22.4057 24.7081C20.7933 25.4236 20.0583 25.7456 19.3746 25.9166C18.7279 26.0784 18.0949 26.1115 16.6666 26.1115V28.5613C18.0796 28.5613 18.9937 28.5372 19.9691 28.2932C20.8812 28.0651 21.8158 27.6502 23.2718 27.004C23.3139 26.9853 23.3564 26.9664 23.3994 26.9474C25.4356 26.0438 26.6465 25.3053 27.3609 24.5757C27.7404 24.1882 27.9874 23.7967 28.1427 23.387C28.279 23.0271 28.3277 22.6875 28.3581 22.4754C28.3602 22.4608 28.3622 22.4468 28.3642 22.4335L28.3769 22.3458V17.7814C28.3769 17.7814 28.3769 17.7814 28.3769 17.7814C28.3769 16.8606 28.3212 15.8003 28.0775 14.8903Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.3501 15.3589C28.7048 14.6695 27.9334 13.9884 27.3367 13.6348L26.0877 15.7424C26.3961 15.9252 26.9838 16.4159 27.5616 17.0332C28.1133 17.6224 28.4763 18.1377 28.6025 18.4254C28.6304 18.6674 28.6213 19.116 28.5434 19.648C28.4549 20.2536 28.3159 20.7033 28.2283 20.8628L28.1406 21.0224L28.1031 21.2007C28.0466 21.4698 27.7737 21.8651 27.0317 22.3907C26.4518 22.8015 25.7682 23.1703 25.0372 23.5648C24.8753 23.6521 24.711 23.7407 24.5451 23.8313C23.738 24.2156 22.4852 24.7773 21.3141 25.2425C20.7202 25.4784 20.1634 25.6831 19.7044 25.8268C19.4748 25.8987 19.2827 25.9512 19.1311 25.9847C18.9829 26.0175 18.9147 26.0227 18.9055 26.0234C18.9044 26.0234 18.9051 26.0234 18.9055 26.0234L18.9045 28.4733C19.3686 28.4733 19.9443 28.3188 20.4364 28.1648C20.977 27.9955 21.5965 27.7664 22.2185 27.5193C23.4645 27.0244 24.7849 26.4314 25.6302 26.028L25.6607 26.0135L25.6904 25.9973C25.8354 25.918 25.9882 25.8357 26.1462 25.7506C26.8827 25.354 27.7332 24.896 28.4478 24.3898C29.2496 23.8219 30.1517 23.0135 30.4588 21.8785C30.7149 21.3365 30.8775 20.618 30.9675 20.0026C31.0678 19.3167 31.1163 18.4951 30.9943 17.8727L30.9789 17.7938L30.9532 17.7176C30.681 16.9085 29.971 16.0221 29.3501 15.3589Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.8479 21.264V17.1402H27.398V21.264H29.8479Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.6666 11C49.2189 11 49.6666 11.4477 49.6666 12V15H52.6666C53.2189 15 53.6666 15.4477 53.6666 16C53.6666 16.5523 53.2189 17 52.6666 17H49.6666V20C49.6666 20.5523 49.2189 21 48.6666 21C48.1143 21 47.6666 20.5523 47.6666 20V17H44.6666C44.1143 17 43.6666 16.5523 43.6666 16C43.6666 15.4477 44.1143 15 44.6666 15H47.6666V12C47.6666 11.4477 48.1143 11 48.6666 11Z" fill="white" fill-opacity="0.5"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M67.1666 4.33329C66.7064 4.33329 66.3333 4.70639 66.3333 5.16663V23.5H64.6666V5.16663C64.6666 3.78591 65.7859 2.66663 67.1666 2.66663H89.494C90.6077 2.66663 91.1654 4.01306 90.3779 4.80051L76.6264 18.552H80.5V16.8333H82.1666V18.9687C82.1666 19.6591 81.607 20.2187 80.9166 20.2187H74.9597L72.0951 23.0833H85.0833V12.6666H86.75V23.0833C86.75 24.0038 86.0038 24.75 85.0833 24.75H70.4285L67.5118 27.6666H88.8333C89.2935 27.6666 89.6666 27.2935 89.6666 26.8333V8.49996H91.3333V26.8333C91.3333 28.214 90.214 29.3333 88.8333 29.3333H66.5059C65.3922 29.3333 64.8345 27.9869 65.622 27.1994L79.3214 13.5H75.5V15.1666H73.8333V13.0833C73.8333 12.3929 74.3929 11.8333 75.0833 11.8333H80.9881L83.9048 8.91663H70.9166V19.3333H69.25V8.91663C69.25 7.99615 69.9962 7.24996 70.9166 7.24996H85.5714L88.4881 4.33329H67.1666Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 8.5 KiB

68
assets/keymaps/atom.json Normal file
View File

@@ -0,0 +1,68 @@
[
{
"bindings": {
"cmd-k cmd-p": "workspace::ActivatePreviousPane",
"cmd-k cmd-n": "workspace::ActivateNextPane"
}
},
{
"context": "Editor",
"bindings": {
"cmd-b": "editor::GoToDefinition",
"cmd-<": "editor::ScrollCursorCenter",
"cmd-g": [
"editor::SelectNext",
{
"replace_newest": true
}
],
"ctrl-shift-down": "editor::AddSelectionBelow",
"ctrl-shift-up": "editor::AddSelectionAbove",
"cmd-shift-backspace": "editor::DeleteToBeginningOfLine"
}
},
{
"context": "Editor && mode == full",
"bindings": {
"cmd-r": "outline::Toggle"
}
},
{
"context": "BufferSearchBar",
"bindings": {
"cmd-f3": "search::SelectNextMatch",
"cmd-shift-f3": "search::SelectPrevMatch"
}
},
{
"context": "Workspace",
"bindings": {
"cmd-\\": "workspace::ToggleLeftSidebar",
"cmd-k cmd-b": "workspace::ToggleLeftSidebar",
"cmd-t": "file_finder::Toggle",
"cmd-shift-r": "project_symbols::Toggle"
}
},
{
"context": "Pane",
"bindings": {
"alt-cmd-/": "search::ToggleRegex",
"ctrl-0": "project_panel::ToggleFocus"
}
},
{
"context": "ProjectPanel",
"bindings": {
"ctrl-[": "project_panel::CollapseSelectedEntry",
"ctrl-b": "project_panel::CollapseSelectedEntry",
"alt-b": "project_panel::CollapseSelectedEntry",
"ctrl-]": "project_panel::ExpandSelectedEntry",
"ctrl-f": "project_panel::ExpandSelectedEntry",
"ctrl-shift-c": "project_panel::CopyPath"
}
},
{
"context": "Dock",
"bindings": {}
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,78 @@
[
{
"bindings": {
"cmd-shift-[": "pane::ActivatePrevItem",
"cmd-shift-]": "pane::ActivateNextItem"
}
},
{
"context": "Editor",
"bindings": {
"ctrl->": "zed::IncreaseBufferFontSize",
"ctrl-<": "zed::DecreaseBufferFontSize",
"cmd-d": "editor::DuplicateLine",
"cmd-pagedown": "editor::MovePageDown",
"cmd-pageup": "editor::MovePageUp",
"ctrl-alt-shift-b": "editor::SelectToPreviousWordStart",
"shift-enter": "editor::NewlineBelow",
"cmd--": "editor::Fold",
"cmd-=": "editor::UnfoldLines",
"alt-shift-g": "editor::SplitSelectionIntoLines",
"ctrl-g": [
"editor::SelectNext",
{
"replace_newest": false
}
],
"cmd-/": [
"editor::ToggleComments",
{
"advance_downwards": true
}
],
"shift-alt-up": "editor::MoveLineUp",
"shift-alt-down": "editor::MoveLineDown",
"cmd-[": "pane::GoBack",
"cmd-]": "pane::GoForward",
"alt-f7": "editor::FindAllReferences",
"cmd-alt-f7": "editor::FindAllReferences",
"cmd-b": "editor::GoToDefinition",
"cmd-alt-b": "editor::GoToDefinition",
"cmd-shift-b": "editor::GoToTypeDefinition",
"alt-enter": "editor::ToggleCodeActions",
"f2": "editor::GoToDiagnostic",
"cmd-f2": "editor::GoToPrevDiagnostic",
"ctrl-alt-shift-down": "editor::GoToHunk",
"ctrl-alt-shift-up": "editor::GoToPrevHunk",
"cmd-home": "editor::MoveToBeginning",
"cmd-end": "editor::MoveToEnd",
"cmd-shift-home": "editor::SelectToBeginning",
"cmd-shift-end": "editor::SelectToEnd"
}
},
{
"context": "Editor && mode == full",
"bindings": {
"cmd-f12": "outline::Toggle",
"cmd-7": "outline::Toggle",
"cmd-shift-o": "file_finder::Toggle",
"cmd-l": "go_to_line::Toggle"
}
},
{
"context": "Workspace",
"bindings": {
"cmd-shift-a": "command_palette::Toggle",
"cmd-alt-o": "project_symbols::Toggle",
"cmd-1": "workspace::ToggleLeftSidebar",
"cmd-6": "diagnostics::Deploy",
"alt-f12": "dock::FocusDock"
}
},
{
"context": "Dock",
"bindings": {
"alt-f12": "dock::HideDock"
}
}
]

View File

@@ -0,0 +1,60 @@
[
{
"bindings": {
"cmd-shift-[": "pane::ActivatePrevItem",
"cmd-shift-]": "pane::ActivateNextItem",
"ctrl-pagedown": "pane::ActivatePrevItem",
"ctrl-pageup": "pane::ActivateNextItem",
"ctrl-shift-tab": "pane::ActivateNextItem",
"ctrl-tab": "pane::ActivatePrevItem",
"cmd-+": "zed::IncreaseBufferFontSize"
}
},
{
"context": "Editor",
"bindings": {
"ctrl-shift-up": "editor::AddSelectionAbove",
"ctrl-shift-down": "editor::AddSelectionBelow",
"cmd-shift-space": "editor::SelectAll",
"ctrl-shift-m": "editor::SelectLargerSyntaxNode",
"cmd-shift-a": "editor::SelectLargerSyntaxNode",
"shift-f12": "editor::FindAllReferences",
"alt-cmd-down": "editor::GoToDefinition",
"alt-shift-cmd-down": "editor::FindAllReferences",
"ctrl-.": "editor::GoToHunk",
"ctrl-,": "editor::GoToPrevHunk",
"ctrl-backspace": "editor::DeleteToPreviousWordStart",
"ctrl-delete": "editor::DeleteToNextWordEnd"
}
},
{
"context": "Editor && mode == full",
"bindings": {
"cmd-r": "outline::Toggle"
}
},
{
"context": "Pane",
"bindings": {
"f4": "search::SelectNextMatch",
"shift-f4": "search::SelectPrevMatch"
}
},
{
"context": "Workspace",
"bindings": {
"ctrl-`": "dock::FocusDock",
"cmd-k cmd-b": "workspace::ToggleLeftSidebar",
"cmd-t": "file_finder::Toggle",
"shift-cmd-r": "project_symbols::Toggle",
// Currently busted: https://github.com/zed-industries/feedback/issues/898
"ctrl-0": "project_panel::ToggleFocus"
}
},
{
"context": "Dock",
"bindings": {
"ctrl-`": "dock::HideDock"
}
}
]

View File

@@ -0,0 +1,90 @@
[
{
"bindings": {
"cmd-shift-o": "projects::OpenRecent",
"cmd-alt-tab": "project_panel::ToggleFocus"
}
},
{
"context": "Editor",
"bindings": {
"cmd-l": "go_to_line::Toggle",
"ctrl-shift-d": "editor::DuplicateLine",
"cmd-b": "editor::GoToDefinition",
"cmd-j": "editor::ScrollCursorCenter",
"cmd-enter": "editor::NewlineBelow",
"cmd-shift-l": "editor::SelectLine",
"cmd-shift-t": "outline::Toggle",
"alt-backspace": "editor::DeleteToPreviousWordStart",
"alt-shift-backspace": "editor::DeleteToNextWordEnd",
"alt-delete": "editor::DeleteToNextWordEnd",
"alt-shift-delete": "editor::DeleteToNextWordEnd",
"ctrl-backspace": "editor::DeleteToPreviousSubwordStart",
"ctrl-delete": "editor::DeleteToNextSubwordEnd",
"alt-left": [
"editor::MoveToPreviousWordStart",
{
"stop_at_soft_wraps": true
}
],
"alt-right": [
"editor::MoveToNextWordEnd",
{
"stop_at_soft_wraps": true
}
],
"ctrl-left": "editor::MoveToPreviousSubwordStart",
"ctrl-right": "editor::MoveToNextSubwordEnd",
"cmd-shift-left": "editor::SelectToBeginningOfLine",
"cmd-shift-right": "editor::SelectToEndOfLine",
"alt-shift-left": [
"editor::SelectToBeginningOfLine",
{
"stop_at_soft_wraps": true
}
],
"alt-shift-right": [
"editor::SelectToEndOfLine",
{
"stop_at_soft_wraps": true
}
],
"ctrl-shift-left": "editor::SelectToPreviousSubwordStart",
"ctrl-shift-right": "editor::SelectToNextSubwordEnd"
}
},
{
"context": "Editor && mode == full",
"bindings": {}
},
{
"context": "BufferSearchBar",
"bindings": {
"ctrl-s": "search::SelectNextMatch",
"ctrl-shift-s": "search::SelectPrevMatch"
}
},
{
"context": "Workspace",
"bindings": {
"cmd-alt-ctrl-d": "workspace::ToggleLeftSidebar",
"cmd-t": "file_finder::Toggle",
"cmd-shift-t": "project_symbols::Toggle"
}
},
{
"context": "Pane",
"bindings": {
"alt-cmd-r": "search::ToggleRegex",
"ctrl-tab": "project_panel::ToggleFocus"
}
},
{
"context": "ProjectPanel",
"bindings": {}
},
{
"context": "Dock",
"bindings": {}
}
]

View File

@@ -1,323 +1,325 @@
[
{
"context": "Editor && VimControl && !VimWaiting",
"bindings": {
"g": [
"vim::PushOperator",
{
"Namespace": "G"
}
],
"i": [
"vim::PushOperator",
{
"Object": {
"around": false
}
}
],
"a": [
"vim::PushOperator",
{
"Object": {
"around": true
}
}
],
"h": "vim::Left",
"backspace": "vim::Backspace",
"j": "vim::Down",
"k": "vim::Up",
"l": "vim::Right",
"$": "vim::EndOfLine",
"shift-g": "vim::EndOfDocument",
"w": "vim::NextWordStart",
"shift-w": [
"vim::NextWordStart",
{
"ignorePunctuation": true
}
],
"e": "vim::NextWordEnd",
"shift-e": [
"vim::NextWordEnd",
{
"ignorePunctuation": true
}
],
"b": "vim::PreviousWordStart",
"shift-b": [
"vim::PreviousWordStart",
{
"ignorePunctuation": true
}
],
"%": "vim::Matching",
"ctrl-y": [
"vim::Scroll",
"LineUp"
],
"f": [
"vim::PushOperator",
{
"FindForward": {
"before": false
}
}
],
"t": [
"vim::PushOperator",
{
"FindForward": {
"before": true
}
}
],
"shift-f": [
"vim::PushOperator",
{
"FindBackward": {
"after": false
}
}
],
"shift-t": [
"vim::PushOperator",
{
"FindBackward": {
"after": true
}
}
],
"escape": "editor::Cancel",
"0": "vim::StartOfLine", // When no number operator present, use start of line motion
"1": [
"vim::Number",
1
],
"2": [
"vim::Number",
2
],
"3": [
"vim::Number",
3
],
"4": [
"vim::Number",
4
],
"5": [
"vim::Number",
5
],
"6": [
"vim::Number",
6
],
"7": [
"vim::Number",
7
],
"8": [
"vim::Number",
8
],
"9": [
"vim::Number",
9
]
{
"context": "Editor && VimControl && !VimWaiting",
"bindings": {
"g": [
"vim::PushOperator",
{
"Namespace": "G"
}
},
{
"context": "Editor && vim_mode == normal && vim_operator == none && !VimWaiting",
"bindings": {
"c": [
"vim::PushOperator",
"Change"
],
"shift-c": "vim::ChangeToEndOfLine",
"d": [
"vim::PushOperator",
"Delete"
],
"shift-d": "vim::DeleteToEndOfLine",
"y": [
"vim::PushOperator",
"Yank"
],
"z": [
"vim::PushOperator",
{
"Namespace": "Z"
}
],
"i": [
"vim::SwitchMode",
"Insert"
],
"shift-i": "vim::InsertFirstNonWhitespace",
"a": "vim::InsertAfter",
"shift-a": "vim::InsertEndOfLine",
"x": "vim::DeleteRight",
"shift-x": "vim::DeleteLeft",
"^": "vim::FirstNonWhitespace",
"o": "vim::InsertLineBelow",
"shift-o": "vim::InsertLineAbove",
"v": [
"vim::SwitchMode",
{
"Visual": {
"line": false
}
}
],
"shift-v": [
"vim::SwitchMode",
{
"Visual": {
"line": true
}
}
],
"p": "vim::Paste",
"u": "editor::Undo",
"ctrl-r": "editor::Redo",
"ctrl-o": "pane::GoBack",
"/": [
"buffer_search::Deploy",
{
"focus": true
}
],
"ctrl-f": [
"vim::Scroll",
"PageDown"
],
"ctrl-b": [
"vim::Scroll",
"PageUp"
],
"ctrl-d": [
"vim::Scroll",
"HalfPageDown"
],
"ctrl-u": [
"vim::Scroll",
"HalfPageUp"
],
"ctrl-e": [
"vim::Scroll",
"LineDown"
],
"r": [
"vim::PushOperator",
"Replace"
]
],
"i": [
"vim::PushOperator",
{
"Object": {
"around": false
}
}
},
{
"context": "Editor && vim_operator == n",
"bindings": {
"0": [
"vim::Number",
0
]
],
"a": [
"vim::PushOperator",
{
"Object": {
"around": true
}
}
},
{
"context": "Editor && vim_operator == g",
"bindings": {
"g": "vim::StartOfDocument",
"h": "editor::Hover",
"escape": [
"vim::SwitchMode",
"Normal"
]
],
"h": "vim::Left",
"backspace": "vim::Backspace",
"j": "vim::Down",
"enter": "vim::NextLineStart",
"k": "vim::Up",
"l": "vim::Right",
"$": "vim::EndOfLine",
"shift-g": "vim::EndOfDocument",
"w": "vim::NextWordStart",
"shift-w": [
"vim::NextWordStart",
{
"ignorePunctuation": true
}
},
{
"context": "Editor && vim_operator == c",
"bindings": {
"c": "vim::CurrentLine"
],
"e": "vim::NextWordEnd",
"shift-e": [
"vim::NextWordEnd",
{
"ignorePunctuation": true
}
},
{
"context": "Editor && vim_operator == d",
"bindings": {
"d": "vim::CurrentLine"
],
"b": "vim::PreviousWordStart",
"shift-b": [
"vim::PreviousWordStart",
{
"ignorePunctuation": true
}
},
{
"context": "Editor && vim_operator == y",
"bindings": {
"y": "vim::CurrentLine"
],
"%": "vim::Matching",
"ctrl-y": [
"vim::Scroll",
"LineUp"
],
"f": [
"vim::PushOperator",
{
"FindForward": {
"before": false
}
}
},
{
"context": "Editor && vim_operator == z",
"bindings": {
"t": "editor::ScrollCursorTop",
"z": "editor::ScrollCursorCenter",
"b": "editor::ScrollCursorBottom",
"escape": [
"vim::SwitchMode",
"Normal"
]
],
"t": [
"vim::PushOperator",
{
"FindForward": {
"before": true
}
}
},
{
"context": "Editor && VimObject",
"bindings": {
"w": "vim::Word",
"shift-w": [
"vim::Word",
{
"ignorePunctuation": true
}
],
"s": "vim::Sentence",
"'": "vim::Quotes",
"`": "vim::BackQuotes",
"\"": "vim::DoubleQuotes",
"(": "vim::Parentheses",
")": "vim::Parentheses",
"[": "vim::SquareBrackets",
"]": "vim::SquareBrackets",
"{": "vim::CurlyBrackets",
"}": "vim::CurlyBrackets",
"<": "vim::AngleBrackets",
">": "vim::AngleBrackets"
],
"shift-f": [
"vim::PushOperator",
{
"FindBackward": {
"after": false
}
}
},
{
"context": "Editor && vim_mode == visual && !VimWaiting",
"bindings": {
"u": "editor::Undo",
"c": "vim::VisualChange",
"d": "vim::VisualDelete",
"x": "vim::VisualDelete",
"y": "vim::VisualYank",
"p": "vim::VisualPaste",
"r": [
"vim::PushOperator",
"Replace"
]
}
},
{
"context": "Editor && vim_mode == insert",
"bindings": {
"escape": "vim::NormalBefore",
"ctrl-c": "vim::NormalBefore"
}
},
{
"context": "Editor && VimWaiting",
"bindings": {
"tab": "vim::Tab",
"enter": "vim::Enter",
"escape": "editor::Cancel"
],
"shift-t": [
"vim::PushOperator",
{
"FindBackward": {
"after": true
}
}
],
"escape": "editor::Cancel",
"0": "vim::StartOfLine", // When no number operator present, use start of line motion
"1": [
"vim::Number",
1
],
"2": [
"vim::Number",
2
],
"3": [
"vim::Number",
3
],
"4": [
"vim::Number",
4
],
"5": [
"vim::Number",
5
],
"6": [
"vim::Number",
6
],
"7": [
"vim::Number",
7
],
"8": [
"vim::Number",
8
],
"9": [
"vim::Number",
9
]
}
]
},
{
"context": "Editor && vim_mode == normal && vim_operator == none && !VimWaiting",
"bindings": {
"c": [
"vim::PushOperator",
"Change"
],
"shift-c": "vim::ChangeToEndOfLine",
"d": [
"vim::PushOperator",
"Delete"
],
"shift-d": "vim::DeleteToEndOfLine",
"y": [
"vim::PushOperator",
"Yank"
],
"z": [
"vim::PushOperator",
{
"Namespace": "Z"
}
],
"i": [
"vim::SwitchMode",
"Insert"
],
"shift-i": "vim::InsertFirstNonWhitespace",
"a": "vim::InsertAfter",
"shift-a": "vim::InsertEndOfLine",
"x": "vim::DeleteRight",
"shift-x": "vim::DeleteLeft",
"^": "vim::FirstNonWhitespace",
"o": "vim::InsertLineBelow",
"shift-o": "vim::InsertLineAbove",
"v": [
"vim::SwitchMode",
{
"Visual": {
"line": false
}
}
],
"shift-v": [
"vim::SwitchMode",
{
"Visual": {
"line": true
}
}
],
"p": "vim::Paste",
"u": "editor::Undo",
"ctrl-r": "editor::Redo",
"ctrl-o": "pane::GoBack",
"/": [
"buffer_search::Deploy",
{
"focus": true
}
],
"ctrl-f": [
"vim::Scroll",
"PageDown"
],
"ctrl-b": [
"vim::Scroll",
"PageUp"
],
"ctrl-d": [
"vim::Scroll",
"HalfPageDown"
],
"ctrl-u": [
"vim::Scroll",
"HalfPageUp"
],
"ctrl-e": [
"vim::Scroll",
"LineDown"
],
"r": [
"vim::PushOperator",
"Replace"
]
}
},
{
"context": "Editor && vim_operator == n",
"bindings": {
"0": [
"vim::Number",
0
]
}
},
{
"context": "Editor && vim_operator == g",
"bindings": {
"g": "vim::StartOfDocument",
"h": "editor::Hover",
"escape": [
"vim::SwitchMode",
"Normal"
],
"d": "editor::GoToDefinition"
}
},
{
"context": "Editor && vim_operator == c",
"bindings": {
"c": "vim::CurrentLine"
}
},
{
"context": "Editor && vim_operator == d",
"bindings": {
"d": "vim::CurrentLine"
}
},
{
"context": "Editor && vim_operator == y",
"bindings": {
"y": "vim::CurrentLine"
}
},
{
"context": "Editor && vim_operator == z",
"bindings": {
"t": "editor::ScrollCursorTop",
"z": "editor::ScrollCursorCenter",
"b": "editor::ScrollCursorBottom",
"escape": [
"vim::SwitchMode",
"Normal"
]
}
},
{
"context": "Editor && VimObject",
"bindings": {
"w": "vim::Word",
"shift-w": [
"vim::Word",
{
"ignorePunctuation": true
}
],
"s": "vim::Sentence",
"'": "vim::Quotes",
"`": "vim::BackQuotes",
"\"": "vim::DoubleQuotes",
"(": "vim::Parentheses",
")": "vim::Parentheses",
"[": "vim::SquareBrackets",
"]": "vim::SquareBrackets",
"{": "vim::CurlyBrackets",
"}": "vim::CurlyBrackets",
"<": "vim::AngleBrackets",
">": "vim::AngleBrackets"
}
},
{
"context": "Editor && vim_mode == visual && !VimWaiting",
"bindings": {
"u": "editor::Undo",
"c": "vim::VisualChange",
"d": "vim::VisualDelete",
"x": "vim::VisualDelete",
"y": "vim::VisualYank",
"p": "vim::VisualPaste",
"r": [
"vim::PushOperator",
"Replace"
]
}
},
{
"context": "Editor && vim_mode == insert",
"bindings": {
"escape": "vim::NormalBefore",
"ctrl-c": "vim::NormalBefore"
}
},
{
"context": "Editor && VimWaiting",
"bindings": {
"tab": "vim::Tab",
"enter": "vim::Enter",
"escape": "editor::Cancel"
}
}
]

View File

@@ -1,249 +1,257 @@
{
// The name of the Zed theme to use for the UI
"theme": "One Dark",
// The name of a font to use for rendering text in the editor
"buffer_font_family": "Zed Mono",
// The default font size for text in the editor
"buffer_font_size": 15,
// The factor to grow the active pane by. Defaults to 1.0
// which gives the same size as all other panes.
"active_pane_magnification": 1.0,
// Whether to enable vim modes and key bindings
"vim_mode": false,
// Whether to show the informational hover box when moving the mouse
// over symbols in the editor.
"hover_popover_enabled": true,
// Whether to confirm before quitting Zed.
"confirm_quit": false,
// Whether the cursor blinks in the editor.
"cursor_blink": true,
// Whether to pop the completions menu while typing in an editor without
// explicitly requesting it.
"show_completions_on_input": true,
// Whether the screen sharing icon is showed in the os status bar.
"show_call_status_icon": true,
// Whether new projects should start out 'online'. Online projects
// appear in the contacts panel under your name, so that your contacts
// can see which projects you are working on. Regardless of this
// setting, projects keep their last online status when you reopen them.
"projects_online_by_default": true,
// Whether to use language servers to provide code intelligence.
"enable_language_server": true,
// When to automatically save edited buffers. This setting can
// take four values.
//
// 1. Never automatically save:
// "autosave": "off",
// 2. Save when changing focus away from the Zed window:
// "autosave": "on_window_change",
// 3. Save when changing focus away from a specific buffer:
// "autosave": "on_focus_change",
// 4. Save when idle for a certain amount of time:
// "autosave": { "after_delay": {"milliseconds": 500} },
"autosave": "off",
// Where to place the dock by default. This setting can take three
// values:
//
// 1. Position the dock attached to the bottom of the workspace
// "default_dock_anchor": "bottom"
// 2. Position the dock to the right of the workspace like a side panel
// "default_dock_anchor": "right"
// 3. Position the dock full screen over the entire workspace"
// "default_dock_anchor": "expanded"
"default_dock_anchor": "right",
// Whether or not to perform a buffer format before saving
"format_on_save": "on",
// How to perform a buffer format. This setting can take two values:
//
// 1. Format code using the current language server:
// "format_on_save": "language_server"
// 2. Format code using an external command:
// "format_on_save": {
// "external": {
// "command": "prettier",
// "arguments": ["--stdin-filepath", "{buffer_path}"]
// }
// The name of the Zed theme to use for the UI
"theme": "One Dark",
// Features that can be globally enabled or disabled
"features": {
// Show Copilot icon in status bar
"copilot": true
},
// The name of a font to use for rendering text in the editor
"buffer_font_family": "Zed Mono",
// The OpenType features to enable for text in the editor.
"buffer_font_features": {
// Disable ligatures:
// "calt": false
},
// The default font size for text in the editor
"buffer_font_size": 15,
// The factor to grow the active pane by. Defaults to 1.0
// which gives the same size as all other panes.
"active_pane_magnification": 1.0,
// Whether to enable vim modes and key bindings
"vim_mode": false,
// Whether to show the informational hover box when moving the mouse
// over symbols in the editor.
"hover_popover_enabled": true,
// Whether to confirm before quitting Zed.
"confirm_quit": false,
// Whether the cursor blinks in the editor.
"cursor_blink": true,
// Whether to pop the completions menu while typing in an editor without
// explicitly requesting it.
"show_completions_on_input": true,
// Controls whether copilot provides suggestion immediately
// or waits for a `copilot::Toggle`
"show_copilot_suggestions": true,
// Whether the screen sharing icon is shown in the os status bar.
"show_call_status_icon": true,
// Whether to use language servers to provide code intelligence.
"enable_language_server": true,
// When to automatically save edited buffers. This setting can
// take four values.
//
// 1. Never automatically save:
// "autosave": "off",
// 2. Save when changing focus away from the Zed window:
// "autosave": "on_window_change",
// 3. Save when changing focus away from a specific buffer:
// "autosave": "on_focus_change",
// 4. Save when idle for a certain amount of time:
// "autosave": { "after_delay": {"milliseconds": 500} },
"autosave": "off",
// Where to place the dock by default. This setting can take three
// values:
//
// 1. Position the dock attached to the bottom of the workspace
// "default_dock_anchor": "bottom"
// 2. Position the dock to the right of the workspace like a side panel
// "default_dock_anchor": "right"
// 3. Position the dock full screen over the entire workspace"
// "default_dock_anchor": "expanded"
"default_dock_anchor": "bottom",
// Whether or not to remove any trailing whitespace from lines of a buffer
// before saving it.
"remove_trailing_whitespace_on_save": true,
// Whether or not to ensure there's a single newline at the end of a buffer
// when saving it.
"ensure_final_newline_on_save": true,
// Whether or not to perform a buffer format before saving
"format_on_save": "on",
// How to perform a buffer format. This setting can take two values:
//
// 1. Format code using the current language server:
// "format_on_save": "language_server"
// 2. Format code using an external command:
// "format_on_save": {
// "external": {
// "command": "prettier",
// "arguments": ["--stdin-filepath", "{buffer_path}"]
// }
// }
"formatter": "language_server",
// How to soft-wrap long lines of text. This setting can take
// three values:
//
// 1. Do not soft wrap.
// "soft_wrap": "none",
// 2. Soft wrap lines that overflow the editor:
// "soft_wrap": "editor_width",
// 3. Soft wrap lines at the preferred line length
// "soft_wrap": "preferred_line_length",
"soft_wrap": "none",
// The column at which to soft-wrap lines, for buffers where soft-wrap
// is enabled.
"preferred_line_length": 80,
// Whether to indent lines using tab characters, as opposed to multiple
// spaces.
"hard_tabs": false,
// How many columns a tab should occupy.
"tab_size": 4,
// Control what info is collected by Zed.
"telemetry": {
// Send debug info like crash reports.
"diagnostics": true,
// Send anonymized usage data like what languages you're using Zed with.
"metrics": true
},
// Automatically update Zed
"auto_update": true,
// Git gutter behavior configuration.
"git": {
// Control whether the git gutter is shown. May take 2 values:
// 1. Show the gutter
// "git_gutter": "tracked_files"
// 2. Hide the gutter
// "git_gutter": "hide"
"git_gutter": "tracked_files"
},
// Settings specific to journaling
"journal": {
// The path of the directory where journal entries are stored
"path": "~",
// What format to display the hours in
// May take 2 values:
// 1. hour12
// 2. hour24
"hour_format": "hour12"
},
// Settings specific to the terminal
"terminal": {
// What shell to use when opening a terminal. May take 3 values:
// 1. Use the system's default terminal configuration in /etc/passwd
// "shell": "system"
// 2. A program:
// "shell": {
// "program": "sh"
// }
// 3. A program with arguments:
// "shell": {
// "with_arguments": {
// "program": "/bin/bash",
// "arguments": ["--login"]
// }
// }
"formatter": "language_server",
// How to soft-wrap long lines of text. This setting can take
// three values:
"shell": "system",
// What working directory to use when launching the terminal.
// May take 4 values:
// 1. Use the current file's project directory. Will Fallback to the
// first project directory strategy if unsuccessful
// "working_directory": "current_project_directory"
// 2. Use the first project in this workspace's directory
// "working_directory": "first_project_directory"
// 3. Always use this platform's home directory (if we can find it)
// "working_directory": "always_home"
// 4. Always use a specific directory. This value will be shell expanded.
// If this path is not a valid directory the terminal will default to
// this platform's home directory (if we can find it)
// "working_directory": {
// "always": {
// "directory": "~/zed/projects/"
// }
// }
//
// 1. Do not soft wrap.
// "soft_wrap": "none",
// 2. Soft wrap lines that overflow the editor:
// "soft_wrap": "editor_width",
// 3. Soft wrap lines at the preferred line length
// "soft_wrap": "preferred_line_length",
"soft_wrap": "none",
// The column at which to soft-wrap lines, for buffers where soft-wrap
// is enabled.
"preferred_line_length": 80,
// Whether to indent lines using tab characters, as opposed to multiple
// spaces.
"hard_tabs": false,
// How many columns a tab should occupy.
"tab_size": 4,
// Control what info Zed sends to our servers
"telemetry": {
// Send debug info like crash reports.
"diagnostics": true,
// Send anonymized usage data like what languages you're using Zed with.
"metrics": true
},
// Automatically update Zed
"auto_update": true,
// Git gutter behavior configuration.
"git": {
// Control whether the git gutter is shown. May take 2 values:
// 1. Show the gutter
// "git_gutter": "tracked_files"
// 2. Hide the gutter
// "git_gutter": "hide"
"git_gutter": "tracked_files"
},
// Settings specific to journaling
"journal": {
// The path of the directory where journal entries are stored
"path": "~",
// What format to display the hours in
// May take 2 values:
// 1. hour12
// 2. hour24
"hour_format": "hour12"
},
// Settings specific to the terminal
"terminal": {
// What shell to use when opening a terminal. May take 3 values:
// 1. Use the system's default terminal configuration (e.g. $TERM).
// "shell": "system"
// 2. A program:
// "shell": {
// "program": "sh"
// }
// 3. A program with arguments:
// "shell": {
// "with_arguments": {
// "program": "/bin/bash",
// "arguments": ["--login"]
// }
// }
"shell": "system",
// What working directory to use when launching the terminal.
// May take 4 values:
// 1. Use the current file's project directory. Will Fallback to the
// first project directory strategy if unsuccessful
// "working_directory": "current_project_directory"
// 2. Use the first project in this workspace's directory
// "working_directory": "first_project_directory"
// 3. Always use this platform's home directory (if we can find it)
// "working_directory": "always_home"
// 4. Always use a specific directory. This value will be shell expanded.
// If this path is not a valid directory the terminal will default to
// this platform's home directory (if we can find it)
// "working_directory": {
// "always": {
// "directory": "~/zed/projects/"
// }
// }
//
//
"working_directory": "current_project_directory",
// Set the cursor blinking behavior in the terminal.
// May take 4 values:
// 1. Never blink the cursor, ignoring the terminal mode
// "blinking": "off",
// 2. Default the cursor blink to off, but allow the terminal to
// set blinking
// "blinking": "terminal_controlled",
// 3. Always blink the cursor, ignoring the terminal mode
// "blinking": "on",
"blinking": "terminal_controlled",
// Set whether Alternate Scroll mode (code: ?1007) is active by default.
// Alternate Scroll mode converts mouse scroll events into up / down key
// presses when in the alternate screen (e.g. when running applications
// like vim or less). The terminal can still set and unset this mode.
// May take 2 values:
// 1. Default alternate scroll mode to on
// "alternate_scroll": "on",
// 2. Default alternate scroll mode to off
// "alternate_scroll": "off",
"alternate_scroll": "off",
// Set whether the option key behaves as the meta key.
// May take 2 values:
// 1. Rely on default platform handling of option key, on macOS
// this means generating certain unicode characters
// "option_to_meta": false,
// 2. Make the option keys behave as a 'meta' key, e.g. for emacs
// "option_to_meta": true,
"option_as_meta": false,
// Whether or not selecting text in the terminal will automatically
// copy to the system clipboard.
"copy_on_select": false,
// Any key-value pairs added to this list will be added to the terminal's
// enviroment. Use `:` to seperate multiple values.
"env": {
// "KEY": "value1:value2"
}
// Set the terminal's font size. If this option is not included,
// the terminal will default to matching the buffer's font size.
// "font_size": "15"
// Set the terminal's font family. If this option is not included,
// the terminal will default to matching the buffer's font family.
// "font_family": "Zed Mono"
},
// Different settings for specific languages.
"languages": {
"Plain Text": {
"soft_wrap": "preferred_line_length"
},
"C": {
"tab_size": 2
},
"C++": {
"tab_size": 2
},
"Elixir": {
"tab_size": 2
},
"Go": {
"tab_size": 4,
"hard_tabs": true
},
"Markdown": {
"soft_wrap": "preferred_line_length"
},
"Rust": {
"tab_size": 4
},
"JavaScript": {
"tab_size": 2
},
"TypeScript": {
"tab_size": 2
},
"TSX": {
"tab_size": 2
},
"Yaml": {
"tab_size": 2
}
},
// LSP Specific settings.
"lsp": {
// Specify the LSP name as a key here.
// As of 8/10/22, supported LSPs are:
// pyright
// gopls
// rust-analyzer
// typescript-language-server
// vscode-json-languageserver
// "rust-analyzer": {
// //These initialization options are merged into Zed's defaults
// "initialization_options": {
// "checkOnSave": {
// "command": "clippy"
// }
// }
// }
//
"working_directory": "current_project_directory",
// Set the cursor blinking behavior in the terminal.
// May take 4 values:
// 1. Never blink the cursor, ignoring the terminal mode
// "blinking": "off",
// 2. Default the cursor blink to off, but allow the terminal to
// set blinking
// "blinking": "terminal_controlled",
// 3. Always blink the cursor, ignoring the terminal mode
// "blinking": "on",
"blinking": "terminal_controlled",
// Set whether Alternate Scroll mode (code: ?1007) is active by default.
// Alternate Scroll mode converts mouse scroll events into up / down key
// presses when in the alternate screen (e.g. when running applications
// like vim or less). The terminal can still set and unset this mode.
// May take 2 values:
// 1. Default alternate scroll mode to on
// "alternate_scroll": "on",
// 2. Default alternate scroll mode to off
// "alternate_scroll": "off",
"alternate_scroll": "off",
// Set whether the option key behaves as the meta key.
// May take 2 values:
// 1. Rely on default platform handling of option key, on macOS
// this means generating certain unicode characters
// "option_to_meta": false,
// 2. Make the option keys behave as a 'meta' key, e.g. for emacs
// "option_to_meta": true,
"option_as_meta": false,
// Whether or not selecting text in the terminal will automatically
// copy to the system clipboard.
"copy_on_select": false,
// Any key-value pairs added to this list will be added to the terminal's
// enviroment. Use `:` to seperate multiple values.
"env": {
// "KEY": "value1:value2"
}
// Set the terminal's font size. If this option is not included,
// the terminal will default to matching the buffer's font size.
// "font_size": "15"
// Set the terminal's font family. If this option is not included,
// the terminal will default to matching the buffer's font family.
// "font_family": "Zed Mono"
},
// Different settings for specific languages.
"languages": {
"Plain Text": {
"soft_wrap": "preferred_line_length"
},
"Elixir": {
"tab_size": 2
},
"Go": {
"tab_size": 4,
"hard_tabs": true
},
"Markdown": {
"soft_wrap": "preferred_line_length"
},
"JavaScript": {
"tab_size": 2
},
"TypeScript": {
"tab_size": 2
},
"TSX": {
"tab_size": 2
},
"YAML": {
"tab_size": 2
},
"JSON": {
"tab_size": 2
}
},
// LSP Specific settings.
"lsp": {
// Specify the LSP name as a key here.
// As of 8/10/22, supported LSPs are:
// pyright
// gopls
// rust-analyzer
// typescript-language-server
// vscode-json-languageserver
// "rust-analyzer": {
// //These initialization options are merged into Zed's defaults
// "initialization_options": {
// "checkOnSave": {
// "command": "clippy"
// }
// }
// }
}
}

View File

@@ -7,5 +7,5 @@
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
"buffer_font_size": 15
"buffer_font_size": 15
}

View File

@@ -18,4 +18,4 @@ settings = { path = "../settings" }
util = { path = "../util" }
workspace = { path = "../workspace" }
futures = "0.3"
smallvec = { version = "1.6", features = ["union"] }
smallvec = { workspace = true }

View File

@@ -2,8 +2,10 @@ use auto_update::{AutoUpdateStatus, AutoUpdater, DismissErrorMessage};
use editor::Editor;
use futures::StreamExt;
use gpui::{
actions, elements::*, platform::CursorStyle, Action, AppContext, Entity, ModelHandle,
MouseButton, MutableAppContext, RenderContext, View, ViewContext, ViewHandle,
actions,
elements::*,
platform::{CursorStyle, MouseButton},
Action, AppContext, Entity, ModelHandle, RenderContext, View, ViewContext, ViewHandle,
};
use language::{LanguageRegistry, LanguageServerBinaryStatus};
use project::{LanguageServerProgress, Project};
@@ -33,7 +35,20 @@ struct LspStatus {
status: LanguageServerBinaryStatus,
}
pub fn init(cx: &mut MutableAppContext) {
struct PendingWork<'a> {
language_server_name: &'a str,
progress_token: &'a str,
progress: &'a LanguageServerProgress,
}
#[derive(Default)]
struct Content {
icon: Option<&'static str>,
message: String,
action: Option<Box<dyn Action>>,
}
pub fn init(cx: &mut AppContext) {
cx.add_action(ActivityIndicator::show_error_message);
cx.add_action(ActivityIndicator::dismiss_error_message);
}
@@ -69,6 +84,8 @@ impl ActivityIndicator {
if let Some(auto_updater) = auto_updater.as_ref() {
cx.observe(auto_updater, |_, _, cx| cx.notify()).detach();
}
cx.observe_active_labeled_tasks(|_, cx| cx.notify())
.detach();
Self {
statuses: Default::default(),
@@ -130,7 +147,7 @@ impl ActivityIndicator {
fn pending_language_server_work<'a>(
&self,
cx: &'a AppContext,
) -> impl Iterator<Item = (&'a str, &'a str, &'a LanguageServerProgress)> {
) -> impl Iterator<Item = PendingWork<'a>> {
self.project
.read(cx)
.language_server_statuses()
@@ -142,23 +159,29 @@ impl ActivityIndicator {
let mut pending_work = status
.pending_work
.iter()
.map(|(token, progress)| (status.name.as_str(), token.as_str(), progress))
.map(|(token, progress)| PendingWork {
language_server_name: status.name.as_str(),
progress_token: token.as_str(),
progress,
})
.collect::<SmallVec<[_; 4]>>();
pending_work.sort_by_key(|(_, _, progress)| Reverse(progress.last_update_at));
pending_work.sort_by_key(|work| Reverse(work.progress.last_update_at));
Some(pending_work)
}
})
.flatten()
}
fn content_to_render(
&mut self,
cx: &mut RenderContext<Self>,
) -> (Option<&'static str>, String, Option<Box<dyn Action>>) {
fn content_to_render(&mut self, cx: &mut RenderContext<Self>) -> Content {
// Show any language server has pending activity.
let mut pending_work = self.pending_language_server_work(cx);
if let Some((lang_server_name, progress_token, progress)) = pending_work.next() {
let mut message = lang_server_name.to_string();
if let Some(PendingWork {
language_server_name,
progress_token,
progress,
}) = pending_work.next()
{
let mut message = language_server_name.to_string();
message.push_str(": ");
if let Some(progress_message) = progress.message.as_ref() {
@@ -176,7 +199,11 @@ impl ActivityIndicator {
write!(&mut message, " + {} more", additional_work_count).unwrap();
}
return (None, message, None);
return Content {
icon: None,
message,
action: None,
};
}
// Show any language server installation info.
@@ -199,19 +226,19 @@ impl ActivityIndicator {
}
if !downloading.is_empty() {
return (
Some(DOWNLOAD_ICON),
format!(
return Content {
icon: Some(DOWNLOAD_ICON),
message: format!(
"Downloading {} language server{}...",
downloading.join(", "),
if downloading.len() > 1 { "s" } else { "" }
),
None,
);
action: None,
};
} else if !checking_for_update.is_empty() {
return (
Some(DOWNLOAD_ICON),
format!(
return Content {
icon: Some(DOWNLOAD_ICON),
message: format!(
"Checking for updates to {} language server{}...",
checking_for_update.join(", "),
if checking_for_update.len() > 1 {
@@ -220,49 +247,61 @@ impl ActivityIndicator {
""
}
),
None,
);
action: None,
};
} else if !failed.is_empty() {
return (
Some(WARNING_ICON),
format!(
return Content {
icon: Some(WARNING_ICON),
message: format!(
"Failed to download {} language server{}. Click to show error.",
failed.join(", "),
if failed.len() > 1 { "s" } else { "" }
),
Some(Box::new(ShowErrorMessage)),
);
action: Some(Box::new(ShowErrorMessage)),
};
}
// Show any application auto-update info.
if let Some(updater) = &self.auto_updater {
match &updater.read(cx).status() {
AutoUpdateStatus::Checking => (
Some(DOWNLOAD_ICON),
"Checking for Zed updates…".to_string(),
None,
),
AutoUpdateStatus::Downloading => (
Some(DOWNLOAD_ICON),
"Downloading Zed update…".to_string(),
None,
),
AutoUpdateStatus::Installing => (
Some(DOWNLOAD_ICON),
"Installing Zed update…".to_string(),
None,
),
AutoUpdateStatus::Updated => (None, "Restart to update Zed".to_string(), None),
AutoUpdateStatus::Errored => (
Some(WARNING_ICON),
"Auto update failed".to_string(),
Some(Box::new(DismissErrorMessage)),
),
return match &updater.read(cx).status() {
AutoUpdateStatus::Checking => Content {
icon: Some(DOWNLOAD_ICON),
message: "Checking for Zed updates…".to_string(),
action: None,
},
AutoUpdateStatus::Downloading => Content {
icon: Some(DOWNLOAD_ICON),
message: "Downloading Zed update…".to_string(),
action: None,
},
AutoUpdateStatus::Installing => Content {
icon: Some(DOWNLOAD_ICON),
message: "Installing Zed update…".to_string(),
action: None,
},
AutoUpdateStatus::Updated => Content {
icon: None,
message: "Click to restart and update Zed".to_string(),
action: Some(Box::new(workspace::Restart)),
},
AutoUpdateStatus::Errored => Content {
icon: Some(WARNING_ICON),
message: "Auto update failed".to_string(),
action: Some(Box::new(DismissErrorMessage)),
},
AutoUpdateStatus::Idle => Default::default(),
}
} else {
Default::default()
};
}
if let Some(most_recent_active_task) = cx.active_labeled_tasks().last() {
return Content {
icon: None,
message: most_recent_active_task.to_string(),
action: None,
};
}
Default::default()
}
}
@@ -276,7 +315,11 @@ impl View for ActivityIndicator {
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
let (icon, message, action) = self.content_to_render(cx);
let Content {
icon,
message,
action,
} = self.content_to_render(cx);
let mut element = MouseEventHandler::<Self>::new(0, cx, |state, cx| {
let theme = &cx

View File

@@ -22,7 +22,8 @@ anyhow = "1.0.38"
isahc = "1.7"
lazy_static = "1.4"
log = "0.4"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }
smol = "1.2.5"
tempdir = "0.3.7"

View File

@@ -1,12 +1,11 @@
mod update_notification;
use anyhow::{anyhow, Context, Result};
use client::{http::HttpClient, ZED_SECRET_CLIENT_TOKEN};
use client::{ZED_APP_PATH, ZED_APP_VERSION};
use client::{ZED_APP_PATH, ZED_APP_VERSION, ZED_SECRET_CLIENT_TOKEN};
use db::kvp::KEY_VALUE_STORE;
use gpui::{
actions, platform::AppVersion, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle,
MutableAppContext, Task, WeakViewHandle,
Task, WeakViewHandle,
};
use serde::Deserialize;
use settings::Settings;
@@ -14,6 +13,7 @@ use smol::{fs::File, io::AsyncReadExt, process::Command};
use std::{ffi::OsString, sync::Arc, time::Duration};
use update_notification::UpdateNotification;
use util::channel::ReleaseChannel;
use util::http::HttpClient;
use workspace::Workspace;
const SHOULD_SHOW_UPDATE_NOTIFICATION_KEY: &str = "auto-updater-should-show-updated-notification";
@@ -49,7 +49,7 @@ impl Entity for AutoUpdater {
type Event = ();
}
pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut MutableAppContext) {
pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut AppContext) {
if let Some(version) = (*ZED_APP_VERSION).or_else(|| cx.platform().app_version().ok()) {
let server_url = server_url;
let auto_updater = cx.add_model(|cx| {
@@ -63,10 +63,10 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut Mutab
cx.observe_global::<Settings, _>(move |updater, cx| {
if cx.global::<Settings>().auto_update {
if update_subscription.is_none() {
*(&mut update_subscription) = Some(updater.start_polling(cx))
update_subscription = Some(updater.start_polling(cx))
}
} else {
(&mut update_subscription).take();
update_subscription.take();
}
})
.detach();
@@ -95,7 +95,7 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut Mutab
pub fn notify_of_any_new_update(
workspace: WeakViewHandle<Workspace>,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> Option<()> {
let updater = AutoUpdater::get(cx)?;
let version = updater.read(cx).current_version;
@@ -124,7 +124,7 @@ pub fn notify_of_any_new_update(
}
impl AutoUpdater {
pub fn get(cx: &mut MutableAppContext) -> Option<ModelHandle<Self>> {
pub fn get(cx: &mut AppContext) -> Option<ModelHandle<Self>> {
cx.default_global::<Option<ModelHandle<Self>>>().clone()
}

View File

@@ -1,8 +1,8 @@
use crate::ViewReleaseNotes;
use gpui::{
elements::{Flex, MouseEventHandler, Padding, ParentElement, Svg, Text},
platform::{AppVersion, CursorStyle},
Element, Entity, MouseButton, View, ViewContext,
platform::{AppVersion, CursorStyle, MouseButton},
Element, Entity, View, ViewContext,
};
use menu::Cancel;
use settings::Settings;
@@ -78,7 +78,7 @@ impl View for UpdateNotification {
)
.with_child({
let style = theme.action_message.style_for(state, false);
Text::new("View the release notes".to_string(), style.text.clone())
Text::new("View the release notes", style.text.clone())
.contained()
.with_style(style.container)
.boxed()

View File

@@ -18,6 +18,7 @@ search = { path = "../search" }
settings = { path = "../settings" }
theme = { path = "../theme" }
workspace = { path = "../workspace" }
outline = { path = "../outline" }
itertools = "0.10"
[dev-dependencies]

View File

@@ -1,5 +1,6 @@
use gpui::{
elements::*, AppContext, Entity, RenderContext, Subscription, View, ViewContext, ViewHandle,
elements::*, platform::MouseButton, AppContext, Entity, RenderContext, Subscription, View,
ViewContext, ViewHandle,
};
use itertools::Itertools;
use search::ProjectSearchView;
@@ -14,6 +15,7 @@ pub enum Event {
}
pub struct Breadcrumbs {
pane_focused: bool,
active_item: Option<Box<dyn ItemHandle>>,
project_search: Option<ViewHandle<ProjectSearchView>>,
subscription: Option<Subscription>,
@@ -22,6 +24,7 @@ pub struct Breadcrumbs {
impl Breadcrumbs {
pub fn new() -> Self {
Self {
pane_focused: false,
active_item: Default::default(),
subscription: Default::default(),
project_search: Default::default(),
@@ -39,24 +42,53 @@ impl View for Breadcrumbs {
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
let active_item = match &self.active_item {
Some(active_item) => active_item,
None => return Empty::new().boxed(),
};
let not_editor = active_item.downcast::<editor::Editor>().is_none();
let theme = cx.global::<Settings>().theme.clone();
if let Some(breadcrumbs) = self
.active_item
.as_ref()
.and_then(|item| item.breadcrumbs(&theme, cx))
{
Flex::row()
.with_children(Itertools::intersperse_with(breadcrumbs.into_iter(), || {
Label::new("".to_string(), theme.breadcrumbs.text.clone()).boxed()
}))
.contained()
.with_style(theme.breadcrumbs.container)
let style = &theme.workspace.breadcrumbs;
let breadcrumbs = match active_item.breadcrumbs(&theme, cx) {
Some(breadcrumbs) => breadcrumbs,
None => return Empty::new().boxed(),
};
let crumbs = Flex::row()
.with_children(Itertools::intersperse_with(breadcrumbs.into_iter(), || {
Label::new("", style.default.text.clone()).boxed()
}))
.constrained()
.with_height(theme.workspace.breadcrumb_height)
.contained();
if not_editor || !self.pane_focused {
return crumbs
.with_style(style.default.container)
.aligned()
.left()
.boxed()
} else {
Empty::new().boxed()
.boxed();
}
MouseEventHandler::<Breadcrumbs>::new(0, cx, |state, _| {
let style = style.style_for(state, false);
crumbs.with_style(style.container).boxed()
})
.on_click(MouseButton::Left, |_, cx| {
cx.dispatch_action(outline::Toggle);
})
.with_tooltip::<Breadcrumbs, _>(
0,
"Show symbol outline".to_owned(),
Some(Box::new(outline::Toggle)),
theme.tooltip.clone(),
cx,
)
.aligned()
.left()
.boxed()
}
}
@@ -103,4 +135,8 @@ impl ToolbarItemView for Breadcrumbs {
current_location
}
}
fn pane_focus_update(&mut self, pane_focused: bool, _: &mut gpui::AppContext) {
self.pane_focused = pane_focused;
}
}

View File

@@ -34,7 +34,7 @@ util = { path = "../util" }
anyhow = "1.0.38"
async-broadcast = "0.4"
futures = "0.3"
postage = { version = "0.4.1", features = ["futures-traits"] }
postage = { workspace = true }
[dev-dependencies]
client = { path = "../client", features = ["test-support"] }

View File

@@ -10,15 +10,15 @@ use futures::{future::Shared, FutureExt};
use postage::watch;
use gpui::{
AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext,
Subscription, Task, WeakModelHandle,
AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Subscription, Task,
WeakModelHandle,
};
use project::Project;
pub use participant::ParticipantLocation;
pub use room::Room;
pub fn init(client: Arc<Client>, user_store: ModelHandle<UserStore>, cx: &mut MutableAppContext) {
pub fn init(client: Arc<Client>, user_store: ModelHandle<UserStore>, cx: &mut AppContext) {
let active_call = cx.add_model(|cx| ActiveCall::new(client, user_store, cx));
cx.set_global(active_call);
}
@@ -264,12 +264,13 @@ impl ActiveCall {
Ok(())
}
pub fn hang_up(&mut self, cx: &mut ModelContext<Self>) -> Result<()> {
pub fn hang_up(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
cx.notify();
if let Some((room, _)) = self.room.take() {
room.update(cx, |room, cx| room.leave(cx))?;
cx.notify();
room.update(cx, |room, cx| room.leave(cx))
} else {
Task::ready(Ok(()))
}
Ok(())
}
pub fn share_project(
@@ -284,6 +285,18 @@ impl ActiveCall {
}
}
pub fn unshare_project(
&mut self,
project: ModelHandle<Project>,
cx: &mut ModelContext<Self>,
) -> Result<()> {
if let Some((room, _)) = self.room.as_ref() {
room.update(cx, |room, cx| room.unshare_project(project, cx))
} else {
Err(anyhow!("no active call"))
}
}
pub fn set_location(
&mut self,
project: Option<&ModelHandle<Project>>,

View File

@@ -10,17 +10,15 @@ use client::{
use collections::{BTreeMap, HashMap, HashSet};
use fs::Fs;
use futures::{FutureExt, StreamExt};
use gpui::{
AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext, Task, WeakModelHandle,
};
use gpui::{AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task, WeakModelHandle};
use language::LanguageRegistry;
use live_kit_client::{LocalTrackPublication, LocalVideoTrack, RemoteVideoTrackUpdate};
use postage::stream::Stream;
use project::Project;
use std::{mem, sync::Arc, time::Duration};
use std::{future::Future, mem, pin::Pin, sync::Arc, time::Duration};
use util::{post_inc, ResultExt, TryFutureExt};
pub const RECONNECT_TIMEOUT: Duration = client::RECEIVE_TIMEOUT;
pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30);
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Event {
@@ -55,6 +53,7 @@ pub struct Room {
leave_when_empty: bool,
client: Arc<Client>,
user_store: ModelHandle<UserStore>,
follows_by_leader_id_project_id: HashMap<(PeerId, u64), Vec<PeerId>>,
subscriptions: Vec<client::Subscription>,
pending_room_update: Option<Task<()>>,
maintain_connection: Option<Task<Option<()>>>,
@@ -63,10 +62,24 @@ pub struct Room {
impl Entity for Room {
type Event = Event;
fn release(&mut self, _: &mut MutableAppContext) {
fn release(&mut self, cx: &mut AppContext) {
if self.status.is_online() {
log::info!("room was released, sending leave message");
let _ = self.client.send(proto::LeaveRoom {});
self.leave_internal(cx).detach_and_log_err(cx);
}
}
fn app_will_quit(&mut self, cx: &mut AppContext) -> Option<Pin<Box<dyn Future<Output = ()>>>> {
if self.status.is_online() {
let leave = self.leave_internal(cx);
Some(
cx.background()
.spawn(async move {
leave.await.log_err();
})
.boxed(),
)
} else {
None
}
}
}
@@ -148,6 +161,7 @@ impl Room {
pending_room_update: None,
client,
user_store,
follows_by_leader_id_project_id: Default::default(),
maintain_connection: Some(maintain_connection),
}
}
@@ -157,7 +171,7 @@ impl Room {
initial_project: Option<ModelHandle<Project>>,
client: Arc<Client>,
user_store: ModelHandle<UserStore>,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> Task<Result<ModelHandle<Self>>> {
cx.spawn(|mut cx| async move {
let response = client.request(proto::CreateRoom {}).await?;
@@ -200,7 +214,7 @@ impl Room {
call: &IncomingCall,
client: Arc<Client>,
user_store: ModelHandle<UserStore>,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> Task<Result<ModelHandle<Self>>> {
let room_id = call.room_id;
cx.spawn(|mut cx| async move {
@@ -232,13 +246,17 @@ impl Room {
&& self.pending_call_count == 0
}
pub(crate) fn leave(&mut self, cx: &mut ModelContext<Self>) -> Result<()> {
if self.status.is_offline() {
return Err(anyhow!("room is offline"));
}
pub(crate) fn leave(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
cx.notify();
cx.emit(Event::Left);
self.leave_internal(cx)
}
fn leave_internal(&mut self, cx: &mut AppContext) -> Task<Result<()>> {
if self.status.is_offline() {
return Task::ready(Err(anyhow!("room is offline")));
}
log::info!("leaving room");
for project in self.shared_projects.drain() {
@@ -252,6 +270,7 @@ impl Room {
if let Some(project) = project.upgrade(cx) {
project.update(cx, |project, cx| {
project.disconnected_from_host(cx);
project.close(cx);
});
}
}
@@ -264,8 +283,12 @@ impl Room {
self.live_kit.take();
self.pending_room_update.take();
self.maintain_connection.take();
self.client.send(proto::LeaveRoom {})?;
Ok(())
let leave_room = self.client.request(proto::LeaveRoom {});
cx.background().spawn(async move {
leave_room.await?;
anyhow::Ok(())
})
}
async fn maintain_connection(
@@ -275,14 +298,12 @@ impl Room {
) -> Result<()> {
let mut client_status = client.status();
loop {
let is_connected = client_status
.next()
.await
.map_or(false, |s| s.is_connected());
let _ = client_status.try_recv();
let is_connected = client_status.borrow().is_connected();
// Even if we're initially connected, any future change of the status means we momentarily disconnected.
if !is_connected || client_status.next().await.is_some() {
log::info!("detected client disconnection");
this.upgrade(&cx)
.ok_or_else(|| anyhow!("room was dropped"))?
.update(&mut cx, |this, cx| {
@@ -296,12 +317,7 @@ impl Room {
let client_reconnection = async {
let mut remaining_attempts = 3;
while remaining_attempts > 0 {
log::info!(
"waiting for client status change, remaining attempts {}",
remaining_attempts
);
let Some(status) = client_status.next().await else { break };
if status.is_connected() {
if client_status.borrow().is_connected() {
log::info!("client reconnected, attempting to rejoin room");
let Some(this) = this.upgrade(&cx) else { break };
@@ -315,7 +331,15 @@ impl Room {
} else {
remaining_attempts -= 1;
}
} else if client_status.borrow().is_signed_out() {
return false;
}
log::info!(
"waiting for client status change, remaining attempts {}",
remaining_attempts
);
client_status.next().await;
}
false
}
@@ -337,18 +361,20 @@ impl Room {
}
}
// The client failed to re-establish a connection to the server
// or an error occurred while trying to re-join the room. Either way
// we leave the room and return an error.
if let Some(this) = this.upgrade(&cx) {
log::info!("reconnection failed, leaving room");
let _ = this.update(&mut cx, |this, cx| this.leave(cx));
}
return Err(anyhow!(
"can't reconnect to room: client failed to re-establish connection"
));
break;
}
}
// The client failed to re-establish a connection to the server
// or an error occurred while trying to re-join the room. Either way
// we leave the room and return an error.
if let Some(this) = this.upgrade(&cx) {
log::info!("reconnection failed, leaving room");
let _ = this.update(&mut cx, |this, cx| this.leave(cx));
}
Err(anyhow!(
"can't reconnect to room: client failed to re-establish connection"
))
}
fn rejoin(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
@@ -393,7 +419,7 @@ impl Room {
false
});
let response = self.client.request(proto::RejoinRoom {
let response = self.client.request_envelope(proto::RejoinRoom {
id: self.id,
reshared_projects,
rejoined_projects,
@@ -401,6 +427,8 @@ impl Room {
cx.spawn(|this, mut cx| async move {
let response = response.await?;
let message_id = response.message_id;
let response = response.payload;
let room_proto = response.room.ok_or_else(|| anyhow!("invalid room"))?;
this.update(&mut cx, |this, cx| {
this.status = RoomStatus::Online;
@@ -417,7 +445,7 @@ impl Room {
for rejoined_project in response.rejoined_projects {
if let Some(project) = projects.get(&rejoined_project.id) {
project.update(cx, |project, cx| {
project.rejoined(rejoined_project, cx).log_err();
project.rejoined(rejoined_project, message_id, cx).log_err();
});
}
}
@@ -457,6 +485,12 @@ impl Room {
self.participant_user_ids.contains(&user_id)
}
pub fn followers_for(&self, leader_id: PeerId, project_id: u64) -> &[PeerId] {
self.follows_by_leader_id_project_id
.get(&(leader_id, project_id))
.map_or(&[], |v| v.as_slice())
}
async fn handle_room_updated(
this: ModelHandle<Self>,
envelope: TypedEnvelope<proto::RoomUpdated>,
@@ -487,11 +521,13 @@ impl Room {
.iter()
.map(|p| p.user_id)
.collect::<Vec<_>>();
let remote_participant_user_ids = room
.participants
.iter()
.map(|p| p.user_id)
.collect::<Vec<_>>();
let (remote_participants, pending_participants) =
self.user_store.update(cx, move |user_store, cx| {
(
@@ -499,6 +535,7 @@ impl Room {
user_store.get_users(pending_participant_user_ids, cx),
)
});
self.pending_room_update = Some(cx.spawn(|this, mut cx| async move {
let (remote_participants, pending_participants) =
futures::join!(remote_participants, pending_participants);
@@ -587,7 +624,7 @@ impl Room {
if let Some(live_kit) = this.live_kit.as_ref() {
let tracks =
live_kit.room.remote_video_tracks(&peer_id.to_string());
live_kit.room.remote_video_tracks(&user.id.to_string());
for track in tracks {
this.remote_video_track_updated(
RemoteVideoTrackUpdate::Subscribed(track),
@@ -620,6 +657,27 @@ impl Room {
}
}
this.follows_by_leader_id_project_id.clear();
for follower in room.followers {
let project_id = follower.project_id;
let (leader, follower) = match (follower.leader_id, follower.follower_id) {
(Some(leader), Some(follower)) => (leader, follower),
_ => {
log::error!("Follower message {follower:?} missing some state");
continue;
}
};
let list = this
.follows_by_leader_id_project_id
.entry((leader, project_id))
.or_insert(Vec::new());
if !list.contains(&follower) {
list.push(follower);
}
}
this.pending_room_update.take();
if this.should_leave() {
log::info!("room is empty, leaving");
@@ -723,10 +781,10 @@ impl Room {
this.update(&mut cx, |this, cx| {
this.pending_call_count -= 1;
if this.should_leave() {
this.leave(cx)?;
this.leave(cx).detach_and_log_err(cx);
}
result
})?;
});
result?;
Ok(())
})
}
@@ -793,6 +851,20 @@ impl Room {
})
}
pub(crate) fn unshare_project(
&mut self,
project: ModelHandle<Project>,
cx: &mut ModelContext<Self>,
) -> Result<()> {
let project_id = match project.read(cx).remote_id() {
Some(project_id) => project_id,
None => return Ok(()),
};
self.client.send(proto::UnshareProject { project_id })?;
project.update(cx, |this, cx| this.unshare(cx))
}
pub(crate) fn set_location(
&mut self,
project: Option<&ModelHandle<Project>>,

View File

@@ -17,7 +17,8 @@ anyhow = "1.0"
clap = { version = "3.1", features = ["derive"] }
dirs = "3.0"
ipc-channel = "0.16"
serde = { version = "1.0", features = ["derive", "rc"] }
serde = { workspace = true }
serde_derive = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.9"

View File

@@ -17,17 +17,17 @@ db = { path = "../db" }
gpui = { path = "../gpui" }
util = { path = "../util" }
rpc = { path = "../rpc" }
staff_mode = { path = "../staff_mode" }
sum_tree = { path = "../sum_tree" }
anyhow = "1.0.38"
async-recursion = "0.3"
async-tungstenite = { version = "0.16", features = ["async-tls"] }
futures = "0.3"
image = "0.23"
isahc = "1.7"
lazy_static = "1.4.0"
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
parking_lot = "0.11.1"
postage = { version = "0.4.1", features = ["futures-traits"] }
postage = { workspace = true }
rand = "0.8.3"
smol = "1.2.5"
thiserror = "1.0.29"
@@ -35,7 +35,8 @@ time = { version = "0.3", features = ["serde", "serde-well-known"] }
tiny_http = "0.8"
uuid = { version = "1.1.2", features = ["v4"] }
url = "2.2"
serde = { version = "*", features = ["derive"] }
serde = { workspace = true }
serde_derive = { workspace = true }
settings = { path = "../settings" }
tempfile = "3"
@@ -44,3 +45,4 @@ collections = { path = "../collections", features = ["test-support"] }
gpui = { path = "../gpui", features = ["test-support"] }
rpc = { path = "../rpc", features = ["test-support"] }
settings = { path = "../settings", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] }

View File

@@ -1,7 +1,6 @@
#[cfg(any(test, feature = "test-support"))]
pub mod test;
pub mod http;
pub mod telemetry;
pub mod user;
@@ -11,14 +10,17 @@ use async_tungstenite::tungstenite::{
error::Error as WebsocketError,
http::{Request, StatusCode},
};
use futures::{future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt, TryStreamExt};
use futures::{
future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt, TryFutureExt as _,
TryStreamExt,
};
use gpui::{
actions,
platform::AppVersion,
serde_json::{self, Value},
AnyModelHandle, AnyViewHandle, AnyWeakModelHandle, AnyWeakViewHandle, AppContext, AppVersion,
AsyncAppContext, Entity, ModelHandle, MutableAppContext, Task, View, ViewContext, ViewHandle,
AnyModelHandle, AnyViewHandle, AnyWeakModelHandle, AnyWeakViewHandle, AppContext,
AsyncAppContext, Entity, ModelHandle, Task, View, ViewContext, ViewHandle,
};
use http::HttpClient;
use lazy_static::lazy_static;
use parking_lot::RwLock;
use postage::watch;
@@ -41,6 +43,7 @@ use telemetry::Telemetry;
use thiserror::Error;
use url::Url;
use util::channel::ReleaseChannel;
use util::http::HttpClient;
use util::{ResultExt, TryFutureExt};
pub use rpc::*;
@@ -66,12 +69,12 @@ pub const ZED_SECRET_CLIENT_TOKEN: &str = "618033988749894";
pub const INITIAL_RECONNECTION_DELAY: Duration = Duration::from_millis(100);
pub const CONNECTION_TIMEOUT: Duration = Duration::from_secs(5);
actions!(client, [Authenticate]);
actions!(client, [SignIn, SignOut]);
pub fn init(client: Arc<Client>, cx: &mut MutableAppContext) {
pub fn init(client: Arc<Client>, cx: &mut AppContext) {
cx.add_global_action({
let client = client.clone();
move |_: &Authenticate, cx| {
move |_: &SignIn, cx| {
let client = client.clone();
cx.spawn(
|cx| async move { client.authenticate_and_connect(true, &cx).log_err().await },
@@ -79,6 +82,16 @@ pub fn init(client: Arc<Client>, cx: &mut MutableAppContext) {
.detach();
}
});
cx.add_global_action({
let client = client.clone();
move |_: &SignOut, cx| {
let client = client.clone();
cx.spawn(|cx| async move {
client.disconnect(&cx);
})
.detach();
}
});
}
pub struct Client {
@@ -120,7 +133,7 @@ pub enum EstablishConnectionError {
#[error("{0}")]
Other(#[from] anyhow::Error),
#[error("{0}")]
Http(#[from] http::Error),
Http(#[from] util::http::Error),
#[error("{0}")]
Io(#[from] std::io::Error),
#[error("{0}")]
@@ -169,6 +182,10 @@ impl Status {
pub fn is_connected(&self) -> bool {
matches!(self, Self::Connected { .. })
}
pub fn is_signed_out(&self) -> bool {
matches!(self, Self::SignedOut | Self::UpgradeRequired)
}
}
struct ClientState {
@@ -280,7 +297,7 @@ impl<T: Entity> PendingEntitySubscription<T> {
state
.entities_by_type_and_remote_id
.insert(id, WeakSubscriber::Model(model.downgrade().into()));
.insert(id, WeakSubscriber::Model(model.downgrade().into_any()));
drop(state);
for message in messages {
self.client.handle_message(message, cx);
@@ -447,7 +464,7 @@ impl Client {
self.state
.write()
.entities_by_type_and_remote_id
.insert(id, WeakSubscriber::View(cx.weak_handle().into()));
.insert(id, WeakSubscriber::View(cx.weak_handle().into_any()));
Subscription::Entity {
client: Arc::downgrade(self),
id,
@@ -457,18 +474,22 @@ impl Client {
pub fn subscribe_to_entity<T: Entity>(
self: &Arc<Self>,
remote_id: u64,
) -> PendingEntitySubscription<T> {
) -> Result<PendingEntitySubscription<T>> {
let id = (TypeId::of::<T>(), remote_id);
self.state
.write()
.entities_by_type_and_remote_id
.insert(id, WeakSubscriber::Pending(Default::default()));
PendingEntitySubscription {
client: self.clone(),
remote_id,
consumed: false,
_entity_type: PhantomData,
let mut state = self.state.write();
if state.entities_by_type_and_remote_id.contains_key(&id) {
return Err(anyhow!("already subscribed to entity"));
} else {
state
.entities_by_type_and_remote_id
.insert(id, WeakSubscriber::Pending(Default::default()));
Ok(PendingEntitySubscription {
client: self.clone(),
remote_id,
consumed: false,
_entity_type: PhantomData,
})
}
}
@@ -491,7 +512,7 @@ impl Client {
let mut state = self.state.write();
state
.models_by_message_type
.insert(message_type_id, model.downgrade().into());
.insert(message_type_id, model.downgrade().into_any());
let prev_handler = state.message_handlers.insert(
message_type_id,
@@ -1152,11 +1173,9 @@ impl Client {
})
}
pub fn disconnect(self: &Arc<Self>, cx: &AsyncAppContext) -> Result<()> {
let conn_id = self.connection_id()?;
self.peer.disconnect(conn_id);
pub fn disconnect(self: &Arc<Self>, cx: &AsyncAppContext) {
self.peer.teardown();
self.set_status(Status::SignedOut, cx);
Ok(())
}
fn connection_id(&self) -> Result<ConnectionId> {
@@ -1176,6 +1195,14 @@ impl Client {
&self,
request: T,
) -> impl Future<Output = Result<T::Response>> {
self.request_envelope(request)
.map_ok(|envelope| envelope.payload)
}
pub fn request_envelope<T: RequestMessage>(
&self,
request: T,
) -> impl Future<Output = Result<TypedEnvelope<T::Response>>> {
let client_id = self.id;
log::debug!(
"rpc request start. client_id:{}. name:{}",
@@ -1184,7 +1211,7 @@ impl Client {
);
let response = self
.connection_id()
.map(|conn_id| self.peer.request(conn_id, request));
.map(|conn_id| self.peer.request_envelope(conn_id, request));
async move {
let response = response?.await;
log::debug!(
@@ -1384,10 +1411,11 @@ pub fn decode_worktree_url(url: &str) -> Option<(u64, String)> {
#[cfg(test)]
mod tests {
use super::*;
use crate::test::{FakeHttpClient, FakeServer};
use crate::test::FakeServer;
use gpui::{executor::Deterministic, TestAppContext};
use parking_lot::Mutex;
use std::future;
use util::http::FakeHttpClient;
#[gpui::test(iterations = 10)]
async fn test_reconnection(cx: &mut TestAppContext) {
@@ -1582,14 +1610,17 @@ mod tests {
let _subscription1 = client
.subscribe_to_entity(1)
.unwrap()
.set_model(&model1, &mut cx.to_async());
let _subscription2 = client
.subscribe_to_entity(2)
.unwrap()
.set_model(&model2, &mut cx.to_async());
// Ensure dropping a subscription for the same entity type still allows receiving of
// messages for other entity IDs of the same type.
let subscription3 = client
.subscribe_to_entity(3)
.unwrap()
.set_model(&model3, &mut cx.to_async());
drop(subscription3);
@@ -1618,11 +1649,13 @@ mod tests {
},
);
drop(subscription1);
let _subscription2 =
client.add_message_handler(model, move |_, _: TypedEnvelope<proto::Ping>, _, _| {
let _subscription2 = client.add_message_handler(
model.clone(),
move |_, _: TypedEnvelope<proto::Ping>, _, _| {
done_tx2.try_send(()).unwrap();
async { Ok(()) }
});
},
);
server.send(proto::Ping {});
done_rx2.next().await.unwrap();
}

View File

@@ -1,57 +0,0 @@
pub use anyhow::{anyhow, Result};
use futures::future::BoxFuture;
use isahc::{
config::{Configurable, RedirectPolicy},
AsyncBody,
};
pub use isahc::{
http::{Method, Uri},
Error,
};
use smol::future::FutureExt;
use std::{sync::Arc, time::Duration};
pub use url::Url;
pub type Request = isahc::Request<AsyncBody>;
pub type Response = isahc::Response<AsyncBody>;
pub trait HttpClient: Send + Sync {
fn send(&self, req: Request) -> BoxFuture<Result<Response, Error>>;
fn get<'a>(
&'a self,
uri: &str,
body: AsyncBody,
follow_redirects: bool,
) -> BoxFuture<'a, Result<Response, Error>> {
let request = isahc::Request::builder()
.redirect_policy(if follow_redirects {
RedirectPolicy::Follow
} else {
RedirectPolicy::None
})
.method(Method::GET)
.uri(uri)
.body(body);
match request {
Ok(request) => self.send(request),
Err(error) => async move { Err(error.into()) }.boxed(),
}
}
}
pub fn client() -> Arc<dyn HttpClient> {
Arc::new(
isahc::HttpClient::builder()
.connect_timeout(Duration::from_secs(5))
.low_speed_timeout(100, Duration::from_secs(5))
.build()
.unwrap(),
)
}
impl HttpClient for isahc::HttpClient {
fn send(&self, req: Request) -> BoxFuture<Result<Response, Error>> {
Box::pin(async move { self.send_async(req).await })
}
}

View File

@@ -1,11 +1,9 @@
use crate::http::HttpClient;
use db::kvp::KEY_VALUE_STORE;
use gpui::{
executor::Background,
serde_json::{self, value::Map, Value},
AppContext, Task,
};
use isahc::Request;
use lazy_static::lazy_static;
use parking_lot::Mutex;
use serde::Serialize;
@@ -19,6 +17,7 @@ use std::{
time::{Duration, SystemTime, UNIX_EPOCH},
};
use tempfile::NamedTempFile;
use util::http::HttpClient;
use util::{channel::ReleaseChannel, post_inc, ResultExt, TryFutureExt};
use uuid::Uuid;
@@ -220,11 +219,11 @@ impl Telemetry {
"App": true
}),
}])?;
let request = Request::post(MIXPANEL_ENGAGE_URL)
.header("Content-Type", "application/json")
.body(json_bytes.into())?;
this.http_client.send(request).await?;
Ok(())
this.http_client
.post_json(MIXPANEL_ENGAGE_URL, json_bytes.into())
.await?;
anyhow::Ok(())
}
.log_err(),
)
@@ -316,11 +315,10 @@ impl Telemetry {
json_bytes.clear();
serde_json::to_writer(&mut json_bytes, &events)?;
let request = Request::post(MIXPANEL_EVENTS_URL)
.header("Content-Type", "application/json")
.body(json_bytes.into())?;
this.http_client.send(request).await?;
Ok(())
this.http_client
.post_json(MIXPANEL_EVENTS_URL, json_bytes.into())
.await?;
anyhow::Ok(())
}
.log_err(),
)

View File

@@ -1,16 +1,14 @@
use crate::{
http::{self, HttpClient, Request, Response},
Client, Connection, Credentials, EstablishConnectionError, UserStore,
};
use crate::{Client, Connection, Credentials, EstablishConnectionError, UserStore};
use anyhow::{anyhow, Result};
use futures::{future::BoxFuture, stream::BoxStream, Future, StreamExt};
use futures::{stream::BoxStream, StreamExt};
use gpui::{executor, ModelHandle, TestAppContext};
use parking_lot::Mutex;
use rpc::{
proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse},
ConnectionId, Peer, Receipt, TypedEnvelope,
};
use std::{fmt, rc::Rc, sync::Arc};
use std::{rc::Rc, sync::Arc};
use util::http::FakeHttpClient;
pub struct FakeServer {
peer: Arc<Peer>,
@@ -219,46 +217,3 @@ impl Drop for FakeServer {
self.disconnect();
}
}
pub struct FakeHttpClient {
handler: Box<
dyn 'static
+ Send
+ Sync
+ Fn(Request) -> BoxFuture<'static, Result<Response, http::Error>>,
>,
}
impl FakeHttpClient {
pub fn create<Fut, F>(handler: F) -> Arc<dyn HttpClient>
where
Fut: 'static + Send + Future<Output = Result<Response, http::Error>>,
F: 'static + Send + Sync + Fn(Request) -> Fut,
{
Arc::new(Self {
handler: Box::new(move |req| Box::pin(handler(req))),
})
}
pub fn with_404_response() -> Arc<dyn HttpClient> {
Self::create(|_| async move {
Ok(isahc::Response::builder()
.status(404)
.body(Default::default())
.unwrap())
})
}
}
impl fmt::Debug for FakeHttpClient {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("FakeHttpClient").finish()
}
}
impl HttpClient for FakeHttpClient {
fn send(&self, req: Request) -> BoxFuture<Result<Response, crate::http::Error>> {
let future = (self.handler)(req);
Box::pin(async move { future.await.map(Into::into) })
}
}

View File

@@ -1,4 +1,4 @@
use super::{http::HttpClient, proto, Client, Status, TypedEnvelope};
use super::{proto, Client, Status, TypedEnvelope};
use anyhow::{anyhow, Context, Result};
use collections::{hash_map::Entry, HashMap, HashSet};
use futures::{channel::mpsc, future, AsyncReadExt, Future, StreamExt};
@@ -6,8 +6,10 @@ use gpui::{AsyncAppContext, Entity, ImageData, ModelContext, ModelHandle, Task};
use postage::{sink::Sink, watch};
use rpc::proto::{RequestMessage, UsersResponse};
use settings::Settings;
use staff_mode::StaffMode;
use std::sync::{Arc, Weak};
use util::{StaffMode, TryFutureExt as _};
use util::http::HttpClient;
use util::TryFutureExt as _;
#[derive(Default, Debug)]
pub struct User {
@@ -183,6 +185,11 @@ impl UserStore {
}
}
#[cfg(feature = "test-support")]
pub fn clear_cache(&mut self) {
self.users.clear();
}
async fn handle_update_invite_info(
this: ModelHandle<Self>,
message: TypedEnvelope<proto::UpdateInviteInfo>,

View File

@@ -9,4 +9,4 @@ path = "src/clock.rs"
doctest = false
[dependencies]
smallvec = { version = "1.6", features = ["union"] }
smallvec = { workspace = true }

View File

@@ -1,4 +1,5 @@
DATABASE_URL = "postgres://postgres@localhost/zed"
DATABASE_MAX_CONNECTIONS = 5
HTTP_PORT = 8080
API_TOKEN = "secret"
INVITE_LINK_PREFIX = "http://localhost:3000/invites/"

View File

@@ -3,7 +3,7 @@ authors = ["Nathan Sobo <nathan@zed.dev>"]
default-run = "collab"
edition = "2021"
name = "collab"
version = "0.5.4"
version = "0.8.3"
publish = false
[[bin]]
@@ -31,6 +31,7 @@ futures = "0.3"
hyper = "0.14"
lazy_static = "1.4"
lipsum = { version = "0.8", optional = true }
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
nanoid = "0.4"
parking_lot = "0.11.1"
prometheus = "0.13"
@@ -40,8 +41,9 @@ scrypt = "0.7"
# Remove fork dependency when a version with https://github.com/SeaQL/sea-orm/pull/1283 is released.
sea-orm = { git = "https://github.com/zed-industries/sea-orm", rev = "18f4c691085712ad014a51792af75a9044bacee6", features = ["sqlx-postgres", "postgres-array", "runtime-tokio-rustls"] }
sea-query = "0.27"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }
sha-1 = "0.9"
sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "postgres", "json", "time", "uuid", "any"] }
time = { version = "0.3", features = ["serde", "serde-well-known"] }
@@ -53,6 +55,7 @@ toml = "0.5.8"
tracing = "0.1.34"
tracing-log = "0.1.3"
tracing-subscriber = { version = "0.3.11", features = ["env-filter", "json"] }
indoc = "1.0.4"
[dev-dependencies]
collections = { path = "../collections", features = ["test-support"] }
@@ -74,11 +77,10 @@ workspace = { path = "../workspace", features = ["test-support"] }
ctor = "0.1"
env_logger = "0.9"
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
util = { path = "../util" }
lazy_static = "1.4"
sea-orm = { git = "https://github.com/zed-industries/sea-orm", rev = "18f4c691085712ad014a51792af75a9044bacee6", features = ["sqlx-sqlite"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_json = { workspace = true }
sqlx = { version = "0.6", features = ["sqlite"] }
unindent = "0.1"

View File

@@ -1,3 +1,4 @@
ZED_ENVIRONMENT=preview
RUST_LOG=info
INVITE_LINK_PREFIX=https://zed.dev/invites/
DATABASE_MAX_CONNECTIONS=10

View File

@@ -1,3 +1,4 @@
ZED_ENVIRONMENT=production
RUST_LOG=info
INVITE_LINK_PREFIX=https://zed.dev/invites/
DATABASE_MAX_CONNECTIONS=85

View File

@@ -1,3 +1,4 @@
ZED_ENVIRONMENT=staging
RUST_LOG=info
INVITE_LINK_PREFIX=https://staging.zed.dev/invites/
DATABASE_MAX_CONNECTIONS=5

View File

@@ -59,6 +59,13 @@ spec:
ports:
- containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
@@ -73,6 +80,8 @@ spec:
secretKeyRef:
name: database
key: url
- name: DATABASE_MAX_CONNECTIONS
value: "${DATABASE_MAX_CONNECTIONS}"
- name: API_TOKEN
valueFrom:
secretKeyRef:

View File

@@ -143,3 +143,17 @@ CREATE TABLE "servers" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"environment" VARCHAR NOT NULL
);
CREATE TABLE "followers" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"room_id" INTEGER NOT NULL REFERENCES rooms (id) ON DELETE CASCADE,
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
"leader_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
"leader_connection_id" INTEGER NOT NULL,
"follower_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
"follower_connection_id" INTEGER NOT NULL
);
CREATE UNIQUE INDEX
"index_followers_on_project_id_and_leader_connection_server_id_and_leader_connection_id_and_follower_connection_server_id_and_follower_connection_id"
ON "followers" ("project_id", "leader_connection_server_id", "leader_connection_id", "follower_connection_server_id", "follower_connection_id");
CREATE INDEX "index_followers_on_room_id" ON "followers" ("room_id");

View File

@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS "followers" (
"id" SERIAL PRIMARY KEY,
"room_id" INTEGER NOT NULL REFERENCES rooms (id) ON DELETE CASCADE,
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
"leader_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
"leader_connection_id" INTEGER NOT NULL,
"follower_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
"follower_connection_id" INTEGER NOT NULL
);
CREATE UNIQUE INDEX
"index_followers_on_project_id_and_leader_connection_server_id_and_leader_connection_id_and_follower_connection_server_id_and_follower_connection_id"
ON "followers" ("project_id", "leader_connection_server_id", "leader_connection_id", "follower_connection_server_id", "follower_connection_id");
CREATE INDEX "index_followers_on_room_id" ON "followers" ("room_id");

View File

@@ -78,6 +78,7 @@ pub async fn validate_api_token<B>(req: Request<B>, next: Next<B>) -> impl IntoR
struct AuthenticatedUserParams {
github_user_id: Option<i32>,
github_login: String,
github_email: Option<String>,
}
#[derive(Debug, Serialize)]
@@ -92,7 +93,11 @@ async fn get_authenticated_user(
) -> Result<Json<AuthenticatedUserResponse>> {
let user = app
.db
.get_user_by_github_account(&params.github_login, params.github_user_id)
.get_or_create_user_by_github_account(
&params.github_login,
params.github_user_id,
params.github_email.as_deref(),
)
.await?
.ok_or_else(|| Error::Http(StatusCode::NOT_FOUND, "user not found".into()))?;
let metrics_id = app.db.get_user_metrics_id(user.id).await?;
@@ -297,11 +302,7 @@ async fn create_access_token(
let mut user_id = user.id;
if let Some(impersonate) = params.impersonate {
if user.admin {
if let Some(impersonated_user) = app
.db
.get_user_by_github_account(&impersonate, None)
.await?
{
if let Some(impersonated_user) = app.db.get_user_by_github_login(&impersonate).await? {
user_id = impersonated_user.id;
} else {
return Err(Error::Http(

View File

@@ -1,5 +1,5 @@
use crate::{
db::{self, UserId},
db::{self, AccessTokenId, Database, UserId},
AppState, Error, Result,
};
use anyhow::{anyhow, Context};
@@ -8,12 +8,24 @@ use axum::{
middleware::Next,
response::IntoResponse,
};
use lazy_static::lazy_static;
use prometheus::{exponential_buckets, register_histogram, Histogram};
use rand::thread_rng;
use scrypt::{
password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
Scrypt,
};
use std::sync::Arc;
use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Instant};
lazy_static! {
static ref METRIC_ACCESS_TOKEN_HASHING_TIME: Histogram = register_histogram!(
"access_token_hashing_time",
"time spent hashing access tokens",
exponential_buckets(10.0, 2.0, 10).unwrap(),
)
.unwrap();
}
pub async fn validate_header<B>(mut req: Request<B>, next: Next<B>) -> impl IntoResponse {
let mut auth_header = req
@@ -42,20 +54,14 @@ pub async fn validate_header<B>(mut req: Request<B>, next: Next<B>) -> impl Into
)
})?;
let mut credentials_valid = false;
let state = req.extensions().get::<Arc<AppState>>().unwrap();
if let Some(admin_token) = access_token.strip_prefix("ADMIN_TOKEN:") {
if state.config.api_token == admin_token {
credentials_valid = true;
}
let credentials_valid = if let Some(admin_token) = access_token.strip_prefix("ADMIN_TOKEN:") {
state.config.api_token == admin_token
} else {
for password_hash in state.db.get_access_token_hashes(user_id).await? {
if verify_access_token(access_token, &password_hash)? {
credentials_valid = true;
break;
}
}
}
verify_access_token(&access_token, user_id, &state.db)
.await
.unwrap_or(false)
};
if credentials_valid {
let user = state
@@ -75,13 +81,26 @@ pub async fn validate_header<B>(mut req: Request<B>, next: Next<B>) -> impl Into
const MAX_ACCESS_TOKENS_TO_STORE: usize = 8;
#[derive(Serialize, Deserialize)]
struct AccessTokenJson {
version: usize,
id: AccessTokenId,
token: String,
}
pub async fn create_access_token(db: &db::Database, user_id: UserId) -> Result<String> {
const VERSION: usize = 1;
let access_token = rpc::auth::random_token();
let access_token_hash =
hash_access_token(&access_token).context("failed to hash access token")?;
db.create_access_token_hash(user_id, &access_token_hash, MAX_ACCESS_TOKENS_TO_STORE)
let id = db
.create_access_token(user_id, &access_token_hash, MAX_ACCESS_TOKENS_TO_STORE)
.await?;
Ok(access_token)
Ok(serde_json::to_string(&AccessTokenJson {
version: VERSION,
id,
token: access_token,
})?)
}
fn hash_access_token(token: &str) -> Result<String> {
@@ -89,7 +108,7 @@ fn hash_access_token(token: &str) -> Result<String> {
let params = if cfg!(debug_assertions) {
scrypt::Params::new(1, 1, 1).unwrap()
} else {
scrypt::Params::recommended()
scrypt::Params::new(14, 8, 1).unwrap()
};
Ok(Scrypt
@@ -112,7 +131,21 @@ pub fn encrypt_access_token(access_token: &str, public_key: String) -> Result<St
Ok(encrypted_access_token)
}
pub fn verify_access_token(token: &str, hash: &str) -> Result<bool> {
let hash = PasswordHash::new(hash).map_err(anyhow::Error::new)?;
Ok(Scrypt.verify_password(token.as_bytes(), &hash).is_ok())
pub async fn verify_access_token(token: &str, user_id: UserId, db: &Arc<Database>) -> Result<bool> {
let token: AccessTokenJson = serde_json::from_str(&token)?;
let db_token = db.get_access_token(token.id).await?;
if db_token.user_id != user_id {
return Err(anyhow!("no such access token"))?;
}
let db_hash = PasswordHash::new(&db_token.hash).map_err(anyhow::Error::new)?;
let t0 = Instant::now();
let is_valid = Scrypt
.verify_password(token.token.as_bytes(), &db_hash)
.is_ok();
let duration = t0.elapsed();
log::info!("hashed access token in {:?}", duration);
METRIC_ACCESS_TOKEN_HASHING_TIME.observe(duration.as_millis() as f64);
Ok(is_valid)
}

View File

@@ -1,4 +1,4 @@
use collab::db;
use collab::{db, executor::Executor};
use db::{ConnectOptions, Database};
use serde::{de::DeserializeOwned, Deserialize};
use std::fmt::Write;
@@ -13,7 +13,7 @@ struct GitHubUser {
#[tokio::main]
async fn main() {
let database_url = std::env::var("DATABASE_URL").expect("missing DATABASE_URL env var");
let db = Database::new(ConnectOptions::new(database_url))
let db = Database::new(ConnectOptions::new(database_url), Executor::Production)
.await
.expect("failed to connect to postgres database");
let github_token = std::env::var("GITHUB_TOKEN").expect("missing GITHUB_TOKEN env var");
@@ -59,7 +59,7 @@ async fn main() {
for (github_user, admin) in zed_users {
if db
.get_user_by_github_account(&github_user.login, Some(github_user.id))
.get_user_by_github_login(&github_user.login)
.await
.expect("failed to fetch user")
.is_none()

View File

@@ -1,5 +1,6 @@
mod access_token;
mod contact;
mod follower;
mod language_server;
mod project;
mod project_collaborator;
@@ -14,6 +15,7 @@ mod worktree;
mod worktree_diagnostic_summary;
mod worktree_entry;
use crate::executor::Executor;
use crate::{Error, Result};
use anyhow::anyhow;
use collections::{BTreeMap, HashMap, HashSet};
@@ -21,6 +23,8 @@ pub use contact::Contact;
use dashmap::DashMap;
use futures::StreamExt;
use hyper::StatusCode;
use rand::prelude::StdRng;
use rand::{Rng, SeedableRng};
use rpc::{proto, ConnectionId};
use sea_orm::Condition;
pub use sea_orm::ConnectOptions;
@@ -45,20 +49,20 @@ pub struct Database {
options: ConnectOptions,
pool: DatabaseConnection,
rooms: DashMap<RoomId, Arc<Mutex<()>>>,
#[cfg(test)]
background: Option<std::sync::Arc<gpui::executor::Background>>,
rng: Mutex<StdRng>,
executor: Executor,
#[cfg(test)]
runtime: Option<tokio::runtime::Runtime>,
}
impl Database {
pub async fn new(options: ConnectOptions) -> Result<Self> {
pub async fn new(options: ConnectOptions, executor: Executor) -> Result<Self> {
Ok(Self {
options: options.clone(),
pool: sea_orm::Database::connect(options).await?,
rooms: DashMap::with_capacity(16384),
#[cfg(test)]
background: None,
rng: Mutex::new(StdRng::seed_from_u64(0)),
executor,
#[cfg(test)]
runtime: None,
})
@@ -157,7 +161,7 @@ impl Database {
room_id: RoomId,
new_server_id: ServerId,
) -> Result<RoomGuard<RefreshedRoom>> {
self.room_transaction(|tx| async move {
self.room_transaction(room_id, |tx| async move {
let stale_participant_filter = Condition::all()
.add(room_participant::Column::RoomId.eq(room_id))
.add(room_participant::Column::AnsweringConnectionId.is_not_null())
@@ -171,36 +175,51 @@ impl Database {
.map(|participant| participant.user_id)
.collect::<Vec<_>>();
// Delete participants who failed to reconnect.
// Delete participants who failed to reconnect and cancel their calls.
let mut canceled_calls_to_user_ids = Vec::new();
room_participant::Entity::delete_many()
.filter(stale_participant_filter)
.exec(&*tx)
.await?;
let called_participants = room_participant::Entity::find()
.filter(
Condition::all()
.add(
room_participant::Column::CallingUserId
.is_in(stale_participant_user_ids.iter().copied()),
)
.add(room_participant::Column::AnsweringConnectionId.is_null()),
)
.all(&*tx)
.await?;
room_participant::Entity::delete_many()
.filter(
room_participant::Column::Id
.is_in(called_participants.iter().map(|participant| participant.id)),
)
.exec(&*tx)
.await?;
canceled_calls_to_user_ids.extend(
called_participants
.into_iter()
.map(|participant| participant.user_id),
);
let room = self.get_room(room_id, &tx).await?;
let mut canceled_calls_to_user_ids = Vec::new();
// Delete the room if it becomes empty and cancel pending calls.
// Delete the room if it becomes empty.
if room.participants.is_empty() {
canceled_calls_to_user_ids.extend(
room.pending_participants
.iter()
.map(|pending_participant| UserId::from_proto(pending_participant.user_id)),
);
room_participant::Entity::delete_many()
.filter(room_participant::Column::RoomId.eq(room_id))
project::Entity::delete_many()
.filter(project::Column::RoomId.eq(room_id))
.exec(&*tx)
.await?;
room::Entity::delete_by_id(room_id).exec(&*tx).await?;
}
Ok((
room_id,
RefreshedRoom {
room,
stale_participant_user_ids,
canceled_calls_to_user_ids,
},
))
Ok(RefreshedRoom {
room,
stale_participant_user_ids,
canceled_calls_to_user_ids,
})
})
.await
}
@@ -293,10 +312,21 @@ impl Database {
.await
}
pub async fn get_user_by_github_account(
pub async fn get_user_by_github_login(&self, github_login: &str) -> Result<Option<User>> {
self.transaction(|tx| async move {
Ok(user::Entity::find()
.filter(user::Column::GithubLogin.eq(github_login))
.one(&*tx)
.await?)
})
.await
}
pub async fn get_or_create_user_by_github_account(
&self,
github_login: &str,
github_user_id: Option<i32>,
github_email: Option<&str>,
) -> Result<Option<User>> {
self.transaction(|tx| async move {
let tx = &*tx;
@@ -318,7 +348,19 @@ impl Database {
user_by_github_login.github_user_id = ActiveValue::set(Some(github_user_id));
Ok(Some(user_by_github_login.update(tx).await?))
} else {
Ok(None)
let user = user::Entity::insert(user::ActiveModel {
email_address: ActiveValue::set(github_email.map(|email| email.into())),
github_login: ActiveValue::set(github_login.into()),
github_user_id: ActiveValue::set(Some(github_user_id)),
admin: ActiveValue::set(false),
invite_count: ActiveValue::set(0),
invite_code: ActiveValue::set(None),
metrics_id: ActiveValue::set(Uuid::new_v4()),
..Default::default()
})
.exec_with_returning(&*tx)
.await?;
Ok(Some(user))
}
} else {
Ok(user::Entity::find()
@@ -1129,18 +1171,16 @@ impl Database {
user_id: UserId,
connection: ConnectionId,
live_kit_room: &str,
) -> Result<RoomGuard<proto::Room>> {
self.room_transaction(|tx| async move {
) -> Result<proto::Room> {
self.transaction(|tx| async move {
let room = room::ActiveModel {
live_kit_room: ActiveValue::set(live_kit_room.into()),
..Default::default()
}
.insert(&*tx)
.await?;
let room_id = room.id;
room_participant::ActiveModel {
room_id: ActiveValue::set(room_id),
room_id: ActiveValue::set(room.id),
user_id: ActiveValue::set(user_id),
answering_connection_id: ActiveValue::set(Some(connection.id as i32)),
answering_connection_server_id: ActiveValue::set(Some(ServerId(
@@ -1157,8 +1197,8 @@ impl Database {
.insert(&*tx)
.await?;
let room = self.get_room(room_id, &tx).await?;
Ok((room_id, room))
let room = self.get_room(room.id, &tx).await?;
Ok(room)
})
.await
}
@@ -1171,7 +1211,7 @@ impl Database {
called_user_id: UserId,
initial_project_id: Option<ProjectId>,
) -> Result<RoomGuard<(proto::Room, proto::IncomingCall)>> {
self.room_transaction(|tx| async move {
self.room_transaction(room_id, |tx| async move {
room_participant::ActiveModel {
room_id: ActiveValue::set(room_id),
user_id: ActiveValue::set(called_user_id),
@@ -1190,7 +1230,7 @@ impl Database {
let room = self.get_room(room_id, &tx).await?;
let incoming_call = Self::build_incoming_call(&room, called_user_id)
.ok_or_else(|| anyhow!("failed to build incoming call"))?;
Ok((room_id, (room, incoming_call)))
Ok((room, incoming_call))
})
.await
}
@@ -1200,7 +1240,7 @@ impl Database {
room_id: RoomId,
called_user_id: UserId,
) -> Result<RoomGuard<proto::Room>> {
self.room_transaction(|tx| async move {
self.room_transaction(room_id, |tx| async move {
room_participant::Entity::delete_many()
.filter(
room_participant::Column::RoomId
@@ -1210,7 +1250,7 @@ impl Database {
.exec(&*tx)
.await?;
let room = self.get_room(room_id, &tx).await?;
Ok((room_id, room))
Ok(room)
})
.await
}
@@ -1257,7 +1297,7 @@ impl Database {
calling_connection: ConnectionId,
called_user_id: UserId,
) -> Result<RoomGuard<proto::Room>> {
self.room_transaction(|tx| async move {
self.room_transaction(room_id, |tx| async move {
let participant = room_participant::Entity::find()
.filter(
Condition::all()
@@ -1276,14 +1316,13 @@ impl Database {
.one(&*tx)
.await?
.ok_or_else(|| anyhow!("no call to cancel"))?;
let room_id = participant.room_id;
room_participant::Entity::delete(participant.into_active_model())
.exec(&*tx)
.await?;
let room = self.get_room(room_id, &tx).await?;
Ok((room_id, room))
Ok(room)
})
.await
}
@@ -1294,7 +1333,7 @@ impl Database {
user_id: UserId,
connection: ConnectionId,
) -> Result<RoomGuard<proto::Room>> {
self.room_transaction(|tx| async move {
self.room_transaction(room_id, |tx| async move {
let result = room_participant::Entity::update_many()
.filter(
Condition::all()
@@ -1316,7 +1355,7 @@ impl Database {
Err(anyhow!("room does not exist or was already joined"))?
} else {
let room = self.get_room(room_id, &tx).await?;
Ok((room_id, room))
Ok(room)
}
})
.await
@@ -1328,9 +1367,9 @@ impl Database {
user_id: UserId,
connection: ConnectionId,
) -> Result<RoomGuard<RejoinedRoom>> {
self.room_transaction(|tx| async {
let room_id = RoomId::from_proto(rejoin_room.id);
self.room_transaction(room_id, |tx| async {
let tx = tx;
let room_id = RoomId::from_proto(rejoin_room.id);
let participant_update = room_participant::Entity::update_many()
.filter(
Condition::all()
@@ -1549,14 +1588,11 @@ impl Database {
}
let room = self.get_room(room_id, &tx).await?;
Ok((
room_id,
RejoinedRoom {
room,
rejoined_projects,
reshared_projects,
},
))
Ok(RejoinedRoom {
room,
rejoined_projects,
reshared_projects,
})
})
.await
}
@@ -1717,13 +1753,75 @@ impl Database {
.await
}
pub async fn follow(
&self,
project_id: ProjectId,
leader_connection: ConnectionId,
follower_connection: ConnectionId,
) -> Result<RoomGuard<proto::Room>> {
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
follower::ActiveModel {
room_id: ActiveValue::set(room_id),
project_id: ActiveValue::set(project_id),
leader_connection_server_id: ActiveValue::set(ServerId(
leader_connection.owner_id as i32,
)),
leader_connection_id: ActiveValue::set(leader_connection.id as i32),
follower_connection_server_id: ActiveValue::set(ServerId(
follower_connection.owner_id as i32,
)),
follower_connection_id: ActiveValue::set(follower_connection.id as i32),
..Default::default()
}
.insert(&*tx)
.await?;
let room = self.get_room(room_id, &*tx).await?;
Ok(room)
})
.await
}
pub async fn unfollow(
&self,
project_id: ProjectId,
leader_connection: ConnectionId,
follower_connection: ConnectionId,
) -> Result<RoomGuard<proto::Room>> {
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
follower::Entity::delete_many()
.filter(
Condition::all()
.add(follower::Column::ProjectId.eq(project_id))
.add(
follower::Column::LeaderConnectionServerId
.eq(leader_connection.owner_id),
)
.add(follower::Column::LeaderConnectionId.eq(leader_connection.id))
.add(
follower::Column::FollowerConnectionServerId
.eq(follower_connection.owner_id),
)
.add(follower::Column::FollowerConnectionId.eq(follower_connection.id)),
)
.exec(&*tx)
.await?;
let room = self.get_room(room_id, &*tx).await?;
Ok(room)
})
.await
}
pub async fn update_room_participant_location(
&self,
room_id: RoomId,
connection: ConnectionId,
location: proto::ParticipantLocation,
) -> Result<RoomGuard<proto::Room>> {
self.room_transaction(|tx| async {
self.room_transaction(room_id, |tx| async {
let tx = tx;
let location_kind;
let location_project_id;
@@ -1769,7 +1867,7 @@ impl Database {
if result.rows_affected == 1 {
let room = self.get_room(room_id, &tx).await?;
Ok((room_id, room))
Ok(room)
} else {
Err(anyhow!("could not update room participant location"))?
}
@@ -1926,12 +2024,25 @@ impl Database {
}
}
}
drop(db_projects);
let mut db_followers = db_room.find_related(follower::Entity).stream(tx).await?;
let mut followers = Vec::new();
while let Some(db_follower) = db_followers.next().await {
let db_follower = db_follower?;
followers.push(proto::Follower {
leader_id: Some(db_follower.leader_connection().into()),
follower_id: Some(db_follower.follower_connection().into()),
project_id: db_follower.project_id.to_proto(),
});
}
Ok(proto::Room {
id: db_room.id.to_proto(),
live_kit_room: db_room.live_kit_room,
participants: participants.into_values().collect(),
pending_participants,
followers,
})
}
@@ -1963,7 +2074,7 @@ impl Database {
connection: ConnectionId,
worktrees: &[proto::WorktreeMetadata],
) -> Result<RoomGuard<(ProjectId, proto::Room)>> {
self.room_transaction(|tx| async move {
self.room_transaction(room_id, |tx| async move {
let participant = room_participant::Entity::find()
.filter(
Condition::all()
@@ -2024,7 +2135,7 @@ impl Database {
.await?;
let room = self.get_room(room_id, &tx).await?;
Ok((room_id, (project.id, room)))
Ok((project.id, room))
})
.await
}
@@ -2034,7 +2145,8 @@ impl Database {
project_id: ProjectId,
connection: ConnectionId,
) -> Result<RoomGuard<(proto::Room, Vec<ConnectionId>)>> {
self.room_transaction(|tx| async move {
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let guest_connection_ids = self.project_guest_connection_ids(project_id, &tx).await?;
let project = project::Entity::find_by_id(project_id)
@@ -2042,12 +2154,11 @@ impl Database {
.await?
.ok_or_else(|| anyhow!("project not found"))?;
if project.host_connection()? == connection {
let room_id = project.room_id;
project::Entity::delete(project.into_active_model())
.exec(&*tx)
.await?;
let room = self.get_room(room_id, &tx).await?;
Ok((room_id, (room, guest_connection_ids)))
Ok((room, guest_connection_ids))
} else {
Err(anyhow!("cannot unshare a project hosted by another user"))?
}
@@ -2061,7 +2172,8 @@ impl Database {
connection: ConnectionId,
worktrees: &[proto::WorktreeMetadata],
) -> Result<RoomGuard<(proto::Room, Vec<ConnectionId>)>> {
self.room_transaction(|tx| async move {
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let project = project::Entity::find_by_id(project_id)
.filter(
Condition::all()
@@ -2079,7 +2191,7 @@ impl Database {
let guest_connection_ids = self.project_guest_connection_ids(project.id, &tx).await?;
let room = self.get_room(project.room_id, &tx).await?;
Ok((project.room_id, (room, guest_connection_ids)))
Ok((room, guest_connection_ids))
})
.await
}
@@ -2124,12 +2236,12 @@ impl Database {
update: &proto::UpdateWorktree,
connection: ConnectionId,
) -> Result<RoomGuard<Vec<ConnectionId>>> {
self.room_transaction(|tx| async move {
let project_id = ProjectId::from_proto(update.project_id);
let worktree_id = update.worktree_id as i64;
let project_id = ProjectId::from_proto(update.project_id);
let worktree_id = update.worktree_id as i64;
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
// Ensure the update comes from the host.
let project = project::Entity::find_by_id(project_id)
let _project = project::Entity::find_by_id(project_id)
.filter(
Condition::all()
.add(project::Column::HostConnectionId.eq(connection.id as i32))
@@ -2140,7 +2252,6 @@ impl Database {
.one(&*tx)
.await?
.ok_or_else(|| anyhow!("no such project"))?;
let room_id = project.room_id;
// Update metadata.
worktree::Entity::update(worktree::ActiveModel {
@@ -2220,7 +2331,7 @@ impl Database {
}
let connection_ids = self.project_guest_connection_ids(project_id, &tx).await?;
Ok((room_id, connection_ids))
Ok(connection_ids)
})
.await
}
@@ -2230,9 +2341,10 @@ impl Database {
update: &proto::UpdateDiagnosticSummary,
connection: ConnectionId,
) -> Result<RoomGuard<Vec<ConnectionId>>> {
self.room_transaction(|tx| async move {
let project_id = ProjectId::from_proto(update.project_id);
let worktree_id = update.worktree_id as i64;
let project_id = ProjectId::from_proto(update.project_id);
let worktree_id = update.worktree_id as i64;
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let summary = update
.summary
.as_ref()
@@ -2274,7 +2386,7 @@ impl Database {
.await?;
let connection_ids = self.project_guest_connection_ids(project_id, &tx).await?;
Ok((project.room_id, connection_ids))
Ok(connection_ids)
})
.await
}
@@ -2284,8 +2396,9 @@ impl Database {
update: &proto::StartLanguageServer,
connection: ConnectionId,
) -> Result<RoomGuard<Vec<ConnectionId>>> {
self.room_transaction(|tx| async move {
let project_id = ProjectId::from_proto(update.project_id);
let project_id = ProjectId::from_proto(update.project_id);
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let server = update
.server
.as_ref()
@@ -2319,7 +2432,7 @@ impl Database {
.await?;
let connection_ids = self.project_guest_connection_ids(project_id, &tx).await?;
Ok((project.room_id, connection_ids))
Ok(connection_ids)
})
.await
}
@@ -2329,7 +2442,8 @@ impl Database {
project_id: ProjectId,
connection: ConnectionId,
) -> Result<RoomGuard<(Project, ReplicaId)>> {
self.room_transaction(|tx| async move {
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let participant = room_participant::Entity::find()
.filter(
Condition::all()
@@ -2455,7 +2569,6 @@ impl Database {
.all(&*tx)
.await?;
let room_id = project.room_id;
let project = Project {
collaborators: collaborators
.into_iter()
@@ -2475,7 +2588,7 @@ impl Database {
})
.collect(),
};
Ok((room_id, (project, replica_id as ReplicaId)))
Ok((project, replica_id as ReplicaId))
})
.await
}
@@ -2484,8 +2597,9 @@ impl Database {
&self,
project_id: ProjectId,
connection: ConnectionId,
) -> Result<RoomGuard<LeftProject>> {
self.room_transaction(|tx| async move {
) -> Result<RoomGuard<(proto::Room, LeftProject)>> {
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let result = project_collaborator::Entity::delete_many()
.filter(
Condition::all()
@@ -2515,13 +2629,39 @@ impl Database {
.map(|collaborator| collaborator.connection())
.collect();
follower::Entity::delete_many()
.filter(
Condition::any()
.add(
Condition::all()
.add(follower::Column::ProjectId.eq(project_id))
.add(
follower::Column::LeaderConnectionServerId
.eq(connection.owner_id),
)
.add(follower::Column::LeaderConnectionId.eq(connection.id)),
)
.add(
Condition::all()
.add(follower::Column::ProjectId.eq(project_id))
.add(
follower::Column::FollowerConnectionServerId
.eq(connection.owner_id),
)
.add(follower::Column::FollowerConnectionId.eq(connection.id)),
),
)
.exec(&*tx)
.await?;
let room = self.get_room(project.room_id, &tx).await?;
let left_project = LeftProject {
id: project_id,
host_user_id: project.host_user_id,
host_connection_id: project.host_connection()?,
connection_ids,
};
Ok((project.room_id, left_project))
Ok((room, left_project))
})
.await
}
@@ -2531,11 +2671,8 @@ impl Database {
project_id: ProjectId,
connection_id: ConnectionId,
) -> Result<RoomGuard<Vec<ProjectCollaborator>>> {
self.room_transaction(|tx| async move {
let project = project::Entity::find_by_id(project_id)
.one(&*tx)
.await?
.ok_or_else(|| anyhow!("no such project"))?;
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let collaborators = project_collaborator::Entity::find()
.filter(project_collaborator::Column::ProjectId.eq(project_id))
.all(&*tx)
@@ -2553,7 +2690,7 @@ impl Database {
.iter()
.any(|collaborator| collaborator.connection_id == connection_id)
{
Ok((project.room_id, collaborators))
Ok(collaborators)
} else {
Err(anyhow!("no such project"))?
}
@@ -2566,11 +2703,8 @@ impl Database {
project_id: ProjectId,
connection_id: ConnectionId,
) -> Result<RoomGuard<HashSet<ConnectionId>>> {
self.room_transaction(|tx| async move {
let project = project::Entity::find_by_id(project_id)
.one(&*tx)
.await?
.ok_or_else(|| anyhow!("no such project"))?;
let room_id = self.room_id_for_project(project_id).await?;
self.room_transaction(room_id, |tx| async move {
let mut collaborators = project_collaborator::Entity::find()
.filter(project_collaborator::Column::ProjectId.eq(project_id))
.stream(&*tx)
@@ -2583,7 +2717,7 @@ impl Database {
}
if connection_ids.contains(&connection_id) {
Ok((project.room_id, connection_ids))
Ok(connection_ids)
} else {
Err(anyhow!("no such project"))?
}
@@ -2613,18 +2747,29 @@ impl Database {
Ok(guest_connection_ids)
}
async fn room_id_for_project(&self, project_id: ProjectId) -> Result<RoomId> {
self.transaction(|tx| async move {
let project = project::Entity::find_by_id(project_id)
.one(&*tx)
.await?
.ok_or_else(|| anyhow!("project {} not found", project_id))?;
Ok(project.room_id)
})
.await
}
// access tokens
pub async fn create_access_token_hash(
pub async fn create_access_token(
&self,
user_id: UserId,
access_token_hash: &str,
max_access_token_count: usize,
) -> Result<()> {
) -> Result<AccessTokenId> {
self.transaction(|tx| async {
let tx = tx;
access_token::ActiveModel {
let token = access_token::ActiveModel {
user_id: ActiveValue::set(user_id),
hash: ActiveValue::set(access_token_hash.into()),
..Default::default()
@@ -2647,26 +2792,20 @@ impl Database {
)
.exec(&*tx)
.await?;
Ok(())
Ok(token.id)
})
.await
}
pub async fn get_access_token_hashes(&self, user_id: UserId) -> Result<Vec<String>> {
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
enum QueryAs {
Hash,
}
pub async fn get_access_token(
&self,
access_token_id: AccessTokenId,
) -> Result<access_token::Model> {
self.transaction(|tx| async move {
Ok(access_token::Entity::find()
.select_only()
.column(access_token::Column::Hash)
.filter(access_token::Column::UserId.eq(user_id))
.order_by_desc(access_token::Column::Id)
.into_values::<_, QueryAs>()
.all(&*tx)
.await?)
Ok(access_token::Entity::find_by_id(access_token_id)
.one(&*tx)
.await?
.ok_or_else(|| anyhow!("no such access token"))?)
})
.await
}
@@ -2677,30 +2816,26 @@ impl Database {
Fut: Send + Future<Output = Result<T>>,
{
let body = async {
let mut i = 0;
loop {
let (tx, result) = self.with_transaction(&f).await?;
match result {
Ok(result) => {
match tx.commit().await.map_err(Into::into) {
Ok(()) => return Ok(result),
Err(error) => {
if is_serialization_error(&error) {
// Retry (don't break the loop)
} else {
return Err(error);
}
Ok(result) => match tx.commit().await.map_err(Into::into) {
Ok(()) => return Ok(result),
Err(error) => {
if !self.retry_on_serialization_error(&error, i).await {
return Err(error);
}
}
}
},
Err(error) => {
tx.rollback().await?;
if is_serialization_error(&error) {
// Retry (don't break the loop)
} else {
if !self.retry_on_serialization_error(&error, i).await {
return Err(error);
}
}
}
i += 1;
}
};
@@ -2713,6 +2848,7 @@ impl Database {
Fut: Send + Future<Output = Result<Option<(RoomId, T)>>>,
{
let body = async {
let mut i = 0;
loop {
let (tx, result) = self.with_transaction(&f).await?;
match result {
@@ -2728,56 +2864,72 @@ impl Database {
}));
}
Err(error) => {
if is_serialization_error(&error) {
// Retry (don't break the loop)
} else {
if !self.retry_on_serialization_error(&error, i).await {
return Err(error);
}
}
}
}
Ok(None) => {
match tx.commit().await.map_err(Into::into) {
Ok(()) => return Ok(None),
Err(error) => {
if is_serialization_error(&error) {
// Retry (don't break the loop)
} else {
return Err(error);
}
Ok(None) => match tx.commit().await.map_err(Into::into) {
Ok(()) => return Ok(None),
Err(error) => {
if !self.retry_on_serialization_error(&error, i).await {
return Err(error);
}
}
}
},
Err(error) => {
tx.rollback().await?;
if is_serialization_error(&error) {
// Retry (don't break the loop)
} else {
if !self.retry_on_serialization_error(&error, i).await {
return Err(error);
}
}
}
i += 1;
}
};
self.run(body).await
}
async fn room_transaction<F, Fut, T>(&self, f: F) -> Result<RoomGuard<T>>
async fn room_transaction<F, Fut, T>(&self, room_id: RoomId, f: F) -> Result<RoomGuard<T>>
where
F: Send + Fn(TransactionHandle) -> Fut,
Fut: Send + Future<Output = Result<(RoomId, T)>>,
Fut: Send + Future<Output = Result<T>>,
{
let data = self
.optional_room_transaction(move |tx| {
let future = f(tx);
async {
let data = future.await?;
Ok(Some(data))
let body = async {
let mut i = 0;
loop {
let lock = self.rooms.entry(room_id).or_default().clone();
let _guard = lock.lock_owned().await;
let (tx, result) = self.with_transaction(&f).await?;
match result {
Ok(data) => match tx.commit().await.map_err(Into::into) {
Ok(()) => {
return Ok(RoomGuard {
data,
_guard,
_not_send: PhantomData,
});
}
Err(error) => {
if !self.retry_on_serialization_error(&error, i).await {
return Err(error);
}
}
},
Err(error) => {
tx.rollback().await?;
if !self.retry_on_serialization_error(&error, i).await {
return Err(error);
}
}
}
})
.await?;
Ok(data.unwrap())
i += 1;
}
};
self.run(body).await
}
async fn with_transaction<F, Fut, T>(&self, f: &F) -> Result<(DatabaseTransaction, Result<T>)>
@@ -2799,14 +2951,14 @@ impl Database {
Ok((tx, result))
}
async fn run<F, T>(&self, future: F) -> T
async fn run<F, T>(&self, future: F) -> Result<T>
where
F: Future<Output = T>,
F: Future<Output = Result<T>>,
{
#[cfg(test)]
{
if let Some(background) = self.background.as_ref() {
background.simulate_random_delay().await;
if let Executor::Deterministic(executor) = &self.executor {
executor.simulate_random_delay().await;
}
self.runtime.as_ref().unwrap().block_on(future)
@@ -2817,6 +2969,27 @@ impl Database {
future.await
}
}
async fn retry_on_serialization_error(&self, error: &Error, prev_attempt_count: u32) -> bool {
// If the error is due to a failure to serialize concurrent transactions, then retry
// this transaction after a delay. With each subsequent retry, double the delay duration.
// Also vary the delay randomly in order to ensure different database connections retry
// at different times.
if is_serialization_error(error) {
let base_delay = 4_u64 << prev_attempt_count.min(16);
let randomized_delay = base_delay as f32 * self.rng.lock().await.gen_range(0.5..=2.0);
log::info!(
"retrying transaction after serialization error. delay: {} ms.",
randomized_delay
);
self.executor
.sleep(Duration::from_millis(randomized_delay as u64))
.await;
true
} else {
false
}
}
}
fn is_serialization_error(error: &Error) -> bool {
@@ -3011,6 +3184,7 @@ macro_rules! id_type {
id_type!(AccessTokenId);
id_type!(ContactId);
id_type!(FollowerId);
id_type!(RoomId);
id_type!(RoomParticipantId);
id_type!(ProjectId);
@@ -3117,7 +3291,6 @@ mod test {
use gpui::executor::Background;
use lazy_static::lazy_static;
use parking_lot::Mutex;
use rand::prelude::*;
use sea_orm::ConnectionTrait;
use sqlx::migrate::MigrateDatabase;
use std::sync::Arc;
@@ -3139,7 +3312,9 @@ mod test {
let mut db = runtime.block_on(async {
let mut options = ConnectOptions::new(url);
options.max_connections(5);
let db = Database::new(options).await.unwrap();
let db = Database::new(options, Executor::Deterministic(background))
.await
.unwrap();
let sql = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/migrations.sqlite/20221109000000_test_schema.sql"
@@ -3154,7 +3329,6 @@ mod test {
db
});
db.background = Some(background);
db.runtime = Some(runtime);
Self {
@@ -3188,13 +3362,14 @@ mod test {
options
.max_connections(5)
.idle_timeout(Duration::from_secs(0));
let db = Database::new(options).await.unwrap();
let db = Database::new(options, Executor::Deterministic(background))
.await
.unwrap();
let migrations_path = concat!(env!("CARGO_MANIFEST_DIR"), "/migrations");
db.migrate(Path::new(migrations_path), false).await.unwrap();
db
});
db.background = Some(background);
db.runtime = Some(runtime);
Self {

View File

@@ -0,0 +1,51 @@
use super::{FollowerId, ProjectId, RoomId, ServerId};
use rpc::ConnectionId;
use sea_orm::entity::prelude::*;
use serde::Serialize;
#[derive(Clone, Debug, Default, PartialEq, Eq, DeriveEntityModel, Serialize)]
#[sea_orm(table_name = "followers")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: FollowerId,
pub room_id: RoomId,
pub project_id: ProjectId,
pub leader_connection_server_id: ServerId,
pub leader_connection_id: i32,
pub follower_connection_server_id: ServerId,
pub follower_connection_id: i32,
}
impl Model {
pub fn leader_connection(&self) -> ConnectionId {
ConnectionId {
owner_id: self.leader_connection_server_id.0 as u32,
id: self.leader_connection_id as u32,
}
}
pub fn follower_connection(&self) -> ConnectionId {
ConnectionId {
owner_id: self.follower_connection_server_id.0 as u32,
id: self.follower_connection_id as u32,
}
}
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::room::Entity",
from = "Column::RoomId",
to = "super::room::Column::Id"
)]
Room,
}
impl Related<super::room::Entity> for Entity {
fn to() -> RelationDef {
Relation::Room.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@@ -15,6 +15,8 @@ pub enum Relation {
RoomParticipant,
#[sea_orm(has_many = "super::project::Entity")]
Project,
#[sea_orm(has_many = "super::follower::Entity")]
Follower,
}
impl Related<super::room_participant::Entity> for Entity {
@@ -29,4 +31,10 @@ impl Related<super::project::Entity> for Entity {
}
}
impl Related<super::follower::Entity> for Entity {
fn to() -> RelationDef {
Relation::Follower.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@@ -92,8 +92,8 @@ test_both_dbs!(
);
test_both_dbs!(
test_get_user_by_github_account_postgres,
test_get_user_by_github_account_sqlite,
test_get_or_create_user_by_github_account_postgres,
test_get_or_create_user_by_github_account_sqlite,
db,
{
let user_id1 = db
@@ -124,7 +124,7 @@ test_both_dbs!(
.user_id;
let user = db
.get_user_by_github_account("login1", None)
.get_or_create_user_by_github_account("login1", None, None)
.await
.unwrap()
.unwrap();
@@ -133,19 +133,28 @@ test_both_dbs!(
assert_eq!(user.github_user_id, Some(101));
assert!(db
.get_user_by_github_account("non-existent-login", None)
.get_or_create_user_by_github_account("non-existent-login", None, None)
.await
.unwrap()
.is_none());
let user = db
.get_user_by_github_account("the-new-login2", Some(102))
.get_or_create_user_by_github_account("the-new-login2", Some(102), None)
.await
.unwrap()
.unwrap();
assert_eq!(user.id, user_id2);
assert_eq!(&user.github_login, "the-new-login2");
assert_eq!(user.github_user_id, Some(102));
let user = db
.get_or_create_user_by_github_account("login3", Some(103), Some("user3@example.com"))
.await
.unwrap()
.unwrap();
assert_eq!(&user.github_login, "login3");
assert_eq!(user.github_user_id, Some(103));
assert_eq!(user.email_address, Some("user3@example.com".into()));
}
);
@@ -168,30 +177,63 @@ test_both_dbs!(
.unwrap()
.user_id;
db.create_access_token_hash(user, "h1", 3).await.unwrap();
db.create_access_token_hash(user, "h2", 3).await.unwrap();
let token_1 = db.create_access_token(user, "h1", 2).await.unwrap();
let token_2 = db.create_access_token(user, "h2", 2).await.unwrap();
assert_eq!(
db.get_access_token_hashes(user).await.unwrap(),
&["h2".to_string(), "h1".to_string()]
db.get_access_token(token_1).await.unwrap(),
access_token::Model {
id: token_1,
user_id: user,
hash: "h1".into(),
}
);
assert_eq!(
db.get_access_token(token_2).await.unwrap(),
access_token::Model {
id: token_2,
user_id: user,
hash: "h2".into()
}
);
db.create_access_token_hash(user, "h3", 3).await.unwrap();
let token_3 = db.create_access_token(user, "h3", 2).await.unwrap();
assert_eq!(
db.get_access_token_hashes(user).await.unwrap(),
&["h3".to_string(), "h2".to_string(), "h1".to_string(),]
db.get_access_token(token_3).await.unwrap(),
access_token::Model {
id: token_3,
user_id: user,
hash: "h3".into()
}
);
assert_eq!(
db.get_access_token(token_2).await.unwrap(),
access_token::Model {
id: token_2,
user_id: user,
hash: "h2".into()
}
);
assert!(db.get_access_token(token_1).await.is_err());
db.create_access_token_hash(user, "h4", 3).await.unwrap();
let token_4 = db.create_access_token(user, "h4", 2).await.unwrap();
assert_eq!(
db.get_access_token_hashes(user).await.unwrap(),
&["h4".to_string(), "h3".to_string(), "h2".to_string(),]
db.get_access_token(token_4).await.unwrap(),
access_token::Model {
id: token_4,
user_id: user,
hash: "h4".into()
}
);
db.create_access_token_hash(user, "h5", 3).await.unwrap();
assert_eq!(
db.get_access_token_hashes(user).await.unwrap(),
&["h5".to_string(), "h4".to_string(), "h3".to_string()]
db.get_access_token(token_3).await.unwrap(),
access_token::Model {
id: token_3,
user_id: user,
hash: "h3".into()
}
);
assert!(db.get_access_token(token_2).await.is_err());
assert!(db.get_access_token(token_1).await.is_err());
}
);

View File

@@ -10,6 +10,7 @@ mod tests;
use axum::{http::StatusCode, response::IntoResponse};
use db::Database;
use executor::Executor;
use serde::Deserialize;
use std::{path::PathBuf, sync::Arc};
@@ -91,6 +92,7 @@ impl std::error::Error for Error {}
pub struct Config {
pub http_port: u16,
pub database_url: String,
pub database_max_connections: u32,
pub api_token: String,
pub invite_link_prefix: String,
pub live_kit_server: Option<String>,
@@ -116,8 +118,8 @@ pub struct AppState {
impl AppState {
pub async fn new(config: Config) -> Result<Arc<Self>> {
let mut db_options = db::ConnectOptions::new(config.database_url.clone());
db_options.max_connections(5);
let db = Database::new(db_options).await?;
db_options.max_connections(config.database_max_connections);
let db = Database::new(db_options, Executor::Production).await?;
let live_kit_client = if let Some(((server, key), secret)) = config
.live_kit_server
.as_ref()

View File

@@ -1,11 +1,12 @@
use anyhow::anyhow;
use axum::{routing::get, Router};
use axum::{routing::get, Extension, Router};
use collab::{db, env, executor::Executor, AppState, Config, MigrateConfig, Result};
use db::Database;
use std::{
env::args,
net::{SocketAddr, TcpListener},
path::Path,
sync::Arc,
};
use tokio::signal::unix::SignalKind;
use tracing_log::LogTracer;
@@ -31,7 +32,7 @@ async fn main() -> Result<()> {
let config = envy::from_env::<MigrateConfig>().expect("error loading config");
let mut db_options = db::ConnectOptions::new(config.database_url.clone());
db_options.max_connections(5);
let db = Database::new(db_options).await?;
let db = Database::new(db_options, Executor::Production).await?;
let migrations_path = config
.migrations_path
@@ -66,7 +67,12 @@ async fn main() -> Result<()> {
let app = collab::api::routes(rpc_server.clone(), state.clone())
.merge(collab::rpc::routes(rpc_server.clone()))
.merge(Router::new().route("/", get(handle_root)));
.merge(
Router::new()
.route("/", get(handle_root))
.route("/healthz", get(handle_liveness_probe))
.layer(Extension(state.clone())),
);
axum::Server::from_tcp(listener)?
.serve(app.into_make_service_with_connect_info::<SocketAddr>())
@@ -95,6 +101,11 @@ async fn handle_root() -> String {
format!("collab v{VERSION}")
}
async fn handle_liveness_probe(Extension(state): Extension<Arc<AppState>>) -> Result<String> {
state.db.get_all_users(0, 1).await?;
Ok("ok".to_string())
}
pub fn init_tracing(config: &Config) -> Option<()> {
use std::str::FromStr;
use tracing_subscriber::layer::SubscriberExt;

View File

@@ -53,11 +53,11 @@ use std::{
},
time::Duration,
};
use tokio::sync::watch;
use tokio::sync::{watch, Semaphore};
use tower::ServiceBuilder;
use tracing::{info_span, instrument, Instrument};
pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(5);
pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30);
pub const CLEANUP_TIMEOUT: Duration = Duration::from_secs(10);
lazy_static! {
@@ -186,7 +186,7 @@ impl Server {
.add_request_handler(create_room)
.add_request_handler(join_room)
.add_request_handler(rejoin_room)
.add_message_handler(leave_room)
.add_request_handler(leave_room)
.add_request_handler(call)
.add_request_handler(cancel_call)
.add_message_handler(decline_call)
@@ -228,7 +228,7 @@ impl Server {
.add_message_handler(update_buffer_file)
.add_message_handler(buffer_reloaded)
.add_message_handler(buffer_saved)
.add_request_handler(save_buffer)
.add_request_handler(forward_project_request::<proto::SaveBuffer>)
.add_request_handler(get_users)
.add_request_handler(fuzzy_search_users)
.add_request_handler(request_contact)
@@ -270,8 +270,11 @@ impl Server {
let mut live_kit_room = String::new();
let mut delete_live_kit_room = false;
if let Ok(mut refreshed_room) =
app_state.db.refresh_room(room_id, server_id).await
if let Some(mut refreshed_room) = app_state
.db
.refresh_room(room_id, server_id)
.await
.trace_err()
{
tracing::info!(
room_id = room_id.0,
@@ -539,8 +542,13 @@ impl Server {
// This arrangement ensures we will attempt to process earlier messages first, but fall
// back to processing messages arrived later in the spirit of making progress.
let mut foreground_message_handlers = FuturesUnordered::new();
let concurrent_handlers = Arc::new(Semaphore::new(256));
loop {
let next_message = incoming_rx.next().fuse();
let next_message = async {
let permit = concurrent_handlers.clone().acquire_owned().await.unwrap();
let message = incoming_rx.next().await;
(permit, message)
}.fuse();
futures::pin_mut!(next_message);
futures::select_biased! {
_ = teardown.changed().fuse() => return Ok(()),
@@ -551,7 +559,8 @@ impl Server {
break;
}
_ = foreground_message_handlers.next() => {}
message = next_message => {
next_message = next_message => {
let (permit, message) = next_message;
if let Some(message) = message {
let type_name = message.payload_type_name();
let span = tracing::info_span!("receive message", %user_id, %login, %connection_id, %address, type_name);
@@ -561,7 +570,10 @@ impl Server {
let handle_message = (handler)(message, session.clone());
drop(span_enter);
let handle_message = handle_message.instrument(span);
let handle_message = async move {
handle_message.await;
drop(permit);
}.instrument(span);
if is_background {
executor.spawn_detached(handle_message);
} else {
@@ -1090,8 +1102,14 @@ async fn rejoin_room(
Ok(())
}
async fn leave_room(_message: proto::LeaveRoom, session: Session) -> Result<()> {
leave_room_for_session(&session).await
async fn leave_room(
_: proto::LeaveRoom,
response: Response<proto::LeaveRoom>,
session: Session,
) -> Result<()> {
leave_room_for_session(&session).await?;
response.send(proto::Ack {})?;
Ok(())
}
async fn call(
@@ -1312,6 +1330,7 @@ async fn join_project(
.filter(|collaborator| collaborator.connection_id != session.connection_id)
.map(|collaborator| collaborator.to_proto())
.collect::<Vec<_>>();
let worktrees = project
.worktrees
.iter()
@@ -1404,7 +1423,7 @@ async fn leave_project(request: proto::LeaveProject, session: Session) -> Result
let sender_id = session.connection_id;
let project_id = ProjectId::from_proto(request.project_id);
let project = session
let (room, project) = &*session
.db()
.await
.leave_project(project_id, sender_id)
@@ -1415,7 +1434,9 @@ async fn leave_project(request: proto::LeaveProject, session: Session) -> Result
host_connection_id = %project.host_connection_id,
"leave project"
);
project_left(&project, &session);
room_updated(&room, &session.peer);
Ok(())
}
@@ -1570,51 +1591,6 @@ where
Ok(())
}
async fn save_buffer(
request: proto::SaveBuffer,
response: Response<proto::SaveBuffer>,
session: Session,
) -> Result<()> {
let project_id = ProjectId::from_proto(request.project_id);
let host_connection_id = {
let collaborators = session
.db()
.await
.project_collaborators(project_id, session.connection_id)
.await?;
collaborators
.iter()
.find(|collaborator| collaborator.is_host)
.ok_or_else(|| anyhow!("host not found"))?
.connection_id
};
let response_payload = session
.peer
.forward_request(session.connection_id, host_connection_id, request.clone())
.await?;
let mut collaborators = session
.db()
.await
.project_collaborators(project_id, session.connection_id)
.await?;
collaborators.retain(|collaborator| collaborator.connection_id != session.connection_id);
let project_connection_ids = collaborators
.iter()
.map(|collaborator| collaborator.connection_id);
broadcast(
Some(host_connection_id),
project_connection_ids,
|conn_id| {
session
.peer
.forward_send(host_connection_id, conn_id, response_payload.clone())
},
);
response.send(response_payload)?;
Ok(())
}
async fn create_buffer_for_peer(
request: proto::CreateBufferForPeer,
session: Session,
@@ -1634,23 +1610,42 @@ async fn update_buffer(
) -> Result<()> {
session.executor.record_backtrace();
let project_id = ProjectId::from_proto(request.project_id);
let project_connection_ids = session
.db()
.await
.project_connection_ids(project_id, session.connection_id)
.await?;
let mut guest_connection_ids;
let mut host_connection_id = None;
{
let collaborators = session
.db()
.await
.project_collaborators(project_id, session.connection_id)
.await?;
guest_connection_ids = Vec::with_capacity(collaborators.len() - 1);
for collaborator in collaborators.iter() {
if collaborator.is_host {
host_connection_id = Some(collaborator.connection_id);
} else {
guest_connection_ids.push(collaborator.connection_id);
}
}
}
let host_connection_id = host_connection_id.ok_or_else(|| anyhow!("host not found"))?;
session.executor.record_backtrace();
broadcast(
Some(session.connection_id),
project_connection_ids.iter().copied(),
guest_connection_ids,
|connection_id| {
session
.peer
.forward_send(session.connection_id, connection_id, request.clone())
},
);
if host_connection_id != session.connection_id {
session
.peer
.forward_request(session.connection_id, host_connection_id, request.clone())
.await?;
}
response.send(proto::Ack {})?;
Ok(())
}
@@ -1724,6 +1719,7 @@ async fn follow(
.ok_or_else(|| anyhow!("invalid leader id"))?
.into();
let follower_id = session.connection_id;
{
let project_connection_ids = session
.db()
@@ -1744,6 +1740,14 @@ async fn follow(
.views
.retain(|view| view.leader_id != Some(follower_id.into()));
response.send(response_payload)?;
let room = session
.db()
.await
.follow(project_id, leader_id, follower_id)
.await?;
room_updated(&room, &session.peer);
Ok(())
}
@@ -1753,17 +1757,29 @@ async fn unfollow(request: proto::Unfollow, session: Session) -> Result<()> {
.leader_id
.ok_or_else(|| anyhow!("invalid leader id"))?
.into();
let project_connection_ids = session
let follower_id = session.connection_id;
if !session
.db()
.await
.project_connection_ids(project_id, session.connection_id)
.await?;
if !project_connection_ids.contains(&leader_id) {
.await?
.contains(&leader_id)
{
Err(anyhow!("no such peer"))?;
}
session
.peer
.forward_send(session.connection_id, leader_id, request)?;
let room = session
.db()
.await
.unfollow(project_id, leader_id, follower_id)
.await?;
room_updated(&room, &session.peer);
Ok(())
}
@@ -1833,7 +1849,7 @@ async fn fuzzy_search_users(
1 | 2 => session
.db()
.await
.get_user_by_github_account(&query, None)
.get_user_by_github_login(&query)
.await?
.into_iter()
.collect(),

View File

@@ -7,29 +7,28 @@ use crate::{
use anyhow::anyhow;
use call::ActiveCall;
use client::{
self, proto::PeerId, test::FakeHttpClient, Client, Connection, Credentials,
EstablishConnectionError, UserStore,
self, proto::PeerId, Client, Connection, Credentials, EstablishConnectionError, UserStore,
};
use collections::{HashMap, HashSet};
use fs::FakeFs;
use futures::{channel::oneshot, StreamExt as _};
use gpui::{
executor::Deterministic, test::EmptyView, ModelHandle, Task, TestAppContext, ViewHandle,
};
use gpui::{executor::Deterministic, test::EmptyView, ModelHandle, TestAppContext, ViewHandle};
use language::LanguageRegistry;
use parking_lot::Mutex;
use project::{Project, WorktreeId};
use settings::Settings;
use std::{
cell::{Ref, RefCell, RefMut},
env,
ops::Deref,
path::{Path, PathBuf},
ops::{Deref, DerefMut},
path::Path,
sync::{
atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst},
Arc,
},
};
use theme::ThemeRegistry;
use util::http::FakeHttpClient;
use workspace::Workspace;
mod integration_tests;
@@ -104,11 +103,7 @@ impl TestServer {
});
let http = FakeHttpClient::with_404_response();
let user_id = if let Ok(Some(user)) = self
.app_state
.db
.get_user_by_github_account(name, None)
.await
let user_id = if let Ok(Some(user)) = self.app_state.db.get_user_by_github_login(name).await
{
user.id
} else {
@@ -192,12 +187,13 @@ impl TestServer {
let app_state = Arc::new(workspace::AppState {
client: client.clone(),
user_store: user_store.clone(),
languages: Arc::new(LanguageRegistry::new(Task::ready(()))),
languages: Arc::new(LanguageRegistry::test()),
themes: ThemeRegistry::new((), cx.font_cache()),
fs: fs.clone(),
build_window_options: |_, _, _| Default::default(),
initialize_workspace: |_, _, _| unimplemented!(),
dock_default_item_factory: |_, _| unimplemented!(),
dock_default_item_factory: |_, _| None,
background_actions: || &[],
});
Project::init(&client);
@@ -214,13 +210,10 @@ impl TestServer {
let client = TestClient {
client,
username: name.to_string(),
local_projects: Default::default(),
remote_projects: Default::default(),
next_root_dir_id: 0,
state: Default::default(),
user_store,
fs,
language_registry: Arc::new(LanguageRegistry::test()),
buffers: Default::default(),
};
client.wait_for_current_user(cx).await;
client
@@ -319,12 +312,16 @@ impl Drop for TestServer {
struct TestClient {
client: Arc<Client>,
username: String,
local_projects: Vec<ModelHandle<Project>>,
remote_projects: Vec<ModelHandle<Project>>,
next_root_dir_id: usize,
state: RefCell<TestClientState>,
pub user_store: ModelHandle<UserStore>,
language_registry: Arc<LanguageRegistry>,
fs: Arc<FakeFs>,
}
#[derive(Default)]
struct TestClientState {
local_projects: Vec<ModelHandle<Project>>,
remote_projects: Vec<ModelHandle<Project>>,
buffers: HashMap<ModelHandle<Project>, HashSet<ModelHandle<language::Buffer>>>,
}
@@ -363,6 +360,38 @@ impl TestClient {
.await;
}
fn local_projects<'a>(&'a self) -> impl Deref<Target = Vec<ModelHandle<Project>>> + 'a {
Ref::map(self.state.borrow(), |state| &state.local_projects)
}
fn remote_projects<'a>(&'a self) -> impl Deref<Target = Vec<ModelHandle<Project>>> + 'a {
Ref::map(self.state.borrow(), |state| &state.remote_projects)
}
fn local_projects_mut<'a>(&'a self) -> impl DerefMut<Target = Vec<ModelHandle<Project>>> + 'a {
RefMut::map(self.state.borrow_mut(), |state| &mut state.local_projects)
}
fn remote_projects_mut<'a>(&'a self) -> impl DerefMut<Target = Vec<ModelHandle<Project>>> + 'a {
RefMut::map(self.state.borrow_mut(), |state| &mut state.remote_projects)
}
fn buffers_for_project<'a>(
&'a self,
project: &ModelHandle<Project>,
) -> impl DerefMut<Target = HashSet<ModelHandle<language::Buffer>>> + 'a {
RefMut::map(self.state.borrow_mut(), |state| {
state.buffers.entry(project.clone()).or_default()
})
}
fn buffers<'a>(
&'a self,
) -> impl DerefMut<Target = HashMap<ModelHandle<Project>, HashSet<ModelHandle<language::Buffer>>>> + 'a
{
RefMut::map(self.state.borrow_mut(), |state| &mut state.buffers)
}
fn summarize_contacts(&self, cx: &TestAppContext) -> ContactsSummary {
self.user_store.read_with(cx, |store, _| ContactsSummary {
current: store
@@ -434,24 +463,7 @@ impl TestClient {
cx: &mut TestAppContext,
) -> ViewHandle<Workspace> {
let (_, root_view) = cx.add_window(|_| EmptyView);
cx.add_view(&root_view, |cx| {
Workspace::new(
Default::default(),
0,
project.clone(),
|_, _| unimplemented!(),
cx,
)
})
}
fn create_new_root_dir(&mut self) -> PathBuf {
format!(
"/{}-root-{}",
self.username,
util::post_inc(&mut self.next_root_dir_id)
)
.into()
cx.add_view(&root_view, |cx| Workspace::test_new(project.clone(), cx))
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -22,11 +22,14 @@ test-support = [
]
[dependencies]
auto_update = { path = "../auto_update" }
call = { path = "../call" }
client = { path = "../client" }
clock = { path = "../clock" }
collections = { path = "../collections" }
context_menu = { path = "../context_menu" }
editor = { path = "../editor" }
feedback = { path = "../feedback" }
fuzzy = { path = "../fuzzy" }
gpui = { path = "../gpui" }
menu = { path = "../menu" }
@@ -39,8 +42,9 @@ workspace = { path = "../workspace" }
anyhow = "1.0"
futures = "0.3"
log = "0.4"
postage = { version = "0.4.1", features = ["futures-traits"] }
serde = { version = "1.0", features = ["derive", "rc"] }
postage = { workspace = true }
serde = { workspace = true }
serde_derive = { workspace = true }
[dev-dependencies]
call = { path = "../call", features = ["test-support"] }

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,10 @@
mod collab_titlebar_item;
mod collaborator_list_popover;
mod contact_finder;
mod contact_list;
mod contact_notification;
mod contacts_popover;
mod face_pile;
mod incoming_call_notification;
mod notifications;
mod project_shared_notification;
@@ -10,14 +12,14 @@ mod sharing_status_indicator;
use anyhow::anyhow;
use call::ActiveCall;
pub use collab_titlebar_item::{CollabTitlebarItem, ToggleCollaborationMenu};
use gpui::{actions, MutableAppContext, Task};
pub use collab_titlebar_item::{CollabTitlebarItem, ToggleContactsMenu};
use gpui::{actions, AppContext, Task};
use std::sync::Arc;
use workspace::{AppState, JoinProject, ToggleFollow, Workspace};
actions!(collab, [ToggleScreenSharing]);
pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
pub fn init(app_state: Arc<AppState>, cx: &mut AppContext) {
collab_titlebar_item::init(cx);
contact_notification::init(cx);
contact_list::init(cx);
@@ -33,7 +35,7 @@ pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
});
}
pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut MutableAppContext) {
pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
let toggle_screen_sharing = room.update(cx, |room, cx| {
if room.is_screen_sharing() {
@@ -46,13 +48,13 @@ pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut MutableAppContext
}
}
fn join_project(action: &JoinProject, app_state: Arc<AppState>, cx: &mut MutableAppContext) {
fn join_project(action: &JoinProject, app_state: Arc<AppState>, cx: &mut AppContext) {
let project_id = action.project_id;
let follow_user_id = action.follow_user_id;
cx.spawn(|mut cx| async move {
let existing_workspace = cx.update(|cx| {
cx.window_ids()
.filter_map(|window_id| cx.root_view::<Workspace>(window_id))
.filter_map(|window_id| cx.root_view(window_id)?.clone().downcast::<Workspace>())
.find(|workspace| {
workspace.read(cx).project().read(cx).remote_id() == Some(project_id)
})
@@ -84,6 +86,7 @@ fn join_project(action: &JoinProject, app_state: Arc<AppState>, cx: &mut Mutable
0,
project,
app_state.dock_default_item_factory,
app_state.background_actions,
cx,
);
(app_state.initialize_workspace)(&mut workspace, &app_state, cx);
@@ -116,7 +119,7 @@ fn join_project(action: &JoinProject, app_state: Arc<AppState>, cx: &mut Mutable
});
if let Some(follow_peer_id) = follow_peer_id {
if !workspace.is_following(follow_peer_id) {
if !workspace.is_being_followed(follow_peer_id) {
workspace
.toggle_follow(&ToggleFollow(follow_peer_id), cx)
.map(|follow| follow.detach_and_log_err(cx));

View File

@@ -0,0 +1,166 @@
use call::ActiveCall;
use client::UserStore;
use gpui::Action;
use gpui::{
actions, elements::*, platform::MouseButton, Entity, ModelHandle, RenderContext, View,
ViewContext,
};
use settings::Settings;
use crate::collab_titlebar_item::ToggleCollaboratorList;
pub(crate) enum Event {
Dismissed,
}
enum Collaborator {
SelfUser { username: String },
RemoteUser { username: String },
}
actions!(collaborator_list_popover, [NoOp]);
pub(crate) struct CollaboratorListPopover {
list_state: ListState,
}
impl Entity for CollaboratorListPopover {
type Event = Event;
}
impl View for CollaboratorListPopover {
fn ui_name() -> &'static str {
"CollaboratorListPopover"
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
let theme = cx.global::<Settings>().theme.clone();
MouseEventHandler::<Self>::new(0, cx, |_, _| {
List::new(self.list_state.clone())
.contained()
.with_style(theme.contacts_popover.container) //TODO: Change the name of this theme key
.constrained()
.with_width(theme.contacts_popover.width)
.with_height(theme.contacts_popover.height)
.boxed()
})
.on_down_out(MouseButton::Left, move |_, cx| {
cx.dispatch_action(ToggleCollaboratorList);
})
.boxed()
}
fn focus_out(&mut self, _: gpui::AnyViewHandle, cx: &mut ViewContext<Self>) {
cx.emit(Event::Dismissed);
}
}
impl CollaboratorListPopover {
pub fn new(user_store: ModelHandle<UserStore>, cx: &mut ViewContext<Self>) -> Self {
let active_call = ActiveCall::global(cx);
let mut collaborators = user_store
.read(cx)
.current_user()
.map(|u| Collaborator::SelfUser {
username: u.github_login.clone(),
})
.into_iter()
.collect::<Vec<_>>();
//TODO: What should the canonical sort here look like, consult contacts list implementation
if let Some(room) = active_call.read(cx).room() {
for participant in room.read(cx).remote_participants() {
collaborators.push(Collaborator::RemoteUser {
username: participant.1.user.github_login.clone(),
});
}
}
Self {
list_state: ListState::new(
collaborators.len(),
Orientation::Top,
0.,
cx,
move |_, index, cx| match &collaborators[index] {
Collaborator::SelfUser { username } => render_collaborator_list_entry(
index,
username,
None::<NoOp>,
None,
Svg::new("icons/chevron_right_12.svg"),
NoOp,
"Leave call".to_owned(),
cx,
),
Collaborator::RemoteUser { username } => render_collaborator_list_entry(
index,
username,
Some(NoOp),
Some(format!("Follow {username}")),
Svg::new("icons/x_mark_12.svg"),
NoOp,
format!("Remove {username} from call"),
cx,
),
},
),
}
}
}
fn render_collaborator_list_entry<UA: Action + Clone, IA: Action + Clone>(
index: usize,
username: &str,
username_action: Option<UA>,
username_tooltip: Option<String>,
icon: Svg,
icon_action: IA,
icon_tooltip: String,
cx: &mut RenderContext<CollaboratorListPopover>,
) -> ElementBox {
enum Username {}
enum UsernameTooltip {}
enum Icon {}
enum IconTooltip {}
let theme = &cx.global::<Settings>().theme;
let username_theme = theme.contact_list.contact_username.text.clone();
let tooltip_theme = theme.tooltip.clone();
let username = MouseEventHandler::<Username>::new(index, cx, |_, _| {
Label::new(username.to_owned(), username_theme.clone()).boxed()
})
.on_click(MouseButton::Left, move |_, cx| {
if let Some(username_action) = username_action.clone() {
cx.dispatch_action(username_action);
}
});
Flex::row()
.with_child(if let Some(username_tooltip) = username_tooltip {
username
.with_tooltip::<UsernameTooltip, _>(
index,
username_tooltip,
None,
tooltip_theme.clone(),
cx,
)
.boxed()
} else {
username.boxed()
})
.with_child(
MouseEventHandler::<Icon>::new(index, cx, |_, _| icon.boxed())
.on_click(MouseButton::Left, move |_, cx| {
cx.dispatch_action(icon_action.clone())
})
.with_tooltip::<IconTooltip, _>(index, icon_tooltip, None, tooltip_theme, cx)
.boxed(),
)
.boxed()
}

View File

@@ -1,14 +1,14 @@
use client::{ContactRequestStatus, User, UserStore};
use gpui::{
elements::*, AnyViewHandle, Entity, ModelHandle, MouseState, MutableAppContext, RenderContext,
Task, View, ViewContext, ViewHandle,
elements::*, AnyViewHandle, AppContext, Entity, ModelHandle, MouseState, RenderContext, Task,
View, ViewContext, ViewHandle,
};
use picker::{Picker, PickerDelegate};
use settings::Settings;
use std::sync::Arc;
use util::TryFutureExt;
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
Picker::<ContactFinder>::init(cx);
}
@@ -33,7 +33,7 @@ impl View for ContactFinder {
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
ChildView::new(self.picker.clone(), cx).boxed()
ChildView::new(&self.picker, cx).boxed()
}
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
@@ -68,7 +68,7 @@ impl PickerDelegate for ContactFinder {
this.potential_contacts = potential_contacts.into();
cx.notify();
});
Ok(())
anyhow::Ok(())
}
.log_err()
.await;
@@ -128,7 +128,7 @@ impl PickerDelegate for ContactFinder {
.style_for(mouse_state, selected);
Flex::row()
.with_children(user.avatar.clone().map(|avatar| {
Image::new(avatar)
Image::from_data(avatar)
.with_style(theme.contact_finder.contact_avatar)
.aligned()
.left()
@@ -178,4 +178,14 @@ impl ContactFinder {
selected_index: 0,
}
}
pub fn editor_text(&self, cx: &AppContext) -> String {
self.picker.read(cx).query(cx)
}
pub fn with_editor_text(self, editor_text: String, cx: &mut ViewContext<Self>) -> Self {
self.picker
.update(cx, |picker, cx| picker.set_query(editor_text, cx));
self
}
}

View File

@@ -1,3 +1,4 @@
use super::collab_titlebar_item::LeaveCall;
use crate::contacts_popover;
use call::ActiveCall;
use client::{proto::PeerId, Contact, User, UserStore};
@@ -9,8 +10,8 @@ use gpui::{
geometry::{rect::RectF, vector::vec2f},
impl_actions, impl_internal_actions,
keymap_matcher::KeymapContext,
AppContext, CursorStyle, Entity, ModelHandle, MouseButton, MutableAppContext, PromptLevel,
RenderContext, Subscription, View, ViewContext, ViewHandle,
platform::{CursorStyle, MouseButton, PromptLevel},
AppContext, Entity, ModelHandle, RenderContext, Subscription, View, ViewContext, ViewHandle,
};
use menu::{Confirm, SelectNext, SelectPrev};
use project::Project;
@@ -18,22 +19,20 @@ use serde::Deserialize;
use settings::Settings;
use std::{mem, sync::Arc};
use theme::IconButton;
use util::ResultExt;
use workspace::{JoinProject, OpenSharedScreen};
impl_actions!(contact_list, [RemoveContact, RespondToContactRequest]);
impl_internal_actions!(contact_list, [ToggleExpanded, Call, LeaveCall]);
impl_internal_actions!(contact_list, [ToggleExpanded, Call]);
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(ContactList::remove_contact);
cx.add_action(ContactList::respond_to_contact_request);
cx.add_action(ContactList::clear_filter);
cx.add_action(ContactList::cancel);
cx.add_action(ContactList::select_next);
cx.add_action(ContactList::select_prev);
cx.add_action(ContactList::confirm);
cx.add_action(ContactList::toggle_expanded);
cx.add_action(ContactList::call);
cx.add_action(ContactList::leave_call);
}
#[derive(Clone, PartialEq)]
@@ -45,9 +44,6 @@ struct Call {
initial_project: Option<ModelHandle<Project>>,
}
#[derive(Copy, Clone, PartialEq)]
struct LeaveCall;
#[derive(Clone, Copy, PartialEq, Eq, Debug, PartialOrd, Ord)]
enum Section {
ActiveCall,
@@ -145,7 +141,10 @@ impl PartialEq for ContactEntry {
pub struct RequestContact(pub u64);
#[derive(Clone, Deserialize, PartialEq)]
pub struct RemoveContact(pub u64);
pub struct RemoveContact {
user_id: u64,
github_login: String,
}
#[derive(Clone, Deserialize, PartialEq)]
pub struct RespondToContactRequest {
@@ -298,17 +297,39 @@ impl ContactList {
this
}
pub fn editor_text(&self, cx: &AppContext) -> String {
self.filter_editor.read(cx).text(cx)
}
pub fn with_editor_text(self, editor_text: String, cx: &mut ViewContext<Self>) -> Self {
self.filter_editor
.update(cx, |picker, cx| picker.set_text(editor_text, cx));
self
}
fn remove_contact(&mut self, request: &RemoveContact, cx: &mut ViewContext<Self>) {
let user_id = request.0;
let user_id = request.user_id;
let github_login = &request.github_login;
let user_store = self.user_store.clone();
let prompt_message = "Are you sure you want to remove this contact?";
let mut answer = cx.prompt(PromptLevel::Warning, prompt_message, &["Remove", "Cancel"]);
let prompt_message = format!(
"Are you sure you want to remove \"{}\" from your contacts?",
github_login
);
let mut answer = cx.prompt(PromptLevel::Warning, &prompt_message, &["Remove", "Cancel"]);
let window_id = cx.window_id();
cx.spawn(|_, mut cx| async move {
if answer.next().await == Some(0) {
user_store
if let Err(e) = user_store
.update(&mut cx, |store, cx| store.remove_contact(user_id, cx))
.await
.unwrap();
{
cx.prompt(
window_id,
PromptLevel::Info,
&format!("Failed to remove contact: {}", e),
&["Ok"],
);
}
}
})
.detach();
@@ -326,7 +347,7 @@ impl ContactList {
.detach();
}
fn clear_filter(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
let did_clear = self.filter_editor.update(cx, |editor, cx| {
if editor.buffer().read(cx).len(cx) > 0 {
editor.set_text("", cx);
@@ -335,6 +356,7 @@ impl ContactList {
false
}
});
if !did_clear {
cx.emit(Event::Dismissed);
}
@@ -729,7 +751,7 @@ impl ContactList {
) -> ElementBox {
Flex::row()
.with_children(user.avatar.clone().map(|avatar| {
Image::new(avatar)
Image::from_data(avatar)
.with_style(theme.contact_avatar)
.aligned()
.left()
@@ -749,7 +771,7 @@ impl ContactList {
)
.with_children(if is_pending {
Some(
Label::new("Calling".to_string(), theme.calling_indicator.text.clone())
Label::new("Calling", theme.calling_indicator.text.clone())
.contained()
.with_style(theme.calling_indicator.container)
.aligned()
@@ -950,7 +972,7 @@ impl ContactList {
.boxed(),
)
.with_child(
Label::new("Screen".into(), row.name.text.clone())
Label::new("Screen", row.name.text.clone())
.aligned()
.left()
.contained()
@@ -980,6 +1002,7 @@ impl ContactList {
cx: &mut RenderContext<Self>,
) -> ElementBox {
enum Header {}
enum LeaveCallContactList {}
let header_style = theme
.header_row
@@ -992,9 +1015,9 @@ impl ContactList {
};
let leave_call = if section == Section::ActiveCall {
Some(
MouseEventHandler::<LeaveCall>::new(0, cx, |state, _| {
MouseEventHandler::<LeaveCallContactList>::new(0, cx, |state, _| {
let style = theme.leave_call.style_for(state, false);
Label::new("Leave Session".into(), style.text.clone())
Label::new("Leave Call", style.text.clone())
.contained()
.with_style(style.container)
.boxed()
@@ -1026,7 +1049,7 @@ impl ContactList {
.boxed(),
)
.with_child(
Label::new(text.to_string(), header_style.text.clone())
Label::new(text, header_style.text.clone())
.aligned()
.left()
.contained()
@@ -1059,6 +1082,7 @@ impl ContactList {
let online = contact.online;
let busy = contact.busy || calling;
let user_id = contact.user.id;
let github_login = contact.user.github_login.clone();
let initial_project = project.clone();
let mut element =
MouseEventHandler::<Contact>::new(contact.user.id as usize, cx, |_, cx| {
@@ -1082,7 +1106,7 @@ impl ContactList {
};
Stack::new()
.with_child(
Image::new(avatar)
Image::from_data(avatar)
.with_style(theme.contact_avatar)
.aligned()
.left()
@@ -1119,14 +1143,17 @@ impl ContactList {
.with_padding(Padding::uniform(2.))
.with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, move |_, cx| {
cx.dispatch_action(RemoveContact(user_id))
cx.dispatch_action(RemoveContact {
user_id,
github_login: github_login.clone(),
})
})
.flex_float()
.boxed(),
)
.with_children(if calling {
Some(
Label::new("Calling".to_string(), theme.calling_indicator.text.clone())
Label::new("Calling", theme.calling_indicator.text.clone())
.contained()
.with_style(theme.calling_indicator.container)
.aligned()
@@ -1175,7 +1202,7 @@ impl ContactList {
let mut row = Flex::row()
.with_children(user.avatar.clone().map(|avatar| {
Image::new(avatar)
Image::from_data(avatar)
.with_style(theme.contact_avatar)
.aligned()
.left()
@@ -1195,6 +1222,7 @@ impl ContactList {
);
let user_id = user.id;
let github_login = user.github_login.clone();
let is_contact_request_pending = user_store.read(cx).is_contact_request_pending(&user);
let button_spacing = theme.contact_button_spacing;
@@ -1256,7 +1284,10 @@ impl ContactList {
.with_padding(Padding::uniform(2.))
.with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, move |_, cx| {
cx.dispatch_action(RemoveContact(user_id))
cx.dispatch_action(RemoveContact {
user_id,
github_login: github_login.clone(),
})
})
.flex_float()
.boxed(),
@@ -1283,12 +1314,6 @@ impl ContactList {
})
.detach_and_log_err(cx);
}
fn leave_call(&mut self, _: &LeaveCall, cx: &mut ViewContext<Self>) {
ActiveCall::global(cx)
.update(cx, |call, cx| call.hang_up(cx))
.log_err();
}
}
impl Entity for ContactList {
@@ -1302,7 +1327,7 @@ impl View for ContactList {
fn keymap_context(&self, _: &AppContext) -> KeymapContext {
let mut cx = Self::default_keymap_context();
cx.set.insert("menu".into());
cx.add_identifier("menu");
cx
}
@@ -1314,7 +1339,7 @@ impl View for ContactList {
.with_child(
Flex::row()
.with_child(
ChildView::new(self.filter_editor.clone(), cx)
ChildView::new(&self.filter_editor, cx)
.contained()
.with_style(theme.contact_list.user_query_editor.container)
.flex(1., true)
@@ -1334,7 +1359,7 @@ impl View for ContactList {
})
.with_tooltip::<AddContact, _>(
0,
"Add contact".into(),
"Search for new contact".into(),
None,
theme.tooltip.clone(),
cx,

View File

@@ -3,14 +3,14 @@ use std::sync::Arc;
use crate::notifications::render_user_notification;
use client::{ContactEventKind, User, UserStore};
use gpui::{
elements::*, impl_internal_actions, Entity, ModelHandle, MutableAppContext, RenderContext,
View, ViewContext,
elements::*, impl_internal_actions, AppContext, Entity, ModelHandle, RenderContext, View,
ViewContext,
};
use workspace::notifications::Notification;
impl_internal_actions!(contact_notifications, [Dismiss, RespondToContactRequest]);
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(ContactNotification::dismiss);
cx.add_action(ContactNotification::respond_to_contact_request);
}

View File

@@ -1,15 +1,15 @@
use crate::{contact_finder::ContactFinder, contact_list::ContactList, ToggleCollaborationMenu};
use crate::{contact_finder::ContactFinder, contact_list::ContactList, ToggleContactsMenu};
use client::UserStore;
use gpui::{
actions, elements::*, ClipboardItem, CursorStyle, Entity, ModelHandle, MouseButton,
MutableAppContext, RenderContext, View, ViewContext, ViewHandle,
actions, elements::*, platform::MouseButton, AppContext, Entity, ModelHandle, RenderContext,
View, ViewContext, ViewHandle,
};
use project::Project;
use settings::Settings;
actions!(contacts_popover, [ToggleContactFinder]);
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(ContactsPopover::toggle_contact_finder);
}
@@ -43,19 +43,23 @@ impl ContactsPopover {
user_store,
_subscription: None,
};
this.show_contact_list(cx);
this.show_contact_list(String::new(), cx);
this
}
fn toggle_contact_finder(&mut self, _: &ToggleContactFinder, cx: &mut ViewContext<Self>) {
match &self.child {
Child::ContactList(_) => self.show_contact_finder(cx),
Child::ContactFinder(_) => self.show_contact_list(cx),
Child::ContactList(list) => self.show_contact_finder(list.read(cx).editor_text(cx), cx),
Child::ContactFinder(finder) => {
self.show_contact_list(finder.read(cx).editor_text(cx), cx)
}
}
}
fn show_contact_finder(&mut self, cx: &mut ViewContext<ContactsPopover>) {
let child = cx.add_view(|cx| ContactFinder::new(self.user_store.clone(), cx));
fn show_contact_finder(&mut self, editor_text: String, cx: &mut ViewContext<ContactsPopover>) {
let child = cx.add_view(|cx| {
ContactFinder::new(self.user_store.clone(), cx).with_editor_text(editor_text, cx)
});
cx.focus(&child);
self._subscription = Some(cx.subscribe(&child, |_, _, event, cx| match event {
crate::contact_finder::Event::Dismissed => cx.emit(Event::Dismissed),
@@ -64,9 +68,11 @@ impl ContactsPopover {
cx.notify();
}
fn show_contact_list(&mut self, cx: &mut ViewContext<ContactsPopover>) {
let child =
cx.add_view(|cx| ContactList::new(self.project.clone(), self.user_store.clone(), cx));
fn show_contact_list(&mut self, editor_text: String, cx: &mut ViewContext<ContactsPopover>) {
let child = cx.add_view(|cx| {
ContactList::new(self.project.clone(), self.user_store.clone(), cx)
.with_editor_text(editor_text, cx)
});
cx.focus(&child);
self._subscription = Some(cx.subscribe(&child, |_, _, event, cx| match event {
crate::contact_list::Event::Dismissed => cx.emit(Event::Dismissed),
@@ -92,61 +98,9 @@ impl View for ContactsPopover {
Child::ContactFinder(child) => ChildView::new(child, cx),
};
MouseEventHandler::<ContactsPopover>::new(0, cx, |_, cx| {
MouseEventHandler::<ContactsPopover>::new(0, cx, |_, _| {
Flex::column()
.with_child(child.flex(1., true).boxed())
.with_children(
self.user_store
.read(cx)
.invite_info()
.cloned()
.and_then(|info| {
enum InviteLink {}
if info.count > 0 {
Some(
MouseEventHandler::<InviteLink>::new(0, cx, |state, cx| {
let style = theme
.contacts_popover
.invite_row
.style_for(state, false)
.clone();
let copied =
cx.read_from_clipboard().map_or(false, |item| {
item.text().as_str() == info.url.as_ref()
});
Label::new(
format!(
"{} invite link ({} left)",
if copied { "Copied" } else { "Copy" },
info.count
),
style.label.clone(),
)
.aligned()
.left()
.constrained()
.with_height(theme.contacts_popover.invite_row_height)
.contained()
.with_style(style.container)
.boxed()
})
.with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, move |_, cx| {
cx.write_to_clipboard(ClipboardItem::new(
info.url.to_string(),
));
cx.notify();
})
.boxed(),
)
} else {
None
}
}),
)
.contained()
.with_style(theme.contacts_popover.container)
.constrained()
@@ -155,7 +109,7 @@ impl View for ContactsPopover {
.boxed()
})
.on_down_out(MouseButton::Left, move |_, cx| {
cx.dispatch_action(ToggleCollaborationMenu);
cx.dispatch_action(ToggleContactsMenu);
})
.boxed()
}

View File

@@ -0,0 +1,101 @@
use std::ops::Range;
use gpui::{
geometry::{
rect::RectF,
vector::{vec2f, Vector2F},
},
json::ToJson,
serde_json::{self, json},
Axis, DebugContext, Element, ElementBox, MeasurementContext, PaintContext,
};
pub(crate) struct FacePile {
overlap: f32,
faces: Vec<ElementBox>,
}
impl FacePile {
pub fn new(overlap: f32) -> FacePile {
FacePile {
overlap,
faces: Vec::new(),
}
}
}
impl Element for FacePile {
type LayoutState = ();
type PaintState = ();
fn layout(
&mut self,
constraint: gpui::SizeConstraint,
cx: &mut gpui::LayoutContext,
) -> (Vector2F, Self::LayoutState) {
debug_assert!(constraint.max_along(Axis::Horizontal) == f32::INFINITY);
let mut width = 0.;
for face in &mut self.faces {
width += face.layout(constraint, cx).x();
}
width -= self.overlap * self.faces.len().saturating_sub(1) as f32;
(Vector2F::new(width, constraint.max.y()), ())
}
fn paint(
&mut self,
bounds: RectF,
visible_bounds: RectF,
_layout: &mut Self::LayoutState,
cx: &mut PaintContext,
) -> Self::PaintState {
let visible_bounds = bounds.intersection(visible_bounds).unwrap_or_default();
let origin_y = bounds.upper_right().y();
let mut origin_x = bounds.upper_right().x();
for face in self.faces.iter_mut().rev() {
let size = face.size();
origin_x -= size.x();
cx.paint_layer(None, |cx| {
face.paint(vec2f(origin_x, origin_y), visible_bounds, cx);
});
origin_x += self.overlap;
}
()
}
fn rect_for_text_range(
&self,
_: Range<usize>,
_: RectF,
_: RectF,
_: &Self::LayoutState,
_: &Self::PaintState,
_: &MeasurementContext,
) -> Option<RectF> {
None
}
fn debug(
&self,
bounds: RectF,
_: &Self::LayoutState,
_: &Self::PaintState,
_: &DebugContext,
) -> serde_json::Value {
json!({
"type": "FacePile",
"bounds": bounds.to_json()
})
}
}
impl Extend<ElementBox> for FacePile {
fn extend<T: IntoIterator<Item = ElementBox>>(&mut self, children: T) {
self.faces.extend(children);
}
}

View File

@@ -4,8 +4,9 @@ use futures::StreamExt;
use gpui::{
elements::*,
geometry::{rect::RectF, vector::vec2f},
impl_internal_actions, CursorStyle, Entity, MouseButton, MutableAppContext, RenderContext,
View, ViewContext, WindowBounds, WindowKind, WindowOptions,
impl_internal_actions,
platform::{CursorStyle, MouseButton, WindowBounds, WindowKind, WindowOptions},
AppContext, Entity, RenderContext, View, ViewContext,
};
use settings::Settings;
use util::ResultExt;
@@ -13,7 +14,7 @@ use workspace::JoinProject;
impl_internal_actions!(incoming_call_notification, [RespondToCall]);
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(IncomingCallNotification::respond_to_call);
let mut incoming_call = ActiveCall::global(cx).read(cx).incoming();
@@ -108,7 +109,7 @@ impl IncomingCallNotification {
.unwrap_or(&default_project);
Flex::row()
.with_children(self.call.calling_user.avatar.clone().map(|avatar| {
Image::new(avatar)
Image::from_data(avatar)
.with_style(theme.caller_avatar)
.aligned()
.boxed()
@@ -172,7 +173,7 @@ impl IncomingCallNotification {
.with_child(
MouseEventHandler::<Accept>::new(0, cx, |_, cx| {
let theme = &cx.global::<Settings>().theme.incoming_call_notification;
Label::new("Accept".to_string(), theme.accept_button.text.clone())
Label::new("Accept", theme.accept_button.text.clone())
.aligned()
.contained()
.with_style(theme.accept_button.container)
@@ -188,7 +189,7 @@ impl IncomingCallNotification {
.with_child(
MouseEventHandler::<Decline>::new(0, cx, |_, cx| {
let theme = &cx.global::<Settings>().theme.incoming_call_notification;
Label::new("Decline".to_string(), theme.decline_button.text.clone())
Label::new("Decline", theme.decline_button.text.clone())
.aligned()
.contained()
.with_style(theme.decline_button.container)

View File

@@ -1,7 +1,8 @@
use client::User;
use gpui::{
elements::*, platform::CursorStyle, Action, Element, ElementBox, MouseButton, RenderContext,
View,
elements::*,
platform::{CursorStyle, MouseButton},
Action, Element, ElementBox, RenderContext, View,
};
use settings::Settings;
use std::sync::Arc;
@@ -11,8 +12,8 @@ enum Button {}
pub fn render_user_notification<V: View, A: Action + Clone>(
user: Arc<User>,
title: &str,
body: Option<&str>,
title: &'static str,
body: Option<&'static str>,
dismiss_action: A,
buttons: Vec<(&'static str, Box<dyn Action>)>,
cx: &mut RenderContext<V>,
@@ -24,7 +25,7 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
.with_child(
Flex::row()
.with_children(user.avatar.clone().map(|avatar| {
Image::new(avatar)
Image::from_data(avatar)
.with_style(theme.header_avatar)
.aligned()
.constrained()
@@ -83,7 +84,7 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
.named("contact notification header"),
)
.with_children(body.map(|body| {
Label::new(body.to_string(), theme.body_message.text.clone())
Label::new(body, theme.body_message.text.clone())
.contained()
.with_style(theme.body_message.container)
.boxed()
@@ -97,7 +98,7 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
|(ix, (message, action))| {
MouseEventHandler::<Button>::new(ix, cx, |state, _| {
let button = theme.button.style_for(state, false);
Label::new(message.to_string(), button.text.clone())
Label::new(message, button.text.clone())
.contained()
.with_style(button.container)
.boxed()

View File

@@ -5,8 +5,8 @@ use gpui::{
actions,
elements::*,
geometry::{rect::RectF, vector::vec2f},
CursorStyle, Entity, MouseButton, MutableAppContext, RenderContext, View, ViewContext,
WindowBounds, WindowKind, WindowOptions,
platform::{CursorStyle, MouseButton, WindowBounds, WindowKind, WindowOptions},
AppContext, Entity, RenderContext, View, ViewContext,
};
use settings::Settings;
use std::sync::Arc;
@@ -14,7 +14,7 @@ use workspace::JoinProject;
actions!(project_shared_notification, [DismissProject]);
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(ProjectSharedNotification::join);
cx.add_action(ProjectSharedNotification::dismiss);
@@ -108,7 +108,7 @@ impl ProjectSharedNotification {
let theme = &cx.global::<Settings>().theme.project_shared_notification;
Flex::row()
.with_children(self.owner.avatar.clone().map(|avatar| {
Image::new(avatar)
Image::from_data(avatar)
.with_style(theme.owner_avatar)
.aligned()
.boxed()
@@ -175,7 +175,7 @@ impl ProjectSharedNotification {
.with_child(
MouseEventHandler::<Open>::new(0, cx, |_, cx| {
let theme = &cx.global::<Settings>().theme.project_shared_notification;
Label::new("Open".to_string(), theme.open_button.text.clone())
Label::new("Open", theme.open_button.text.clone())
.aligned()
.contained()
.with_style(theme.open_button.container)
@@ -194,7 +194,7 @@ impl ProjectSharedNotification {
.with_child(
MouseEventHandler::<Dismiss>::new(0, cx, |_, cx| {
let theme = &cx.global::<Settings>().theme.project_shared_notification;
Label::new("Dismiss".to_string(), theme.dismiss_button.text.clone())
Label::new("Dismiss", theme.dismiss_button.text.clone())
.aligned()
.contained()
.with_style(theme.dismiss_button.container)

View File

@@ -2,13 +2,14 @@ use call::ActiveCall;
use gpui::{
color::Color,
elements::{MouseEventHandler, Svg},
Appearance, Element, ElementBox, Entity, MouseButton, MutableAppContext, RenderContext, View,
platform::{Appearance, MouseButton},
AppContext, Element, ElementBox, Entity, RenderContext, View,
};
use settings::Settings;
use crate::ToggleScreenSharing;
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
let active_call = ActiveCall::global(cx);
let mut status_indicator = None;
@@ -21,6 +22,8 @@ pub fn init(cx: &mut MutableAppContext) {
} else if let Some((window_id, _)) = status_indicator.take() {
cx.remove_status_bar_item(window_id);
}
} else if let Some((window_id, _)) = status_indicator.take() {
cx.remove_status_bar_item(window_id);
}
})
.detach();

View File

@@ -24,3 +24,10 @@ pub type HashMap<K, V> = std::collections::HashMap<K, V>;
pub type HashSet<T> = std::collections::HashSet<T>;
pub use std::collections::*;
// NEW TYPES
#[derive(Default)]
pub struct CommandPaletteFilter {
pub filtered_namespaces: HashSet<&'static str>,
}

View File

@@ -24,7 +24,7 @@ workspace = { path = "../workspace" }
gpui = { path = "../gpui", features = ["test-support"] }
editor = { path = "../editor", features = ["test-support"] }
project = { path = "../project", features = ["test-support"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_json = { workspace = true }
workspace = { path = "../workspace", features = ["test-support"] }
ctor = "0.1"
env_logger = "0.9"

View File

@@ -1,10 +1,10 @@
use collections::HashSet;
use collections::CommandPaletteFilter;
use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{
actions,
elements::{ChildView, Flex, Label, ParentElement},
keymap_matcher::Keystroke,
Action, AnyViewHandle, Element, Entity, MouseState, MutableAppContext, RenderContext, View,
Action, AnyViewHandle, AppContext, Element, Entity, MouseState, RenderContext, View,
ViewContext, ViewHandle,
};
use picker::{Picker, PickerDelegate};
@@ -12,12 +12,7 @@ use settings::Settings;
use std::cmp;
use workspace::Workspace;
#[derive(Default)]
pub struct CommandPaletteFilter {
pub filtered_namespaces: HashSet<&'static str>,
}
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(CommandPalette::toggle);
Picker::<CommandPalette>::init(cx);
}
@@ -90,7 +85,7 @@ impl CommandPalette {
.unwrap_or_else(|| workspace.id());
cx.as_mut().defer(move |cx| {
let this = cx.add_view(workspace.clone(), |cx| Self::new(focused_view_id, cx));
let this = cx.add_view(&workspace, |cx| Self::new(focused_view_id, cx));
workspace.update(cx, |workspace, cx| {
workspace.toggle_modal(cx, |_, cx| {
cx.subscribe(&this, Self::on_event).detach();
@@ -134,7 +129,7 @@ impl View for CommandPalette {
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> gpui::ElementBox {
ChildView::new(self.picker.clone(), cx).boxed()
ChildView::new(&self.picker, cx).boxed()
}
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
@@ -257,7 +252,7 @@ impl PickerDelegate for CommandPalette {
.filter_map(|(modifier, label)| {
if modifier {
Some(
Label::new(label.into(), key_style.label.clone())
Label::new(label, key_style.label.clone())
.contained()
.with_style(key_style.container)
.boxed(),
@@ -352,9 +347,7 @@ mod tests {
});
let project = Project::test(app_state.fs.clone(), [], cx).await;
let (_, workspace) = cx.add_window(|cx| {
Workspace::new(Default::default(), 0, project, |_, _| unimplemented!(), cx)
});
let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project.clone(), cx));
let editor = cx.add_view(&workspace, |cx| {
let mut editor = Editor::single_line(None, cx);
editor.set_text("abc", cx);
@@ -362,7 +355,7 @@ mod tests {
});
workspace.update(cx, |workspace, cx| {
cx.focus(editor.clone());
cx.focus(&editor);
workspace.add_item(Box::new(editor.clone()), cx)
});

View File

@@ -13,4 +13,4 @@ gpui = { path = "../gpui" }
menu = { path = "../menu" }
settings = { path = "../settings" }
theme = { path = "../theme" }
smallvec = "1.6"
smallvec = { workspace = true }

View File

@@ -1,18 +1,24 @@
use gpui::{
elements::*, geometry::vector::Vector2F, impl_internal_actions, keymap_matcher::KeymapContext,
platform::CursorStyle, Action, AnyViewHandle, AppContext, Axis, Entity, MouseButton,
MutableAppContext, RenderContext, SizeConstraint, Subscription, View, ViewContext,
elements::*,
geometry::vector::Vector2F,
impl_internal_actions,
keymap_matcher::KeymapContext,
platform::{CursorStyle, MouseButton},
Action, AnyViewHandle, AppContext, Axis, Entity, MouseState, RenderContext, SizeConstraint,
Subscription, View, ViewContext,
};
use menu::*;
use settings::Settings;
use std::{any::TypeId, time::Duration};
use std::{any::TypeId, borrow::Cow, time::Duration};
pub type StaticItem = Box<dyn Fn(&mut AppContext) -> ElementBox>;
#[derive(Copy, Clone, PartialEq)]
struct Clicked;
impl_internal_actions!(context_menu, [Clicked]);
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(ContextMenu::select_first);
cx.add_action(ContextMenu::select_last);
cx.add_action(ContextMenu::select_next);
@@ -22,19 +28,71 @@ pub fn init(cx: &mut MutableAppContext) {
cx.add_action(ContextMenu::cancel);
}
pub enum ContextMenuItem {
Item {
label: String,
type ContextMenuItemBuilder = Box<dyn Fn(&mut MouseState, &theme::ContextMenuItem) -> ElementBox>;
pub enum ContextMenuItemLabel {
String(Cow<'static, str>),
Element(ContextMenuItemBuilder),
}
pub enum ContextMenuAction {
ParentAction {
action: Box<dyn Action>,
},
ViewAction {
action: Box<dyn Action>,
for_view: usize,
},
}
impl ContextMenuAction {
fn id(&self) -> TypeId {
match self {
ContextMenuAction::ParentAction { action } => action.id(),
ContextMenuAction::ViewAction { action, .. } => action.id(),
}
}
}
pub enum ContextMenuItem {
Item {
label: ContextMenuItemLabel,
action: ContextMenuAction,
},
Static(StaticItem),
Separator,
}
impl ContextMenuItem {
pub fn item(label: impl ToString, action: impl 'static + Action) -> Self {
pub fn element_item(label: ContextMenuItemBuilder, action: impl 'static + Action) -> Self {
Self::Item {
label: label.to_string(),
action: Box::new(action),
label: ContextMenuItemLabel::Element(label),
action: ContextMenuAction::ParentAction {
action: Box::new(action),
},
}
}
pub fn item(label: impl Into<Cow<'static, str>>, action: impl 'static + Action) -> Self {
Self::Item {
label: ContextMenuItemLabel::String(label.into()),
action: ContextMenuAction::ParentAction {
action: Box::new(action),
},
}
}
pub fn item_for_view(
label: impl Into<Cow<'static, str>>,
view_id: usize,
action: impl 'static + Action,
) -> Self {
Self::Item {
label: ContextMenuItemLabel::String(label.into()),
action: ContextMenuAction::ViewAction {
action: Box::new(action),
for_view: view_id,
},
}
}
@@ -42,14 +100,14 @@ impl ContextMenuItem {
Self::Separator
}
fn is_separator(&self) -> bool {
matches!(self, Self::Separator)
fn is_action(&self) -> bool {
matches!(self, Self::Item { .. })
}
fn action_id(&self) -> Option<TypeId> {
match self {
ContextMenuItem::Item { action, .. } => Some(action.id()),
ContextMenuItem::Separator => None,
ContextMenuItem::Static(..) | ContextMenuItem::Separator => None,
}
}
}
@@ -58,6 +116,7 @@ pub struct ContextMenu {
show_count: usize,
anchor_position: Vector2F,
anchor_corner: AnchorCorner,
position_mode: OverlayPositionMode,
items: Vec<ContextMenuItem>,
selected_index: Option<usize>,
visible: bool,
@@ -78,7 +137,7 @@ impl View for ContextMenu {
fn keymap_context(&self, _: &AppContext) -> KeymapContext {
let mut cx = Self::default_keymap_context();
cx.set.insert("menu".into());
cx.add_identifier("menu");
cx
}
@@ -105,6 +164,7 @@ impl View for ContextMenu {
.with_fit_mode(OverlayFitMode::SnapToWindow)
.with_anchor_position(self.anchor_position)
.with_anchor_corner(self.anchor_corner)
.with_position_mode(self.position_mode)
.boxed()
}
@@ -121,6 +181,7 @@ impl ContextMenu {
show_count: 0,
anchor_position: Default::default(),
anchor_corner: AnchorCorner::TopLeft,
position_mode: OverlayPositionMode::Window,
items: Default::default(),
selected_index: Default::default(),
visible: Default::default(),
@@ -162,7 +223,15 @@ impl ContextMenu {
fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext<Self>) {
if let Some(ix) = self.selected_index {
if let Some(ContextMenuItem::Item { action, .. }) = self.items.get(ix) {
cx.dispatch_any_action(action.boxed_clone());
match action {
ContextMenuAction::ParentAction { action } => {
cx.dispatch_any_action(action.boxed_clone())
}
ContextMenuAction::ViewAction { action, for_view } => {
let window_id = cx.window_id();
cx.dispatch_any_action_at(window_id, *for_view, action.boxed_clone())
}
};
self.reset(cx);
}
}
@@ -188,13 +257,13 @@ impl ContextMenu {
}
fn select_first(&mut self, _: &SelectFirst, cx: &mut ViewContext<Self>) {
self.selected_index = self.items.iter().position(|item| !item.is_separator());
self.selected_index = self.items.iter().position(|item| item.is_action());
cx.notify();
}
fn select_last(&mut self, _: &SelectLast, cx: &mut ViewContext<Self>) {
for (ix, item) in self.items.iter().enumerate().rev() {
if !item.is_separator() {
if item.is_action() {
self.selected_index = Some(ix);
cx.notify();
break;
@@ -205,7 +274,7 @@ impl ContextMenu {
fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext<Self>) {
if let Some(ix) = self.selected_index {
for (ix, item) in self.items.iter().enumerate().skip(ix + 1) {
if !item.is_separator() {
if item.is_action() {
self.selected_index = Some(ix);
cx.notify();
break;
@@ -219,7 +288,7 @@ impl ContextMenu {
fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext<Self>) {
if let Some(ix) = self.selected_index {
for (ix, item) in self.items.iter().enumerate().take(ix).rev() {
if !item.is_separator() {
if item.is_action() {
self.selected_index = Some(ix);
cx.notify();
break;
@@ -234,7 +303,7 @@ impl ContextMenu {
&mut self,
anchor_position: Vector2F,
anchor_corner: AnchorCorner,
items: impl IntoIterator<Item = ContextMenuItem>,
items: Vec<ContextMenuItem>,
cx: &mut ViewContext<Self>,
) {
let mut items = items.into_iter().peekable();
@@ -254,6 +323,10 @@ impl ContextMenu {
cx.notify();
}
pub fn set_position_mode(&mut self, mode: OverlayPositionMode) {
self.position_mode = mode;
}
fn render_menu_for_measurement(&self, cx: &mut RenderContext<Self>) -> impl Element {
let window_id = cx.window_id();
let style = cx.global::<Settings>().theme.context_menu.clone();
@@ -268,11 +341,21 @@ impl ContextMenu {
Some(ix) == self.selected_index,
);
Label::new(label.to_string(), style.label.clone())
.contained()
.with_style(style.container)
.boxed()
match label {
ContextMenuItemLabel::String(label) => {
Label::new(label.to_string(), style.label.clone())
.contained()
.with_style(style.container)
.boxed()
}
ContextMenuItemLabel::Element(element) => {
element(&mut Default::default(), style)
}
}
}
ContextMenuItem::Static(f) => f(cx),
ContextMenuItem::Separator => Empty::new()
.collapsed()
.contained()
@@ -293,15 +376,27 @@ impl ContextMenu {
&mut Default::default(),
Some(ix) == self.selected_index,
);
let (action, view_id) = match action {
ContextMenuAction::ParentAction { action } => {
(action.boxed_clone(), self.parent_view_id)
}
ContextMenuAction::ViewAction { action, for_view } => {
(action.boxed_clone(), *for_view)
}
};
KeystrokeLabel::new(
window_id,
self.parent_view_id,
view_id,
action.boxed_clone(),
style.keystroke.container,
style.keystroke.text.clone(),
)
.boxed()
}
ContextMenuItem::Static(_) => Empty::new().boxed(),
ContextMenuItem::Separator => Empty::new()
.collapsed()
.constrained()
@@ -331,22 +426,34 @@ impl ContextMenu {
.with_children(self.items.iter().enumerate().map(|(ix, item)| {
match item {
ContextMenuItem::Item { label, action } => {
let action = action.boxed_clone();
let (action, view_id) = match action {
ContextMenuAction::ParentAction { action } => {
(action.boxed_clone(), self.parent_view_id)
}
ContextMenuAction::ViewAction { action, for_view } => {
(action.boxed_clone(), *for_view)
}
};
MouseEventHandler::<MenuItem>::new(ix, cx, |state, _| {
let style =
style.item.style_for(state, Some(ix) == self.selected_index);
Flex::row()
.with_child(
Label::new(label.to_string(), style.label.clone())
.contained()
.boxed(),
)
.with_child(match label {
ContextMenuItemLabel::String(label) => {
Label::new(label.clone(), style.label.clone())
.contained()
.boxed()
}
ContextMenuItemLabel::Element(element) => {
element(state, style)
}
})
.with_child({
KeystrokeLabel::new(
window_id,
self.parent_view_id,
view_id,
action.boxed_clone(),
style.keystroke.container,
style.keystroke.text.clone(),
@@ -359,13 +466,19 @@ impl ContextMenu {
.boxed()
})
.with_cursor_style(CursorStyle::PointingHand)
.on_up(MouseButton::Left, |_, _| {}) // Capture these events
.on_down(MouseButton::Left, |_, _| {}) // Capture these events
.on_click(MouseButton::Left, move |_, cx| {
cx.dispatch_action(Clicked);
cx.dispatch_any_action(action.boxed_clone());
let window_id = cx.window_id();
cx.dispatch_any_action_at(window_id, view_id, action.boxed_clone());
})
.on_drag(MouseButton::Left, |_, _| {})
.boxed()
}
ContextMenuItem::Static(f) => f(cx),
ContextMenuItem::Separator => Empty::new()
.constrained()
.with_height(1.)

50
crates/copilot/Cargo.toml Normal file
View File

@@ -0,0 +1,50 @@
[package]
name = "copilot"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
path = "src/copilot.rs"
doctest = false
[features]
test-support = [
"collections/test-support",
"gpui/test-support",
"language/test-support",
"lsp/test-support",
"settings/test-support",
"util/test-support",
]
[dependencies]
collections = { path = "../collections" }
context_menu = { path = "../context_menu" }
gpui = { path = "../gpui" }
language = { path = "../language" }
settings = { path = "../settings" }
theme = { path = "../theme" }
lsp = { path = "../lsp" }
node_runtime = { path = "../node_runtime"}
util = { path = "../util" }
async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] }
async-tar = "0.4.2"
anyhow = "1.0"
log = "0.4"
serde = { workspace = true }
serde_derive = { workspace = true }
smol = "1.2.5"
futures = "0.3"
[dev-dependencies]
clock = { path = "../clock" }
collections = { path = "../collections", features = ["test-support"] }
fs = { path = "../fs", features = ["test-support"] }
gpui = { path = "../gpui", features = ["test-support"] }
language = { path = "../language", features = ["test-support"] }
lsp = { path = "../lsp", features = ["test-support"] }
rpc = { path = "../rpc", features = ["test-support"] }
settings = { path = "../settings", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] }
workspace = { path = "../workspace", features = ["test-support"] }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,225 @@
use serde::{Deserialize, Serialize};
pub enum CheckStatus {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CheckStatusParams {
pub local_checks_only: bool,
}
impl lsp::request::Request for CheckStatus {
type Params = CheckStatusParams;
type Result = SignInStatus;
const METHOD: &'static str = "checkStatus";
}
pub enum SignInInitiate {}
#[derive(Debug, Serialize, Deserialize)]
pub struct SignInInitiateParams {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "status")]
pub enum SignInInitiateResult {
AlreadySignedIn { user: String },
PromptUserDeviceFlow(PromptUserDeviceFlow),
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PromptUserDeviceFlow {
pub user_code: String,
pub verification_uri: String,
}
impl lsp::request::Request for SignInInitiate {
type Params = SignInInitiateParams;
type Result = SignInInitiateResult;
const METHOD: &'static str = "signInInitiate";
}
pub enum SignInConfirm {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SignInConfirmParams {
pub user_code: String,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "status")]
pub enum SignInStatus {
#[serde(rename = "OK")]
Ok {
user: String,
},
MaybeOk {
user: String,
},
AlreadySignedIn {
user: String,
},
NotAuthorized {
user: String,
},
NotSignedIn,
}
impl lsp::request::Request for SignInConfirm {
type Params = SignInConfirmParams;
type Result = SignInStatus;
const METHOD: &'static str = "signInConfirm";
}
pub enum SignOut {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SignOutParams {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SignOutResult {}
impl lsp::request::Request for SignOut {
type Params = SignOutParams;
type Result = SignOutResult;
const METHOD: &'static str = "signOut";
}
pub enum GetCompletions {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GetCompletionsParams {
pub doc: GetCompletionsDocument,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GetCompletionsDocument {
pub tab_size: u32,
pub indent_size: u32,
pub insert_spaces: bool,
pub uri: lsp::Url,
pub relative_path: String,
pub position: lsp::Position,
pub version: usize,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GetCompletionsResult {
pub completions: Vec<Completion>,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Completion {
pub text: String,
pub position: lsp::Position,
pub uuid: String,
pub range: lsp::Range,
pub display_text: String,
}
impl lsp::request::Request for GetCompletions {
type Params = GetCompletionsParams;
type Result = GetCompletionsResult;
const METHOD: &'static str = "getCompletions";
}
pub enum GetCompletionsCycling {}
impl lsp::request::Request for GetCompletionsCycling {
type Params = GetCompletionsParams;
type Result = GetCompletionsResult;
const METHOD: &'static str = "getCompletionsCycling";
}
pub enum LogMessage {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LogMessageParams {
pub message: String,
pub level: u8,
pub metadata_str: String,
pub extra: Vec<String>,
}
impl lsp::notification::Notification for LogMessage {
type Params = LogMessageParams;
const METHOD: &'static str = "LogMessage";
}
pub enum StatusNotification {}
#[derive(Debug, Serialize, Deserialize)]
pub struct StatusNotificationParams {
pub message: String,
pub status: String, // One of Normal/InProgress
}
impl lsp::notification::Notification for StatusNotification {
type Params = StatusNotificationParams;
const METHOD: &'static str = "statusNotification";
}
pub enum SetEditorInfo {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SetEditorInfoParams {
pub editor_info: EditorInfo,
pub editor_plugin_info: EditorPluginInfo,
}
impl lsp::request::Request for SetEditorInfo {
type Params = SetEditorInfoParams;
type Result = String;
const METHOD: &'static str = "setEditorInfo";
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EditorInfo {
pub name: String,
pub version: String,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EditorPluginInfo {
pub name: String,
pub version: String,
}
pub enum NotifyAccepted {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NotifyAcceptedParams {
pub uuid: String,
}
impl lsp::request::Request for NotifyAccepted {
type Params = NotifyAcceptedParams;
type Result = String;
const METHOD: &'static str = "notifyAccepted";
}
pub enum NotifyRejected {}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NotifyRejectedParams {
pub uuids: Vec<String>,
}
impl lsp::request::Request for NotifyRejected {
type Params = NotifyRejectedParams;
type Result = String;
const METHOD: &'static str = "notifyRejected";
}

View File

@@ -0,0 +1,391 @@
use crate::{request::PromptUserDeviceFlow, Copilot, Status};
use gpui::{
elements::*,
geometry::rect::RectF,
impl_internal_actions,
platform::{WindowBounds, WindowKind, WindowOptions},
AppContext, ClipboardItem, Element, Entity, View, ViewContext, ViewHandle,
};
use settings::Settings;
use theme::ui::modal;
#[derive(PartialEq, Eq, Debug, Clone)]
struct ClickedConnect;
impl_internal_actions!(copilot_verification, [ClickedConnect]);
#[derive(PartialEq, Eq, Debug, Clone)]
struct CopyUserCode;
#[derive(PartialEq, Eq, Debug, Clone)]
struct OpenGithub;
const COPILOT_SIGN_UP_URL: &'static str = "https://github.com/features/copilot";
pub fn init(cx: &mut AppContext) {
if let Some(copilot) = Copilot::global(cx) {
let mut code_verification: Option<ViewHandle<CopilotCodeVerification>> = None;
cx.observe(&copilot, move |copilot, cx| {
let status = copilot.read(cx).status();
match &status {
crate::Status::SigningIn { prompt } => {
if let Some(code_verification_handle) = code_verification.as_mut() {
if cx.has_window(code_verification_handle.window_id()) {
code_verification_handle.update(cx, |code_verification_view, cx| {
code_verification_view.set_status(status, cx)
});
cx.activate_window(code_verification_handle.window_id());
} else {
create_copilot_auth_window(cx, &status, &mut code_verification);
}
} else if let Some(_prompt) = prompt {
create_copilot_auth_window(cx, &status, &mut code_verification);
}
}
Status::Authorized | Status::Unauthorized => {
if let Some(code_verification) = code_verification.as_ref() {
code_verification.update(cx, |code_verification, cx| {
code_verification.set_status(status, cx)
});
cx.platform().activate(true);
cx.activate_window(code_verification.window_id());
}
}
_ => {
if let Some(code_verification) = code_verification.take() {
cx.remove_window(code_verification.window_id());
}
}
}
})
.detach();
cx.add_action(
|code_verification: &mut CopilotCodeVerification, _: &ClickedConnect, _| {
code_verification.connect_clicked = true;
},
);
}
}
fn create_copilot_auth_window(
cx: &mut AppContext,
status: &Status,
code_verification: &mut Option<ViewHandle<CopilotCodeVerification>>,
) {
let window_size = cx.global::<Settings>().theme.copilot.modal.dimensions();
let window_options = WindowOptions {
bounds: WindowBounds::Fixed(RectF::new(Default::default(), window_size)),
titlebar: None,
center: true,
focus: true,
kind: WindowKind::Normal,
is_movable: true,
screen: None,
};
let (_, view) = cx.add_window(window_options, |_cx| {
CopilotCodeVerification::new(status.clone())
});
*code_verification = Some(view);
}
pub struct CopilotCodeVerification {
status: Status,
connect_clicked: bool,
}
impl CopilotCodeVerification {
pub fn new(status: Status) -> Self {
Self {
status,
connect_clicked: false,
}
}
pub fn set_status(&mut self, status: Status, cx: &mut ViewContext<Self>) {
self.status = status;
cx.notify();
}
fn render_device_code(
data: &PromptUserDeviceFlow,
style: &theme::Copilot,
cx: &mut gpui::RenderContext<Self>,
) -> ElementBox {
let copied = cx
.read_from_clipboard()
.map(|item| item.text() == &data.user_code)
.unwrap_or(false);
let device_code_style = &style.auth.prompting.device_code;
MouseEventHandler::<Self>::new(0, cx, |state, _cx| {
Flex::row()
.with_children([
Label::new(data.user_code.clone(), device_code_style.text.clone())
.aligned()
.contained()
.with_style(device_code_style.left_container)
.constrained()
.with_width(device_code_style.left)
.boxed(),
Label::new(
if copied { "Copied!" } else { "Copy" },
device_code_style.cta.style_for(state, false).text.clone(),
)
.aligned()
.contained()
.with_style(*device_code_style.right_container.style_for(state, false))
.constrained()
.with_width(device_code_style.right)
.boxed(),
])
.contained()
.with_style(device_code_style.cta.style_for(state, false).container)
.boxed()
})
.on_click(gpui::platform::MouseButton::Left, {
let user_code = data.user_code.clone();
move |_, cx| {
cx.platform()
.write_to_clipboard(ClipboardItem::new(user_code.clone()));
cx.notify();
}
})
.with_cursor_style(gpui::platform::CursorStyle::PointingHand)
.boxed()
}
fn render_prompting_modal(
connect_clicked: bool,
data: &PromptUserDeviceFlow,
style: &theme::Copilot,
cx: &mut gpui::RenderContext<Self>,
) -> ElementBox {
Flex::column()
.with_children([
Flex::column()
.with_children([
Label::new(
"Enable Copilot by connecting",
style.auth.prompting.subheading.text.clone(),
)
.aligned()
.boxed(),
Label::new(
"your existing license.",
style.auth.prompting.subheading.text.clone(),
)
.aligned()
.boxed(),
])
.align_children_center()
.contained()
.with_style(style.auth.prompting.subheading.container)
.boxed(),
Self::render_device_code(data, &style, cx),
Flex::column()
.with_children([
Label::new(
"Paste this code into GitHub after",
style.auth.prompting.hint.text.clone(),
)
.aligned()
.boxed(),
Label::new(
"clicking the button below.",
style.auth.prompting.hint.text.clone(),
)
.aligned()
.boxed(),
])
.align_children_center()
.contained()
.with_style(style.auth.prompting.hint.container.clone())
.boxed(),
theme::ui::cta_button_with_click(
if connect_clicked {
"Waiting for connection..."
} else {
"Connect to GitHub"
},
style.auth.content_width,
&style.auth.cta_button,
cx,
{
let verification_uri = data.verification_uri.clone();
move |_, cx| {
cx.platform().open_url(&verification_uri);
cx.dispatch_action(ClickedConnect)
}
},
)
.boxed(),
])
.align_children_center()
.boxed()
}
fn render_enabled_modal(
style: &theme::Copilot,
cx: &mut gpui::RenderContext<Self>,
) -> ElementBox {
let enabled_style = &style.auth.authorized;
Flex::column()
.with_children([
Label::new("Copilot Enabled!", enabled_style.subheading.text.clone())
.contained()
.with_style(enabled_style.subheading.container)
.aligned()
.boxed(),
Flex::column()
.with_children([
Label::new(
"You can update your settings or",
enabled_style.hint.text.clone(),
)
.aligned()
.boxed(),
Label::new(
"sign out from the Copilot menu in",
enabled_style.hint.text.clone(),
)
.aligned()
.boxed(),
Label::new("the status bar.", enabled_style.hint.text.clone())
.aligned()
.boxed(),
])
.align_children_center()
.contained()
.with_style(enabled_style.hint.container)
.boxed(),
theme::ui::cta_button_with_click(
"Done",
style.auth.content_width,
&style.auth.cta_button,
cx,
|_, cx| {
let window_id = cx.window_id();
cx.remove_window(window_id)
},
)
.boxed(),
])
.align_children_center()
.boxed()
}
fn render_unauthorized_modal(
style: &theme::Copilot,
cx: &mut gpui::RenderContext<Self>,
) -> ElementBox {
let unauthorized_style = &style.auth.not_authorized;
Flex::column()
.with_children([
Flex::column()
.with_children([
Label::new(
"Enable Copilot by connecting",
unauthorized_style.subheading.text.clone(),
)
.aligned()
.boxed(),
Label::new(
"your existing license.",
unauthorized_style.subheading.text.clone(),
)
.aligned()
.boxed(),
])
.align_children_center()
.contained()
.with_style(unauthorized_style.subheading.container)
.boxed(),
Flex::column()
.with_children([
Label::new(
"You must have an active copilot",
unauthorized_style.warning.text.clone(),
)
.aligned()
.boxed(),
Label::new(
"license to use it in Zed.",
unauthorized_style.warning.text.clone(),
)
.aligned()
.boxed(),
])
.align_children_center()
.contained()
.with_style(unauthorized_style.warning.container)
.boxed(),
theme::ui::cta_button_with_click(
"Subscribe on GitHub",
style.auth.content_width,
&style.auth.cta_button,
cx,
|_, cx| {
let window_id = cx.window_id();
cx.remove_window(window_id);
cx.platform().open_url(COPILOT_SIGN_UP_URL)
},
)
.boxed(),
])
.align_children_center()
.boxed()
}
}
impl Entity for CopilotCodeVerification {
type Event = ();
}
impl View for CopilotCodeVerification {
fn ui_name() -> &'static str {
"CopilotCodeVerification"
}
fn focus_in(&mut self, _: gpui::AnyViewHandle, cx: &mut gpui::ViewContext<Self>) {
cx.notify()
}
fn focus_out(&mut self, _: gpui::AnyViewHandle, cx: &mut gpui::ViewContext<Self>) {
cx.notify()
}
fn render(&mut self, cx: &mut gpui::RenderContext<'_, Self>) -> gpui::ElementBox {
let style = cx.global::<Settings>().theme.clone();
modal("Connect Copilot to Zed", &style.copilot.modal, cx, |cx| {
Flex::column()
.with_children([
theme::ui::icon(&style.copilot.auth.header).boxed(),
match &self.status {
Status::SigningIn {
prompt: Some(prompt),
} => Self::render_prompting_modal(
self.connect_clicked,
&prompt,
&style.copilot,
cx,
),
Status::Unauthorized => {
self.connect_clicked = false;
Self::render_unauthorized_modal(&style.copilot, cx)
}
Status::Authorized => {
self.connect_clicked = false;
Self::render_enabled_modal(&style.copilot, cx)
}
_ => Empty::new().boxed(),
},
])
.align_children_center()
.boxed()
})
}
}

View File

@@ -0,0 +1,22 @@
[package]
name = "copilot_button"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
path = "src/copilot_button.rs"
doctest = false
[dependencies]
copilot = { path = "../copilot" }
editor = { path = "../editor" }
context_menu = { path = "../context_menu" }
gpui = { path = "../gpui" }
settings = { path = "../settings" }
theme = { path = "../theme" }
util = { path = "../util" }
workspace = { path = "../workspace" }
anyhow = "1.0"
smol = "1.2.5"
futures = "0.3"

View File

@@ -0,0 +1,387 @@
use std::sync::Arc;
use context_menu::{ContextMenu, ContextMenuItem};
use editor::Editor;
use gpui::{
elements::*,
impl_internal_actions,
platform::{CursorStyle, MouseButton},
AppContext, Element, ElementBox, Entity, MouseState, RenderContext, Subscription, View,
ViewContext, ViewHandle,
};
use settings::{settings_file::SettingsFile, Settings};
use workspace::{
item::ItemHandle, notifications::simple_message_notification::OsOpen, DismissToast,
StatusItemView,
};
use copilot::{Copilot, Reinstall, SignIn, SignOut, Status};
const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";
const COPILOT_STARTING_TOAST_ID: usize = 1337;
const COPILOT_ERROR_TOAST_ID: usize = 1338;
#[derive(Clone, PartialEq)]
pub struct DeployCopilotMenu;
#[derive(Clone, PartialEq)]
pub struct DeployCopilotStartMenu;
#[derive(Clone, PartialEq)]
pub struct HideCopilot;
#[derive(Clone, PartialEq)]
pub struct InitiateSignIn;
#[derive(Clone, PartialEq)]
pub struct ToggleCopilotForLanguage {
language: Arc<str>,
}
#[derive(Clone, PartialEq)]
pub struct ToggleCopilotGlobally;
// TODO: Make the other code path use `get_or_insert` logic for this modal
#[derive(Clone, PartialEq)]
pub struct DeployCopilotModal;
impl_internal_actions!(
copilot,
[
DeployCopilotMenu,
DeployCopilotStartMenu,
HideCopilot,
InitiateSignIn,
DeployCopilotModal,
ToggleCopilotForLanguage,
ToggleCopilotGlobally,
]
);
pub fn init(cx: &mut AppContext) {
cx.add_action(CopilotButton::deploy_copilot_menu);
cx.add_action(CopilotButton::deploy_copilot_start_menu);
cx.add_action(
|_: &mut CopilotButton, action: &ToggleCopilotForLanguage, cx| {
let language = action.language.clone();
let show_copilot_suggestions = cx
.global::<Settings>()
.show_copilot_suggestions(Some(&language));
SettingsFile::update(cx, move |file_contents| {
file_contents.languages.insert(
language,
settings::EditorSettings {
show_copilot_suggestions: Some((!show_copilot_suggestions).into()),
..Default::default()
},
);
})
},
);
cx.add_action(|_: &mut CopilotButton, _: &ToggleCopilotGlobally, cx| {
let show_copilot_suggestions = cx.global::<Settings>().show_copilot_suggestions(None);
SettingsFile::update(cx, move |file_contents| {
file_contents.editor.show_copilot_suggestions = Some((!show_copilot_suggestions).into())
})
});
cx.add_action(|_: &mut CopilotButton, _: &HideCopilot, cx| {
SettingsFile::update(cx, move |file_contents| {
file_contents.features.copilot = Some(false)
})
});
cx.add_action(|_: &mut CopilotButton, _: &InitiateSignIn, cx| {
let Some(copilot) = Copilot::global(cx) else {
return;
};
let status = copilot.read(cx).status();
match status {
Status::Starting { task } => {
cx.dispatch_action(workspace::Toast::new(
COPILOT_STARTING_TOAST_ID,
"Copilot is starting...",
));
let window_id = cx.window_id();
let task = task.to_owned();
cx.spawn(|handle, mut cx| async move {
task.await;
cx.update(|cx| {
if let Some(copilot) = Copilot::global(cx) {
let status = copilot.read(cx).status();
match status {
Status::Authorized => cx.dispatch_action_at(
window_id,
handle.id(),
workspace::Toast::new(
COPILOT_STARTING_TOAST_ID,
"Copilot has started!",
),
),
_ => {
cx.dispatch_action_at(
window_id,
handle.id(),
DismissToast::new(COPILOT_STARTING_TOAST_ID),
);
cx.dispatch_action_at(window_id, handle.id(), SignIn)
}
}
}
})
})
.detach();
}
_ => cx.dispatch_action(SignIn),
}
})
}
pub struct CopilotButton {
popup_menu: ViewHandle<ContextMenu>,
editor_subscription: Option<(Subscription, usize)>,
editor_enabled: Option<bool>,
language: Option<Arc<str>>,
}
impl Entity for CopilotButton {
type Event = ();
}
impl View for CopilotButton {
fn ui_name() -> &'static str {
"CopilotButton"
}
fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> ElementBox {
let settings = cx.global::<Settings>();
if !settings.features.copilot {
return Empty::new().boxed();
}
let theme = settings.theme.clone();
let active = self.popup_menu.read(cx).visible();
let Some(copilot) = Copilot::global(cx) else {
return Empty::new().boxed();
};
let status = copilot.read(cx).status();
let enabled = self
.editor_enabled
.unwrap_or(settings.show_copilot_suggestions(None));
Stack::new()
.with_child(
MouseEventHandler::<Self>::new(0, cx, {
let theme = theme.clone();
let status = status.clone();
move |state, _cx| {
let style = theme
.workspace
.status_bar
.sidebar_buttons
.item
.style_for(state, active);
Flex::row()
.with_child(
Svg::new({
match status {
Status::Error(_) => "icons/copilot_error_16.svg",
Status::Authorized => {
if enabled {
"icons/copilot_16.svg"
} else {
"icons/copilot_disabled_16.svg"
}
}
_ => "icons/copilot_init_16.svg",
}
})
.with_color(style.icon_color)
.constrained()
.with_width(style.icon_size)
.aligned()
.named("copilot-icon"),
)
.constrained()
.with_height(style.icon_size)
.contained()
.with_style(style.container)
.boxed()
}
})
.with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, {
let status = status.clone();
move |_, cx| match status {
Status::Authorized => cx.dispatch_action(DeployCopilotMenu),
Status::Error(ref e) => cx.dispatch_action(workspace::Toast::new_action(
COPILOT_ERROR_TOAST_ID,
format!("Copilot can't be started: {}", e),
"Reinstall Copilot",
Reinstall,
)),
_ => cx.dispatch_action(DeployCopilotStartMenu),
}
})
.with_tooltip::<Self, _>(
0,
"GitHub Copilot".into(),
None,
theme.tooltip.clone(),
cx,
)
.boxed(),
)
.with_child(
ChildView::new(&self.popup_menu, cx)
.aligned()
.top()
.right()
.boxed(),
)
.boxed()
}
}
impl CopilotButton {
pub fn new(cx: &mut ViewContext<Self>) -> Self {
let menu = cx.add_view(|cx| {
let mut menu = ContextMenu::new(cx);
menu.set_position_mode(OverlayPositionMode::Local);
menu
});
cx.observe(&menu, |_, _, cx| cx.notify()).detach();
Copilot::global(cx).map(|copilot| cx.observe(&copilot, |_, _, cx| cx.notify()).detach());
cx.observe_global::<Settings, _>(move |_, cx| cx.notify())
.detach();
Self {
popup_menu: menu,
editor_subscription: None,
editor_enabled: None,
language: None,
}
}
pub fn deploy_copilot_start_menu(
&mut self,
_: &DeployCopilotStartMenu,
cx: &mut ViewContext<Self>,
) {
let mut menu_options = Vec::with_capacity(2);
menu_options.push(ContextMenuItem::item("Sign In", InitiateSignIn));
menu_options.push(ContextMenuItem::item("Hide Copilot", HideCopilot));
self.popup_menu.update(cx, |menu, cx| {
menu.show(
Default::default(),
AnchorCorner::BottomRight,
menu_options,
cx,
);
});
}
pub fn deploy_copilot_menu(&mut self, _: &DeployCopilotMenu, cx: &mut ViewContext<Self>) {
let settings = cx.global::<Settings>();
let mut menu_options = Vec::with_capacity(6);
if let Some(language) = &self.language {
let language_enabled = settings.show_copilot_suggestions(Some(language.as_ref()));
menu_options.push(ContextMenuItem::item(
format!(
"{} Suggestions for {}",
if language_enabled { "Hide" } else { "Show" },
language
),
ToggleCopilotForLanguage {
language: language.to_owned(),
},
));
}
let globally_enabled = cx.global::<Settings>().show_copilot_suggestions(None);
menu_options.push(ContextMenuItem::item(
if globally_enabled {
"Hide Suggestions for All Files"
} else {
"Show Suggestions for All Files"
},
ToggleCopilotGlobally,
));
menu_options.push(ContextMenuItem::Separator);
let icon_style = settings.theme.copilot.out_link_icon.clone();
menu_options.push(ContextMenuItem::element_item(
Box::new(
move |state: &mut MouseState, style: &theme::ContextMenuItem| {
Flex::row()
.with_children([
Label::new("Copilot Settings", style.label.clone()).boxed(),
theme::ui::icon(icon_style.style_for(state, false)).boxed(),
])
.align_children_center()
.boxed()
},
),
OsOpen::new(COPILOT_SETTINGS_URL),
));
menu_options.push(ContextMenuItem::item("Sign Out", SignOut));
self.popup_menu.update(cx, |menu, cx| {
menu.show(
Default::default(),
AnchorCorner::BottomRight,
menu_options,
cx,
);
});
}
pub fn update_enabled(&mut self, editor: ViewHandle<Editor>, cx: &mut ViewContext<Self>) {
let editor = editor.read(cx);
let snapshot = editor.buffer().read(cx).snapshot(cx);
let settings = cx.global::<Settings>();
let suggestion_anchor = editor.selections.newest_anchor().start;
let language_name = snapshot
.language_at(suggestion_anchor)
.map(|language| language.name());
self.language = language_name.clone();
self.editor_enabled = Some(settings.show_copilot_suggestions(language_name.as_deref()));
cx.notify()
}
}
impl StatusItemView for CopilotButton {
fn set_active_pane_item(&mut self, item: Option<&dyn ItemHandle>, cx: &mut ViewContext<Self>) {
if let Some(editor) = item.map(|item| item.act_as::<Editor>(cx)).flatten() {
self.editor_subscription =
Some((cx.observe(&editor, Self::update_enabled), editor.id()));
self.update_enabled(editor, cx);
} else {
self.language = None;
self.editor_subscription = None;
self.editor_enabled = None;
}
cx.notify();
}
}

View File

@@ -23,7 +23,8 @@ async-trait = "0.1"
lazy_static = "1.4.0"
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
parking_lot = "0.11.1"
serde = { version = "1.0", features = ["derive"] }
serde = { workspace = true }
serde_derive = { workspace = true }
smol = "1.2"
[dev-dependencies]

View File

@@ -4,6 +4,7 @@ pub mod query;
// Re-export
pub use anyhow;
use anyhow::Context;
use gpui::AppContext;
pub use indoc::indoc;
pub use lazy_static;
use parking_lot::{Mutex, RwLock};
@@ -17,6 +18,7 @@ use sqlez::domain::Migrator;
use sqlez::thread_safe_connection::ThreadSafeConnection;
use sqlez_macros::sql;
use std::fs::create_dir_all;
use std::future::Future;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{SystemTime, UNIX_EPOCH};
@@ -39,6 +41,7 @@ const FALLBACK_DB_NAME: &'static str = "FALLBACK_MEMORY_DB";
const DB_FILE_NAME: &'static str = "db.sqlite";
lazy_static::lazy_static! {
// !!!!!!! CHANGE BACK TO DEFAULT FALSE BEFORE SHIPPING
static ref ZED_STATELESS: bool = std::env::var("ZED_STATELESS").map_or(false, |v| !v.is_empty());
static ref DB_FILE_OPERATIONS: Mutex<()> = Mutex::new(());
pub static ref BACKUP_DB_PATH: RwLock<Option<PathBuf>> = RwLock::new(None);
@@ -63,11 +66,11 @@ pub async fn open_db<M: Migrator + 'static>(
let connection = async_iife!({
// Note: This still has a race condition where 1 set of migrations succeeds
// (e.g. (Workspace, Editor)) and another fails (e.g. (Workspace, Terminal))
// This will cause the first connection to have the database taken out
// This will cause the first connection to have the database taken out
// from under it. This *should* be fine though. The second dabatase failure will
// cause errors in the log and so should be observed by developers while writing
// soon-to-be good migrations. If user databases are corrupted, we toss them out
// and try again from a blank. As long as running all migrations from start to end
// and try again from a blank. As long as running all migrations from start to end
// on a blank database is ok, this race condition will never be triggered.
//
// Basically: Don't ever push invalid migrations to stable or everyone will have
@@ -85,7 +88,7 @@ pub async fn open_db<M: Migrator + 'static>(
};
}
// Take a lock in the failure case so that we move the db once per process instead
// Take a lock in the failure case so that we move the db once per process instead
// of potentially multiple times from different threads. This shouldn't happen in the
// normal path
let _lock = DB_FILE_OPERATIONS.lock();
@@ -236,6 +239,15 @@ macro_rules! define_connection {
};
}
pub fn write_and_log<F>(cx: &mut AppContext, db_write: impl FnOnce() -> F + Send + 'static)
where
F: Future<Output = anyhow::Result<()>> + Send,
{
cx.background()
.spawn(async move { db_write().await.log_err() })
.detach()
}
#[cfg(test)]
mod tests {
use std::{fs, thread};

View File

@@ -10,23 +10,25 @@ doctest = false
[dependencies]
anyhow = "1.0"
smallvec = { version = "1.6", features = ["union"] }
smallvec = { workspace = true }
collections = { path = "../collections" }
editor = { path = "../editor" }
language = { path = "../language" }
lsp = { path = "../lsp" }
gpui = { path = "../gpui" }
project = { path = "../project" }
settings = { path = "../settings" }
theme = { path = "../theme" }
util = { path = "../util" }
workspace = { path = "../workspace" }
postage = { version = "0.4", features = ["futures-traits"] }
postage = { workspace = true }
[dev-dependencies]
unindent = "0.1"
client = { path = "../client", features = ["test-support"] }
editor = { path = "../editor", features = ["test-support"] }
language = { path = "../language", features = ["test-support"] }
lsp = { path = "../lsp", features = ["test-support"] }
gpui = { path = "../gpui", features = ["test-support"] }
workspace = { path = "../workspace", features = ["test-support"] }
serde_json = { version = "1", features = ["preserve_order"] }
serde_json = { workspace = true }

View File

@@ -1,7 +1,7 @@
pub mod items;
use anyhow::Result;
use collections::{BTreeMap, HashSet};
use collections::{BTreeSet, HashSet};
use editor::{
diagnostic_block_renderer,
display_map::{BlockDisposition, BlockId, BlockProperties, BlockStyle, RenderBlock},
@@ -11,19 +11,21 @@ use editor::{
};
use gpui::{
actions, elements::*, fonts::TextStyle, impl_internal_actions, serde_json, AnyViewHandle,
AppContext, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View, ViewContext,
ViewHandle, WeakViewHandle,
AppContext, Entity, ModelHandle, RenderContext, Task, View, ViewContext, ViewHandle,
WeakViewHandle,
};
use language::{
Anchor, Bias, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection,
SelectionGoal,
};
use lsp::LanguageServerId;
use project::{DiagnosticSummary, Project, ProjectPath};
use serde_json::json;
use settings::Settings;
use smallvec::SmallVec;
use std::{
any::{Any, TypeId},
borrow::Cow,
cmp::Ordering,
ops::Range,
path::PathBuf,
@@ -41,7 +43,7 @@ impl_internal_actions!(diagnostics, [Jump]);
const CONTEXT_LINE_COUNT: u32 = 1;
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(ProjectDiagnosticsEditor::deploy);
items::init(cx);
}
@@ -55,7 +57,7 @@ struct ProjectDiagnosticsEditor {
summary: DiagnosticSummary,
excerpts: ModelHandle<MultiBuffer>,
path_states: Vec<PathState>,
paths_to_update: BTreeMap<ProjectPath, usize>,
paths_to_update: BTreeSet<(ProjectPath, LanguageServerId)>,
}
struct PathState {
@@ -71,6 +73,7 @@ struct Jump {
}
struct DiagnosticGroupState {
language_server_id: LanguageServerId,
primary_diagnostic: DiagnosticEntry<language::Anchor>,
primary_excerpt_ix: usize,
excerpts: Vec<ExcerptId>,
@@ -90,14 +93,11 @@ impl View for ProjectDiagnosticsEditor {
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
if self.path_states.is_empty() {
let theme = &cx.global::<Settings>().theme.project_diagnostics;
Label::new(
"No problems in workspace".to_string(),
theme.empty_message.clone(),
)
.aligned()
.contained()
.with_style(theme.container)
.boxed()
Label::new("No problems in workspace", theme.empty_message.clone())
.aligned()
.contained()
.with_style(theme.container)
.boxed()
} else {
ChildView::new(&self.editor, cx).boxed()
}
@@ -118,7 +118,7 @@ impl View for ProjectDiagnosticsEditor {
}),
"summary": self.summary,
"paths_to_update": self.paths_to_update.iter().map(|(path, server_id)|
(path.path.to_string_lossy(), server_id)
(path.path.to_string_lossy(), server_id.0)
).collect::<Vec<_>>(),
"paths_states": self.path_states.iter().map(|state|
json!({
@@ -151,7 +151,7 @@ impl ProjectDiagnosticsEditor {
path,
} => {
this.paths_to_update
.insert(path.clone(), *language_server_id);
.insert((path.clone(), *language_server_id));
}
_ => {}
})
@@ -170,7 +170,7 @@ impl ProjectDiagnosticsEditor {
let project = project_handle.read(cx);
let paths_to_update = project
.diagnostic_summaries(cx)
.map(|e| (e.0, e.1.language_server_id))
.map(|(path, server_id, _)| (path, server_id))
.collect();
let summary = project.diagnostic_summary(cx);
let mut this = Self {
@@ -198,9 +198,13 @@ impl ProjectDiagnosticsEditor {
}
}
fn update_excerpts(&mut self, language_server_id: Option<usize>, cx: &mut ViewContext<Self>) {
fn update_excerpts(
&mut self,
language_server_id: Option<LanguageServerId>,
cx: &mut ViewContext<Self>,
) {
let mut paths = Vec::new();
self.paths_to_update.retain(|path, server_id| {
self.paths_to_update.retain(|(path, server_id)| {
if language_server_id
.map_or(true, |language_server_id| language_server_id == *server_id)
{
@@ -217,7 +221,9 @@ impl ProjectDiagnosticsEditor {
let buffer = project
.update(&mut cx, |project, cx| project.open_buffer(path.clone(), cx))
.await?;
this.update(&mut cx, |this, cx| this.populate_excerpts(path, buffer, cx))
this.update(&mut cx, |this, cx| {
this.populate_excerpts(path, language_server_id, buffer, cx)
})
}
Result::<_, anyhow::Error>::Ok(())
}
@@ -229,6 +235,7 @@ impl ProjectDiagnosticsEditor {
fn populate_excerpts(
&mut self,
path: ProjectPath,
language_server_id: Option<LanguageServerId>,
buffer: ModelHandle<Buffer>,
cx: &mut ViewContext<Self>,
) {
@@ -267,9 +274,9 @@ impl ProjectDiagnosticsEditor {
let excerpts_snapshot = self.excerpts.update(cx, |excerpts, excerpts_cx| {
let mut old_groups = path_state.diagnostic_groups.iter().enumerate().peekable();
let mut new_groups = snapshot
.diagnostic_groups()
.diagnostic_groups(language_server_id)
.into_iter()
.filter(|group| {
.filter(|(_, group)| {
group.entries[group.primary_ix].diagnostic.severity
<= DiagnosticSeverity::WARNING
})
@@ -281,12 +288,27 @@ impl ProjectDiagnosticsEditor {
match (old_groups.peek(), new_groups.peek()) {
(None, None) => break,
(None, Some(_)) => to_insert = new_groups.next(),
(Some(_), None) => to_remove = old_groups.next(),
(Some((_, old_group)), Some(new_group)) => {
(Some((_, old_group)), None) => {
if language_server_id.map_or(true, |id| id == old_group.language_server_id)
{
to_remove = old_groups.next();
} else {
to_keep = old_groups.next();
}
}
(Some((_, old_group)), Some((_, new_group))) => {
let old_primary = &old_group.primary_diagnostic;
let new_primary = &new_group.entries[new_group.primary_ix];
match compare_diagnostics(old_primary, new_primary, &snapshot) {
Ordering::Less => to_remove = old_groups.next(),
Ordering::Less => {
if language_server_id
.map_or(true, |id| id == old_group.language_server_id)
{
to_remove = old_groups.next();
} else {
to_keep = old_groups.next();
}
}
Ordering::Equal => {
to_keep = old_groups.next();
new_groups.next();
@@ -296,8 +318,9 @@ impl ProjectDiagnosticsEditor {
}
}
if let Some(group) = to_insert {
if let Some((language_server_id, group)) = to_insert {
let mut group_state = DiagnosticGroupState {
language_server_id,
primary_diagnostic: group.entries[group.primary_ix].clone(),
primary_excerpt_ix: 0,
excerpts: Default::default(),
@@ -534,6 +557,10 @@ impl Item for ProjectDiagnosticsEditor {
.update(cx, |editor, cx| editor.navigate(data, cx))
}
fn tab_tooltip_text(&self, _: &AppContext) -> Option<Cow<str>> {
Some("Project Diagnostics".into())
}
fn is_dirty(&self, cx: &AppContext) -> bool {
self.excerpts.read(cx).is_dirty(cx)
}
@@ -605,16 +632,16 @@ impl Item for ProjectDiagnosticsEditor {
))
}
fn act_as_type(
&self,
fn act_as_type<'a>(
&'a self,
type_id: TypeId,
self_handle: &ViewHandle<Self>,
_: &AppContext,
) -> Option<AnyViewHandle> {
self_handle: &'a ViewHandle<Self>,
_: &'a AppContext,
) -> Option<&AnyViewHandle> {
if type_id == TypeId::of::<Self>() {
Some(self_handle.into())
Some(self_handle)
} else if type_id == TypeId::of::<Editor>() {
Some((&self.editor).into())
Some(&self.editor)
} else {
None
}
@@ -697,7 +724,7 @@ pub(crate) fn render_summary(
theme: &theme::ProjectDiagnostics,
) -> ElementBox {
if summary.error_count == 0 && summary.warning_count == 0 {
Label::new("No problems".to_string(), text_style.clone()).boxed()
Label::new("No problems", text_style.clone()).boxed()
} else {
let icon_width = theme.tab_icon_width;
let icon_spacing = theme.tab_icon_spacing;
@@ -771,26 +798,24 @@ mod tests {
};
use gpui::TestAppContext;
use language::{Diagnostic, DiagnosticEntry, DiagnosticSeverity, PointUtf16, Unclipped};
use project::FakeFs;
use serde_json::json;
use unindent::Unindent as _;
use workspace::AppState;
#[gpui::test]
async fn test_diagnostics(cx: &mut TestAppContext) {
let app_state = cx.update(AppState::test);
app_state
.fs
.as_fake()
.insert_tree(
"/test",
json!({
"consts.rs": "
Settings::test_async(cx);
let fs = FakeFs::new(cx.background());
fs.insert_tree(
"/test",
json!({
"consts.rs": "
const a: i32 = 'a';
const b: i32 = c;
"
.unindent(),
.unindent(),
"main.rs": "
"main.rs": "
fn main() {
let x = vec![];
let y = vec![];
@@ -802,27 +827,20 @@ mod tests {
d(x);
}
"
.unindent(),
}),
)
.await;
.unindent(),
}),
)
.await;
let project = Project::test(app_state.fs.clone(), ["/test".as_ref()], cx).await;
let (_, workspace) = cx.add_window(|cx| {
Workspace::new(
Default::default(),
0,
project.clone(),
|_, _| unimplemented!(),
cx,
)
});
let language_server_id = LanguageServerId(0);
let project = Project::test(fs.clone(), ["/test".as_ref()], cx).await;
let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project.clone(), cx));
// Create some diagnostics
project.update(cx, |project, cx| {
project
.update_diagnostic_entries(
0,
language_server_id,
PathBuf::from("/test/main.rs"),
None,
vec![
@@ -971,10 +989,10 @@ mod tests {
// Diagnostics are added for another earlier path.
project.update(cx, |project, cx| {
project.disk_based_diagnostics_started(0, cx);
project.disk_based_diagnostics_started(language_server_id, cx);
project
.update_diagnostic_entries(
0,
language_server_id,
PathBuf::from("/test/consts.rs"),
None,
vec![DiagnosticEntry {
@@ -991,7 +1009,7 @@ mod tests {
cx,
)
.unwrap();
project.disk_based_diagnostics_finished(0, cx);
project.disk_based_diagnostics_finished(language_server_id, cx);
});
view.next_notification(cx).await;
@@ -1071,10 +1089,10 @@ mod tests {
// Diagnostics are added to the first path
project.update(cx, |project, cx| {
project.disk_based_diagnostics_started(0, cx);
project.disk_based_diagnostics_started(language_server_id, cx);
project
.update_diagnostic_entries(
0,
language_server_id,
PathBuf::from("/test/consts.rs"),
None,
vec![
@@ -1107,7 +1125,7 @@ mod tests {
cx,
)
.unwrap();
project.disk_based_diagnostics_finished(0, cx);
project.disk_based_diagnostics_finished(language_server_id, cx);
});
view.next_notification(cx).await;
@@ -1187,10 +1205,273 @@ mod tests {
});
}
fn editor_blocks(
editor: &ViewHandle<Editor>,
cx: &mut MutableAppContext,
) -> Vec<(u32, String)> {
#[gpui::test]
async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
Settings::test_async(cx);
let fs = FakeFs::new(cx.background());
fs.insert_tree(
"/test",
json!({
"main.js": "
a();
b();
c();
d();
e();
".unindent()
}),
)
.await;
let server_id_1 = LanguageServerId(100);
let server_id_2 = LanguageServerId(101);
let project = Project::test(fs.clone(), ["/test".as_ref()], cx).await;
let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project.clone(), cx));
let view = cx.add_view(&workspace, |cx| {
ProjectDiagnosticsEditor::new(project.clone(), workspace.downgrade(), cx)
});
// Two language servers start updating diagnostics
project.update(cx, |project, cx| {
project.disk_based_diagnostics_started(server_id_1, cx);
project.disk_based_diagnostics_started(server_id_2, cx);
project
.update_diagnostic_entries(
server_id_1,
PathBuf::from("/test/main.js"),
None,
vec![DiagnosticEntry {
range: Unclipped(PointUtf16::new(0, 0))..Unclipped(PointUtf16::new(0, 1)),
diagnostic: Diagnostic {
message: "error 1".to_string(),
severity: DiagnosticSeverity::WARNING,
is_primary: true,
is_disk_based: true,
group_id: 1,
..Default::default()
},
}],
cx,
)
.unwrap();
project
.update_diagnostic_entries(
server_id_2,
PathBuf::from("/test/main.js"),
None,
vec![DiagnosticEntry {
range: Unclipped(PointUtf16::new(1, 0))..Unclipped(PointUtf16::new(1, 1)),
diagnostic: Diagnostic {
message: "warning 1".to_string(),
severity: DiagnosticSeverity::ERROR,
is_primary: true,
is_disk_based: true,
group_id: 2,
..Default::default()
},
}],
cx,
)
.unwrap();
});
// The first language server finishes
project.update(cx, |project, cx| {
project.disk_based_diagnostics_finished(server_id_1, cx);
});
// Only the first language server's diagnostics are shown.
cx.foreground().run_until_parked();
view.update(cx, |view, cx| {
assert_eq!(
editor_blocks(&view.editor, cx),
[
(0, "path header block".into()),
(2, "diagnostic header".into()),
]
);
assert_eq!(
view.editor.update(cx, |editor, cx| editor.display_text(cx)),
concat!(
"\n", // filename
"\n", // padding
// diagnostic group 1
"\n", // primary message
"\n", // padding
"a();\n", //
"b();",
)
);
});
// The second language server finishes
project.update(cx, |project, cx| {
project.disk_based_diagnostics_finished(server_id_2, cx);
});
// Both language server's diagnostics are shown.
cx.foreground().run_until_parked();
view.update(cx, |view, cx| {
assert_eq!(
editor_blocks(&view.editor, cx),
[
(0, "path header block".into()),
(2, "diagnostic header".into()),
(6, "collapsed context".into()),
(7, "diagnostic header".into()),
]
);
assert_eq!(
view.editor.update(cx, |editor, cx| editor.display_text(cx)),
concat!(
"\n", // filename
"\n", // padding
// diagnostic group 1
"\n", // primary message
"\n", // padding
"a();\n", // location
"b();\n", //
"\n", // collapsed context
// diagnostic group 2
"\n", // primary message
"\n", // padding
"a();\n", // context
"b();\n", //
"c();", // context
)
);
});
// Both language servers start updating diagnostics, and the first server finishes.
project.update(cx, |project, cx| {
project.disk_based_diagnostics_started(server_id_1, cx);
project.disk_based_diagnostics_started(server_id_2, cx);
project
.update_diagnostic_entries(
server_id_1,
PathBuf::from("/test/main.js"),
None,
vec![DiagnosticEntry {
range: Unclipped(PointUtf16::new(2, 0))..Unclipped(PointUtf16::new(2, 1)),
diagnostic: Diagnostic {
message: "warning 2".to_string(),
severity: DiagnosticSeverity::WARNING,
is_primary: true,
is_disk_based: true,
group_id: 1,
..Default::default()
},
}],
cx,
)
.unwrap();
project
.update_diagnostic_entries(
server_id_2,
PathBuf::from("/test/main.rs"),
None,
vec![],
cx,
)
.unwrap();
project.disk_based_diagnostics_finished(server_id_1, cx);
});
// Only the first language server's diagnostics are updated.
cx.foreground().run_until_parked();
view.update(cx, |view, cx| {
assert_eq!(
editor_blocks(&view.editor, cx),
[
(0, "path header block".into()),
(2, "diagnostic header".into()),
(7, "collapsed context".into()),
(8, "diagnostic header".into()),
]
);
assert_eq!(
view.editor.update(cx, |editor, cx| editor.display_text(cx)),
concat!(
"\n", // filename
"\n", // padding
// diagnostic group 1
"\n", // primary message
"\n", // padding
"a();\n", // location
"b();\n", //
"c();\n", // context
"\n", // collapsed context
// diagnostic group 2
"\n", // primary message
"\n", // padding
"b();\n", // context
"c();\n", //
"d();", // context
)
);
});
// The second language server finishes.
project.update(cx, |project, cx| {
project
.update_diagnostic_entries(
server_id_2,
PathBuf::from("/test/main.js"),
None,
vec![DiagnosticEntry {
range: Unclipped(PointUtf16::new(3, 0))..Unclipped(PointUtf16::new(3, 1)),
diagnostic: Diagnostic {
message: "warning 2".to_string(),
severity: DiagnosticSeverity::WARNING,
is_primary: true,
is_disk_based: true,
group_id: 1,
..Default::default()
},
}],
cx,
)
.unwrap();
project.disk_based_diagnostics_finished(server_id_2, cx);
});
// Both language servers' diagnostics are updated.
cx.foreground().run_until_parked();
view.update(cx, |view, cx| {
assert_eq!(
editor_blocks(&view.editor, cx),
[
(0, "path header block".into()),
(2, "diagnostic header".into()),
(7, "collapsed context".into()),
(8, "diagnostic header".into()),
]
);
assert_eq!(
view.editor.update(cx, |editor, cx| editor.display_text(cx)),
concat!(
"\n", // filename
"\n", // padding
// diagnostic group 1
"\n", // primary message
"\n", // padding
"b();\n", // location
"c();\n", //
"d();\n", // context
"\n", // collapsed context
// diagnostic group 2
"\n", // primary message
"\n", // padding
"c();\n", // context
"d();\n", //
"e();", // context
)
);
});
}
fn editor_blocks(editor: &ViewHandle<Editor>, cx: &mut AppContext) -> Vec<(u32, String)> {
let mut presenter = cx.build_presenter(editor.id(), 0., Default::default());
let mut cx = presenter.build_layout_context(Default::default(), false, cx);
cx.render(editor, |editor, cx| {

View File

@@ -1,10 +1,13 @@
use collections::HashSet;
use editor::{Editor, GoToDiagnostic};
use gpui::{
elements::*, platform::CursorStyle, serde_json, Entity, ModelHandle, MouseButton,
MutableAppContext, RenderContext, Subscription, View, ViewContext, ViewHandle, WeakViewHandle,
elements::*,
platform::{CursorStyle, MouseButton},
serde_json, AppContext, Entity, ModelHandle, RenderContext, Subscription, View, ViewContext,
ViewHandle, WeakViewHandle,
};
use language::Diagnostic;
use lsp::LanguageServerId;
use project::Project;
use settings::Settings;
use workspace::{item::ItemHandle, StatusItemView};
@@ -13,11 +16,11 @@ pub struct DiagnosticIndicator {
summary: project::DiagnosticSummary,
active_editor: Option<WeakViewHandle<Editor>>,
current_diagnostic: Option<Diagnostic>,
in_progress_checks: HashSet<usize>,
in_progress_checks: HashSet<LanguageServerId>,
_observe_active_editor: Option<Subscription>,
}
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(DiagnosticIndicator::go_to_next_diagnostic);
}
@@ -178,14 +181,11 @@ impl View for DiagnosticIndicator {
if in_progress {
element.add_child(
Label::new(
"Checking…".into(),
style.diagnostic_message.default.text.clone(),
)
.aligned()
.contained()
.with_margin_left(item_spacing)
.boxed(),
Label::new("Checking…", style.diagnostic_message.default.text.clone())
.aligned()
.contained()
.with_margin_left(item_spacing)
.boxed(),
);
} else if let Some(diagnostic) = &self.current_diagnostic {
let message_style = style.diagnostic_message.clone();

View File

@@ -4,9 +4,9 @@ use collections::HashSet;
use gpui::{
elements::{Empty, MouseEventHandler, Overlay},
geometry::{rect::RectF, vector::Vector2F},
platform::{CursorStyle, MouseButton},
scene::{MouseDown, MouseDrag},
CursorStyle, Element, ElementBox, EventContext, MouseButton, MutableAppContext, RenderContext,
View, WeakViewHandle,
AppContext, Element, ElementBox, EventContext, RenderContext, View, WeakViewHandle,
};
const DEAD_ZONE: f32 = 4.;
@@ -261,7 +261,7 @@ impl<V: View> DragAndDrop<V> {
})
}
pub fn cancel_dragging<P: Any>(&mut self, cx: &mut MutableAppContext) {
pub fn cancel_dragging<P: Any>(&mut self, cx: &mut AppContext) {
if let Some(State::Dragging {
payload, window_id, ..
}) = &self.currently_dragged
@@ -274,13 +274,13 @@ impl<V: View> DragAndDrop<V> {
}
}
fn finish_dragging(&mut self, cx: &mut MutableAppContext) {
fn finish_dragging(&mut self, cx: &mut AppContext) {
if let Some(State::Dragging { window_id, .. }) = self.currently_dragged.take() {
self.notify_containers_for_window(window_id, cx);
}
}
fn notify_containers_for_window(&mut self, window_id: usize, cx: &mut MutableAppContext) {
fn notify_containers_for_window(&mut self, window_id: usize, cx: &mut AppContext) {
self.containers.retain(|container| {
if let Some(container) = container.upgrade(cx) {
if container.window_id() == window_id {

View File

@@ -11,20 +11,22 @@ doctest = false
[features]
test-support = [
"rand",
"copilot/test-support",
"text/test-support",
"language/test-support",
"gpui/test-support",
"project/test-support",
"util/test-support",
"workspace/test-support",
"tree-sitter-rust"
"tree-sitter-rust",
"tree-sitter-typescript"
]
[dependencies]
drag_and_drop = { path = "../drag_and_drop" }
text = { path = "../text" }
clock = { path = "../clock" }
copilot = { path = "../copilot" }
db = { path = "../db" }
drag_and_drop = { path = "../drag_and_drop" }
collections = { path = "../collections" }
context_menu = { path = "../context_menu" }
fuzzy = { path = "../fuzzy" }
@@ -37,10 +39,12 @@ rpc = { path = "../rpc" }
settings = { path = "../settings" }
snippet = { path = "../snippet" }
sum_tree = { path = "../sum_tree" }
text = { path = "../text" }
theme = { path = "../theme" }
util = { path = "../util" }
sqlez = { path = "../sqlez" }
workspace = { path = "../workspace" }
aho-corasick = "0.7"
anyhow = "1.0"
futures = "0.3"
@@ -50,16 +54,19 @@ lazy_static = "1.4"
log = { version = "0.4.16", features = ["kv_unstable_serde"] }
ordered-float = "2.1.1"
parking_lot = "0.11"
postage = { version = "0.4", features = ["futures-traits"] }
postage = { workspace = true }
rand = { version = "0.8.3", optional = true }
serde = { workspace = true }
smallvec = { version = "1.6", features = ["union"] }
serde_derive = { workspace = true }
smallvec = { workspace = true }
smol = "1.2"
tree-sitter-rust = { version = "*", optional = true }
tree-sitter-html = { version = "*", optional = true }
tree-sitter-javascript = { version = "*", optional = true }
tree-sitter-typescript = { git = "https://github.com/tree-sitter/tree-sitter-typescript", rev = "5d20856f34315b068c41edaee2ac8a100081d259", optional = true }
[dev-dependencies]
copilot = { path = "../copilot", features = ["test-support"] }
text = { path = "../text", features = ["test-support"] }
language = { path = "../language", features = ["test-support"] }
lsp = { path = "../lsp", features = ["test-support"] }
@@ -75,4 +82,5 @@ unindent = "0.1.7"
tree-sitter = "0.20"
tree-sitter-rust = "0.20"
tree-sitter-html = "0.19"
tree-sitter-typescript = { git = "https://github.com/tree-sitter/tree-sitter-typescript", rev = "5d20856f34315b068c41edaee2ac8a100081d259" }
tree-sitter-javascript = "0.20"

View File

@@ -15,12 +15,9 @@ pub struct BlinkManager {
impl BlinkManager {
pub fn new(blink_interval: Duration, cx: &mut ModelContext<Self>) -> Self {
let weak_handle = cx.weak_handle();
cx.observe_global::<Settings, _>(move |_, cx| {
if let Some(this) = weak_handle.upgrade(cx) {
// Make sure we blink the cursors if the setting is re-enabled
this.update(cx, |this, cx| this.blink_cursors(this.blink_epoch, cx));
}
cx.observe_global::<Settings, _>(move |this, cx| {
// Make sure we blink the cursors if the setting is re-enabled
this.blink_cursors(this.blink_epoch, cx)
})
.detach();

View File

@@ -1,19 +1,23 @@
mod block_map;
mod fold_map;
mod suggestion_map;
mod tab_map;
mod wrap_map;
use crate::{Anchor, AnchorRangeExt, MultiBuffer, MultiBufferSnapshot, ToOffset, ToPoint};
use block_map::{BlockMap, BlockPoint};
pub use block_map::{BlockMap, BlockPoint};
use collections::{HashMap, HashSet};
use fold_map::FoldMap;
use fold_map::{FoldMap, FoldOffset};
use gpui::{
color::Color,
fonts::{FontId, HighlightStyle},
Entity, ModelContext, ModelHandle,
};
use language::{OffsetUtf16, Point, Subscription as BufferSubscription};
use settings::Settings;
use std::{any::TypeId, fmt::Debug, num::NonZeroU32, ops::Range, sync::Arc};
pub use suggestion_map::Suggestion;
use suggestion_map::SuggestionMap;
use sum_tree::{Bias, TreeMap};
use tab_map::TabMap;
use wrap_map::WrapMap;
@@ -23,6 +27,12 @@ pub use block_map::{
BlockDisposition, BlockId, BlockProperties, BlockStyle, RenderBlock, TransformBlock,
};
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum FoldStatus {
Folded,
Foldable,
}
pub trait ToDisplayPoint {
fn to_display_point(&self, map: &DisplaySnapshot) -> DisplayPoint;
}
@@ -33,6 +43,7 @@ pub struct DisplayMap {
buffer: ModelHandle<MultiBuffer>,
buffer_subscription: BufferSubscription,
fold_map: FoldMap,
suggestion_map: SuggestionMap,
tab_map: TabMap,
wrap_map: ModelHandle<WrapMap>,
block_map: BlockMap,
@@ -58,6 +69,7 @@ impl DisplayMap {
let tab_size = Self::tab_size(&buffer, cx);
let (fold_map, snapshot) = FoldMap::new(buffer.read(cx).snapshot(cx));
let (suggestion_map, snapshot) = SuggestionMap::new(snapshot);
let (tab_map, snapshot) = TabMap::new(snapshot, tab_size);
let (wrap_map, snapshot) = WrapMap::new(snapshot, font_id, font_size, wrap_width, cx);
let block_map = BlockMap::new(snapshot, buffer_header_height, excerpt_header_height);
@@ -66,6 +78,7 @@ impl DisplayMap {
buffer,
buffer_subscription,
fold_map,
suggestion_map,
tab_map,
wrap_map,
block_map,
@@ -77,21 +90,25 @@ impl DisplayMap {
pub fn snapshot(&self, cx: &mut ModelContext<Self>) -> DisplaySnapshot {
let buffer_snapshot = self.buffer.read(cx).snapshot(cx);
let edits = self.buffer_subscription.consume().into_inner();
let (folds_snapshot, edits) = self.fold_map.read(buffer_snapshot, edits);
let (fold_snapshot, edits) = self.fold_map.read(buffer_snapshot, edits);
let (suggestion_snapshot, edits) = self.suggestion_map.sync(fold_snapshot.clone(), edits);
let tab_size = Self::tab_size(&self.buffer, cx);
let (tabs_snapshot, edits) = self.tab_map.sync(folds_snapshot.clone(), edits, tab_size);
let (wraps_snapshot, edits) = self
let (tab_snapshot, edits) = self
.tab_map
.sync(suggestion_snapshot.clone(), edits, tab_size);
let (wrap_snapshot, edits) = self
.wrap_map
.update(cx, |map, cx| map.sync(tabs_snapshot.clone(), edits, cx));
let blocks_snapshot = self.block_map.read(wraps_snapshot.clone(), edits);
.update(cx, |map, cx| map.sync(tab_snapshot.clone(), edits, cx));
let block_snapshot = self.block_map.read(wrap_snapshot.clone(), edits);
DisplaySnapshot {
buffer_snapshot: self.buffer.read(cx).snapshot(cx),
folds_snapshot,
tabs_snapshot,
wraps_snapshot,
blocks_snapshot,
fold_snapshot,
suggestion_snapshot,
tab_snapshot,
wrap_snapshot,
block_snapshot,
text_highlights: self.text_highlights.clone(),
clip_at_line_ends: self.clip_at_line_ends,
}
@@ -115,12 +132,14 @@ impl DisplayMap {
let edits = self.buffer_subscription.consume().into_inner();
let tab_size = Self::tab_size(&self.buffer, cx);
let (mut fold_map, snapshot, edits) = self.fold_map.write(snapshot, edits);
let (snapshot, edits) = self.suggestion_map.sync(snapshot, edits);
let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size);
let (snapshot, edits) = self
.wrap_map
.update(cx, |map, cx| map.sync(snapshot, edits, cx));
self.block_map.read(snapshot, edits);
let (snapshot, edits) = fold_map.fold(ranges);
let (snapshot, edits) = self.suggestion_map.sync(snapshot, edits);
let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size);
let (snapshot, edits) = self
.wrap_map
@@ -138,12 +157,14 @@ impl DisplayMap {
let edits = self.buffer_subscription.consume().into_inner();
let tab_size = Self::tab_size(&self.buffer, cx);
let (mut fold_map, snapshot, edits) = self.fold_map.write(snapshot, edits);
let (snapshot, edits) = self.suggestion_map.sync(snapshot, edits);
let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size);
let (snapshot, edits) = self
.wrap_map
.update(cx, |map, cx| map.sync(snapshot, edits, cx));
self.block_map.read(snapshot, edits);
let (snapshot, edits) = fold_map.unfold(ranges, inclusive);
let (snapshot, edits) = self.suggestion_map.sync(snapshot, edits);
let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size);
let (snapshot, edits) = self
.wrap_map
@@ -160,6 +181,7 @@ impl DisplayMap {
let edits = self.buffer_subscription.consume().into_inner();
let tab_size = Self::tab_size(&self.buffer, cx);
let (snapshot, edits) = self.fold_map.read(snapshot, edits);
let (snapshot, edits) = self.suggestion_map.sync(snapshot, edits);
let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size);
let (snapshot, edits) = self
.wrap_map
@@ -177,6 +199,7 @@ impl DisplayMap {
let edits = self.buffer_subscription.consume().into_inner();
let tab_size = Self::tab_size(&self.buffer, cx);
let (snapshot, edits) = self.fold_map.read(snapshot, edits);
let (snapshot, edits) = self.suggestion_map.sync(snapshot, edits);
let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size);
let (snapshot, edits) = self
.wrap_map
@@ -207,11 +230,41 @@ impl DisplayMap {
self.text_highlights.remove(&Some(type_id))
}
pub fn has_suggestion(&self) -> bool {
self.suggestion_map.has_suggestion()
}
pub fn replace_suggestion<T>(
&self,
new_suggestion: Option<Suggestion<T>>,
cx: &mut ModelContext<Self>,
) -> Option<Suggestion<FoldOffset>>
where
T: ToPoint,
{
let snapshot = self.buffer.read(cx).snapshot(cx);
let edits = self.buffer_subscription.consume().into_inner();
let tab_size = Self::tab_size(&self.buffer, cx);
let (snapshot, edits) = self.fold_map.read(snapshot, edits);
let (snapshot, edits, old_suggestion) =
self.suggestion_map.replace(new_suggestion, snapshot, edits);
let (snapshot, edits) = self.tab_map.sync(snapshot, edits, tab_size);
let (snapshot, edits) = self
.wrap_map
.update(cx, |map, cx| map.sync(snapshot, edits, cx));
self.block_map.read(snapshot, edits);
old_suggestion
}
pub fn set_font(&self, font_id: FontId, font_size: f32, cx: &mut ModelContext<Self>) -> bool {
self.wrap_map
.update(cx, |map, cx| map.set_font(font_id, font_size, cx))
}
pub fn set_fold_ellipses_color(&mut self, color: Color) -> bool {
self.fold_map.set_ellipses_color(color)
}
pub fn set_wrap_width(&self, width: Option<f32>, cx: &mut ModelContext<Self>) -> bool {
self.wrap_map
.update(cx, |map, cx| map.set_wrap_width(width, cx))
@@ -235,10 +288,11 @@ impl DisplayMap {
pub struct DisplaySnapshot {
pub buffer_snapshot: MultiBufferSnapshot,
folds_snapshot: fold_map::FoldSnapshot,
tabs_snapshot: tab_map::TabSnapshot,
wraps_snapshot: wrap_map::WrapSnapshot,
blocks_snapshot: block_map::BlockSnapshot,
fold_snapshot: fold_map::FoldSnapshot,
suggestion_snapshot: suggestion_map::SuggestionSnapshot,
tab_snapshot: tab_map::TabSnapshot,
wrap_snapshot: wrap_map::WrapSnapshot,
block_snapshot: block_map::BlockSnapshot,
text_highlights: TextHighlights,
clip_at_line_ends: bool,
}
@@ -246,7 +300,7 @@ pub struct DisplaySnapshot {
impl DisplaySnapshot {
#[cfg(test)]
pub fn fold_count(&self) -> usize {
self.folds_snapshot.fold_count()
self.fold_snapshot.fold_count()
}
pub fn is_empty(&self) -> bool {
@@ -254,7 +308,7 @@ impl DisplaySnapshot {
}
pub fn buffer_rows(&self, start_row: u32) -> DisplayBufferRows {
self.blocks_snapshot.buffer_rows(start_row)
self.block_snapshot.buffer_rows(start_row)
}
pub fn max_buffer_row(&self) -> u32 {
@@ -263,9 +317,9 @@ impl DisplaySnapshot {
pub fn prev_line_boundary(&self, mut point: Point) -> (Point, DisplayPoint) {
loop {
let mut fold_point = self.folds_snapshot.to_fold_point(point, Bias::Left);
let mut fold_point = self.fold_snapshot.to_fold_point(point, Bias::Left);
*fold_point.column_mut() = 0;
point = fold_point.to_buffer_point(&self.folds_snapshot);
point = fold_point.to_buffer_point(&self.fold_snapshot);
let mut display_point = self.point_to_display_point(point, Bias::Left);
*display_point.column_mut() = 0;
@@ -279,9 +333,9 @@ impl DisplaySnapshot {
pub fn next_line_boundary(&self, mut point: Point) -> (Point, DisplayPoint) {
loop {
let mut fold_point = self.folds_snapshot.to_fold_point(point, Bias::Right);
*fold_point.column_mut() = self.folds_snapshot.line_len(fold_point.row());
point = fold_point.to_buffer_point(&self.folds_snapshot);
let mut fold_point = self.fold_snapshot.to_fold_point(point, Bias::Right);
*fold_point.column_mut() = self.fold_snapshot.line_len(fold_point.row());
point = fold_point.to_buffer_point(&self.fold_snapshot);
let mut display_point = self.point_to_display_point(point, Bias::Right);
*display_point.column_mut() = self.line_len(display_point.row());
@@ -311,37 +365,39 @@ impl DisplaySnapshot {
}
fn point_to_display_point(&self, point: Point, bias: Bias) -> DisplayPoint {
let fold_point = self.folds_snapshot.to_fold_point(point, bias);
let tab_point = self.tabs_snapshot.to_tab_point(fold_point);
let wrap_point = self.wraps_snapshot.tab_point_to_wrap_point(tab_point);
let block_point = self.blocks_snapshot.to_block_point(wrap_point);
let fold_point = self.fold_snapshot.to_fold_point(point, bias);
let suggestion_point = self.suggestion_snapshot.to_suggestion_point(fold_point);
let tab_point = self.tab_snapshot.to_tab_point(suggestion_point);
let wrap_point = self.wrap_snapshot.tab_point_to_wrap_point(tab_point);
let block_point = self.block_snapshot.to_block_point(wrap_point);
DisplayPoint(block_point)
}
fn display_point_to_point(&self, point: DisplayPoint, bias: Bias) -> Point {
let block_point = point.0;
let wrap_point = self.blocks_snapshot.to_wrap_point(block_point);
let tab_point = self.wraps_snapshot.to_tab_point(wrap_point);
let fold_point = self.tabs_snapshot.to_fold_point(tab_point, bias).0;
fold_point.to_buffer_point(&self.folds_snapshot)
let wrap_point = self.block_snapshot.to_wrap_point(block_point);
let tab_point = self.wrap_snapshot.to_tab_point(wrap_point);
let suggestion_point = self.tab_snapshot.to_suggestion_point(tab_point, bias).0;
let fold_point = self.suggestion_snapshot.to_fold_point(suggestion_point);
fold_point.to_buffer_point(&self.fold_snapshot)
}
pub fn max_point(&self) -> DisplayPoint {
DisplayPoint(self.blocks_snapshot.max_point())
DisplayPoint(self.block_snapshot.max_point())
}
/// Returns text chunks starting at the given display row until the end of the file
pub fn text_chunks(&self, display_row: u32) -> impl Iterator<Item = &str> {
self.blocks_snapshot
.chunks(display_row..self.max_point().row() + 1, false, None)
self.block_snapshot
.chunks(display_row..self.max_point().row() + 1, false, None, None)
.map(|h| h.text)
}
/// Returns text chunks starting at the end of the given display row in reverse until the start of the file
pub fn reverse_text_chunks(&self, display_row: u32) -> impl Iterator<Item = &str> {
(0..=display_row).into_iter().rev().flat_map(|row| {
self.blocks_snapshot
.chunks(row..row + 1, false, None)
self.block_snapshot
.chunks(row..row + 1, false, None, None)
.map(|h| h.text)
.collect::<Vec<_>>()
.into_iter()
@@ -349,16 +405,25 @@ impl DisplaySnapshot {
})
}
pub fn chunks(&self, display_rows: Range<u32>, language_aware: bool) -> DisplayChunks<'_> {
self.blocks_snapshot
.chunks(display_rows, language_aware, Some(&self.text_highlights))
pub fn chunks(
&self,
display_rows: Range<u32>,
language_aware: bool,
suggestion_highlight: Option<HighlightStyle>,
) -> DisplayChunks<'_> {
self.block_snapshot.chunks(
display_rows,
language_aware,
Some(&self.text_highlights),
suggestion_highlight,
)
}
pub fn chars_at(
&self,
mut point: DisplayPoint,
) -> impl Iterator<Item = (char, DisplayPoint)> + '_ {
point = DisplayPoint(self.blocks_snapshot.clip_point(point.0, Bias::Left));
point = DisplayPoint(self.block_snapshot.clip_point(point.0, Bias::Left));
self.text_chunks(point.row())
.flat_map(str::chars)
.skip_while({
@@ -385,7 +450,7 @@ impl DisplaySnapshot {
&self,
mut point: DisplayPoint,
) -> impl Iterator<Item = (char, DisplayPoint)> + '_ {
point = DisplayPoint(self.blocks_snapshot.clip_point(point.0, Bias::Left));
point = DisplayPoint(self.block_snapshot.clip_point(point.0, Bias::Left));
self.reverse_text_chunks(point.row())
.flat_map(|chunk| chunk.chars().rev())
.skip_while({
@@ -499,7 +564,7 @@ impl DisplaySnapshot {
}
pub fn clip_point(&self, point: DisplayPoint, bias: Bias) -> DisplayPoint {
let mut clipped = self.blocks_snapshot.clip_point(point.0, bias);
let mut clipped = self.block_snapshot.clip_point(point.0, bias);
if self.clip_at_line_ends {
clipped = self.clip_at_line_end(DisplayPoint(clipped)).0
}
@@ -510,7 +575,7 @@ impl DisplaySnapshot {
let mut point = point.0;
if point.column == self.line_len(point.row) {
point.column = point.column.saturating_sub(1);
point = self.blocks_snapshot.clip_point(point, Bias::Left);
point = self.block_snapshot.clip_point(point, Bias::Left);
}
DisplayPoint(point)
}
@@ -519,37 +584,34 @@ impl DisplaySnapshot {
where
T: ToOffset,
{
self.folds_snapshot.folds_in_range(range)
self.fold_snapshot.folds_in_range(range)
}
pub fn blocks_in_range(
&self,
rows: Range<u32>,
) -> impl Iterator<Item = (u32, &TransformBlock)> {
self.blocks_snapshot.blocks_in_range(rows)
self.block_snapshot.blocks_in_range(rows)
}
pub fn intersects_fold<T: ToOffset>(&self, offset: T) -> bool {
self.folds_snapshot.intersects_fold(offset)
self.fold_snapshot.intersects_fold(offset)
}
pub fn is_line_folded(&self, display_row: u32) -> bool {
let block_point = BlockPoint(Point::new(display_row, 0));
let wrap_point = self.blocks_snapshot.to_wrap_point(block_point);
let tab_point = self.wraps_snapshot.to_tab_point(wrap_point);
self.folds_snapshot.is_line_folded(tab_point.row())
pub fn is_line_folded(&self, buffer_row: u32) -> bool {
self.fold_snapshot.is_line_folded(buffer_row)
}
pub fn is_block_line(&self, display_row: u32) -> bool {
self.blocks_snapshot.is_block_line(display_row)
self.block_snapshot.is_block_line(display_row)
}
pub fn soft_wrap_indent(&self, display_row: u32) -> Option<u32> {
let wrap_row = self
.blocks_snapshot
.block_snapshot
.to_wrap_point(BlockPoint::new(display_row, 0))
.row();
self.wraps_snapshot.soft_wrap_indent(wrap_row)
self.wrap_snapshot.soft_wrap_indent(wrap_row)
}
pub fn text(&self) -> String {
@@ -583,12 +645,92 @@ impl DisplaySnapshot {
(indent, is_blank)
}
pub fn line_indent_for_buffer_row(&self, buffer_row: u32) -> (u32, bool) {
let (buffer, range) = self
.buffer_snapshot
.buffer_line_for_row(buffer_row)
.unwrap();
let mut indent_size = 0;
let mut is_blank = false;
for c in buffer.chars_at(Point::new(range.start.row, 0)) {
if c == ' ' || c == '\t' {
indent_size += 1;
} else {
if c == '\n' {
is_blank = true;
}
break;
}
}
(indent_size, is_blank)
}
pub fn line_len(&self, row: u32) -> u32 {
self.blocks_snapshot.line_len(row)
self.block_snapshot.line_len(row)
}
pub fn longest_row(&self) -> u32 {
self.blocks_snapshot.longest_row()
self.block_snapshot.longest_row()
}
pub fn fold_for_line(self: &Self, buffer_row: u32) -> Option<FoldStatus> {
if self.is_line_folded(buffer_row) {
Some(FoldStatus::Folded)
} else if self.is_foldable(buffer_row) {
Some(FoldStatus::Foldable)
} else {
None
}
}
pub fn is_foldable(self: &Self, buffer_row: u32) -> bool {
let max_row = self.buffer_snapshot.max_buffer_row();
if buffer_row >= max_row {
return false;
}
let (indent_size, is_blank) = self.line_indent_for_buffer_row(buffer_row);
if is_blank {
return false;
}
for next_row in (buffer_row + 1)..=max_row {
let (next_indent_size, next_line_is_blank) = self.line_indent_for_buffer_row(next_row);
if next_indent_size > indent_size {
return true;
} else if !next_line_is_blank {
break;
}
}
false
}
pub fn foldable_range(self: &Self, buffer_row: u32) -> Option<Range<Point>> {
let start = Point::new(buffer_row, self.buffer_snapshot.line_len(buffer_row));
if self.is_foldable(start.row) && !self.is_line_folded(start.row) {
let (start_indent, _) = self.line_indent_for_buffer_row(buffer_row);
let max_point = self.buffer_snapshot.max_point();
let mut end = None;
for row in (buffer_row + 1)..=max_point.row {
let (indent, is_blank) = self.line_indent_for_buffer_row(row);
if !is_blank && indent <= start_indent {
let prev_row = row - 1;
end = Some(Point::new(
prev_row,
self.buffer_snapshot.line_len(prev_row),
));
break;
}
}
let end = end.unwrap_or(max_point);
Some(start..end)
} else {
None
}
}
#[cfg(any(test, feature = "test-support"))]
@@ -647,10 +789,11 @@ impl DisplayPoint {
}
pub fn to_offset(self, map: &DisplaySnapshot, bias: Bias) -> usize {
let unblocked_point = map.blocks_snapshot.to_wrap_point(self.0);
let unwrapped_point = map.wraps_snapshot.to_tab_point(unblocked_point);
let unexpanded_point = map.tabs_snapshot.to_fold_point(unwrapped_point, bias).0;
unexpanded_point.to_buffer_offset(&map.folds_snapshot)
let wrap_point = map.block_snapshot.to_wrap_point(self.0);
let tab_point = map.wrap_snapshot.to_tab_point(wrap_point);
let suggestion_point = map.tab_snapshot.to_suggestion_point(tab_point, bias).0;
let fold_point = map.suggestion_snapshot.to_fold_point(suggestion_point);
fold_point.to_buffer_offset(&map.fold_snapshot)
}
}
@@ -678,11 +821,29 @@ impl ToDisplayPoint for Anchor {
}
}
pub fn next_rows(display_row: u32, display_map: &DisplaySnapshot) -> impl Iterator<Item = u32> {
let max_row = display_map.max_point().row();
let start_row = display_row + 1;
let mut current = None;
std::iter::from_fn(move || {
if current == None {
current = Some(start_row);
} else {
current = Some(current.unwrap() + 1)
}
if current.unwrap() > max_row {
None
} else {
current
}
})
}
#[cfg(test)]
pub mod tests {
use super::*;
use crate::{movement, test::marked_display_snapshot};
use gpui::{color::Color, elements::*, test::observe, MutableAppContext};
use gpui::{color::Color, elements::*, test::observe, AppContext};
use language::{Buffer, Language, LanguageConfig, SelectionGoal};
use rand::{prelude::*, Rng};
use smol::stream::StreamExt;
@@ -703,7 +864,9 @@ pub mod tests {
let mut tab_size = rng.gen_range(1..=4);
let buffer_start_excerpt_header_height = rng.gen_range(1..=5);
let excerpt_header_height = rng.gen_range(1..=5);
let family_id = font_cache.load_family(&["Helvetica"]).unwrap();
let family_id = font_cache
.load_family(&["Helvetica"], &Default::default())
.unwrap();
let font_id = font_cache
.select_font(family_id, &Default::default())
.unwrap();
@@ -753,10 +916,10 @@ pub mod tests {
let snapshot = map.update(cx, |map, cx| map.snapshot(cx));
log::info!("buffer text: {:?}", snapshot.buffer_snapshot.text());
log::info!("fold text: {:?}", snapshot.folds_snapshot.text());
log::info!("tab text: {:?}", snapshot.tabs_snapshot.text());
log::info!("wrap text: {:?}", snapshot.wraps_snapshot.text());
log::info!("block text: {:?}", snapshot.blocks_snapshot.text());
log::info!("fold text: {:?}", snapshot.fold_snapshot.text());
log::info!("tab text: {:?}", snapshot.tab_snapshot.text());
log::info!("wrap text: {:?}", snapshot.wrap_snapshot.text());
log::info!("block text: {:?}", snapshot.block_snapshot.text());
log::info!("display text: {:?}", snapshot.text());
for _i in 0..operations {
@@ -861,10 +1024,10 @@ pub mod tests {
let snapshot = map.update(cx, |map, cx| map.snapshot(cx));
fold_count = snapshot.fold_count();
log::info!("buffer text: {:?}", snapshot.buffer_snapshot.text());
log::info!("fold text: {:?}", snapshot.folds_snapshot.text());
log::info!("tab text: {:?}", snapshot.tabs_snapshot.text());
log::info!("wrap text: {:?}", snapshot.wraps_snapshot.text());
log::info!("block text: {:?}", snapshot.blocks_snapshot.text());
log::info!("fold text: {:?}", snapshot.fold_snapshot.text());
log::info!("tab text: {:?}", snapshot.tab_snapshot.text());
log::info!("wrap text: {:?}", snapshot.wrap_snapshot.text());
log::info!("block text: {:?}", snapshot.block_snapshot.text());
log::info!("display text: {:?}", snapshot.text());
// Line boundaries
@@ -954,13 +1117,15 @@ pub mod tests {
}
#[gpui::test(retries = 5)]
fn test_soft_wraps(cx: &mut MutableAppContext) {
fn test_soft_wraps(cx: &mut AppContext) {
cx.foreground().set_block_on_ticks(usize::MAX..=usize::MAX);
cx.foreground().forbid_parking();
let font_cache = cx.font_cache();
let family_id = font_cache.load_family(&["Helvetica"]).unwrap();
let family_id = font_cache
.load_family(&["Helvetica"], &Default::default())
.unwrap();
let font_id = font_cache
.select_font(family_id, &Default::default())
.unwrap();
@@ -1045,11 +1210,14 @@ pub mod tests {
}
#[gpui::test]
fn test_text_chunks(cx: &mut gpui::MutableAppContext) {
fn test_text_chunks(cx: &mut gpui::AppContext) {
cx.set_global(Settings::test(cx));
let text = sample_text(6, 6, 'a');
let buffer = MultiBuffer::build_simple(&text, cx);
let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap();
let family_id = cx
.font_cache()
.load_family(&["Helvetica"], &Default::default())
.unwrap();
let font_id = cx
.font_cache()
.select_font(family_id, &Default::default())
@@ -1132,7 +1300,9 @@ pub mod tests {
let buffer = cx.add_model(|cx| MultiBuffer::singleton(buffer, cx));
let font_cache = cx.font_cache();
let family_id = font_cache.load_family(&["Helvetica"]).unwrap();
let family_id = font_cache
.load_family(&["Helvetica"], &Default::default())
.unwrap();
let font_id = font_cache
.select_font(family_id, &Default::default())
.unwrap();
@@ -1167,7 +1337,7 @@ pub mod tests {
vec![
("fn ".to_string(), None),
("out".to_string(), Some(Color::blue())),
("".to_string(), None),
("".to_string(), None),
(" fn ".to_string(), Some(Color::red())),
("inner".to_string(), Some(Color::blue())),
("() {}\n}".to_string(), Some(Color::red())),
@@ -1220,7 +1390,9 @@ pub mod tests {
let font_cache = cx.font_cache();
let family_id = font_cache.load_family(&["Courier"]).unwrap();
let family_id = font_cache
.load_family(&["Courier"], &Default::default())
.unwrap();
let font_id = font_cache
.select_font(family_id, &Default::default())
.unwrap();
@@ -1248,7 +1420,7 @@ pub mod tests {
cx.update(|cx| syntax_chunks(1..4, &map, &theme, cx)),
[
("out".to_string(), Some(Color::blue())),
("\n".to_string(), None),
("\n".to_string(), None),
(" \nfn ".to_string(), Some(Color::red())),
("i\n".to_string(), Some(Color::blue()))
]
@@ -1292,7 +1464,9 @@ pub mod tests {
let buffer_snapshot = buffer.read_with(cx, |buffer, cx| buffer.snapshot(cx));
let font_cache = cx.font_cache();
let family_id = font_cache.load_family(&["Courier"]).unwrap();
let family_id = font_cache
.load_family(&["Courier"], &Default::default())
.unwrap();
let font_id = font_cache
.select_font(family_id, &Default::default())
.unwrap();
@@ -1335,9 +1509,9 @@ pub mod tests {
}
#[gpui::test]
fn test_clip_point(cx: &mut gpui::MutableAppContext) {
fn test_clip_point(cx: &mut gpui::AppContext) {
cx.set_global(Settings::test(cx));
fn assert(text: &str, shift_right: bool, bias: Bias, cx: &mut gpui::MutableAppContext) {
fn assert(text: &str, shift_right: bool, bias: Bias, cx: &mut gpui::AppContext) {
let (unmarked_snapshot, mut markers) = marked_display_snapshot(text, cx);
match bias {
@@ -1384,10 +1558,10 @@ pub mod tests {
}
#[gpui::test]
fn test_clip_at_line_ends(cx: &mut gpui::MutableAppContext) {
fn test_clip_at_line_ends(cx: &mut gpui::AppContext) {
cx.set_global(Settings::test(cx));
fn assert(text: &str, cx: &mut gpui::MutableAppContext) {
fn assert(text: &str, cx: &mut gpui::AppContext) {
let (mut unmarked_snapshot, markers) = marked_display_snapshot(text, cx);
unmarked_snapshot.clip_at_line_ends = true;
assert_eq!(
@@ -1403,12 +1577,14 @@ pub mod tests {
}
#[gpui::test]
fn test_tabs_with_multibyte_chars(cx: &mut gpui::MutableAppContext) {
fn test_tabs_with_multibyte_chars(cx: &mut gpui::AppContext) {
cx.set_global(Settings::test(cx));
let text = "\t\tα\nβ\t\n🏀β\t\tγ";
let buffer = MultiBuffer::build_simple(text, cx);
let font_cache = cx.font_cache();
let family_id = font_cache.load_family(&["Helvetica"]).unwrap();
let family_id = font_cache
.load_family(&["Helvetica"], &Default::default())
.unwrap();
let font_id = font_cache
.select_font(family_id, &Default::default())
.unwrap();
@@ -1462,11 +1638,13 @@ pub mod tests {
}
#[gpui::test]
fn test_max_point(cx: &mut gpui::MutableAppContext) {
fn test_max_point(cx: &mut gpui::AppContext) {
cx.set_global(Settings::test(cx));
let buffer = MultiBuffer::build_simple("aaa\n\t\tbbb", cx);
let font_cache = cx.font_cache();
let family_id = font_cache.load_family(&["Helvetica"]).unwrap();
let family_id = font_cache
.load_family(&["Helvetica"], &Default::default())
.unwrap();
let font_id = font_cache
.select_font(family_id, &Default::default())
.unwrap();
@@ -1509,7 +1687,7 @@ pub mod tests {
rows: Range<u32>,
map: &ModelHandle<DisplayMap>,
theme: &'a SyntaxTheme,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> Vec<(String, Option<Color>)> {
chunks(rows, map, theme, cx)
.into_iter()
@@ -1521,11 +1699,11 @@ pub mod tests {
rows: Range<u32>,
map: &ModelHandle<DisplayMap>,
theme: &'a SyntaxTheme,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> Vec<(String, Option<Color>, Option<Color>)> {
let snapshot = map.update(cx, |map, cx| map.snapshot(cx));
let mut chunks: Vec<(String, Option<Color>, Option<Color>)> = Vec::new();
for chunk in snapshot.chunks(rows, true) {
for chunk in snapshot.chunks(rows, true, None) {
let syntax_color = chunk
.syntax_highlight_id
.and_then(|id| id.style(theme)?.color);

Some files were not shown because too many files have changed in this diff Show More