Commit Graph

803 Commits

Author SHA1 Message Date
Mikayla Maki
6ac9308a03 Added git repository type infrastructure and moved git file system stuff into fs abstraction so we can test without touching the file system. Co-Authored-By: kay@zed.dev 2022-09-29 13:16:02 -04:00
Mikayla Maki
0d1b2a7e46 WIP - max & mikayla working on tests 2022-09-29 13:16:02 -04:00
Julia
bb8798a844 WIP pls amend me
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
632f47930f Utilize initial file contents as head text by default
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
8edee9b2a8 Async-ify head text loading 2022-09-29 13:16:02 -04:00
Julia
6633c0b328 Perform initial file load git diff async 2022-09-29 13:16:02 -04:00
Julia
55ca02351c Start painting some sort of hunk info, it's wrong but it's close
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-29 13:16:01 -04:00
ForLoveOfCats
2a14af4cde Load a file's head text on file load just to get started 2022-09-29 13:16:01 -04:00
Antonio Scandurra
4a9bf8f4fe Introduce call infrastructure
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-09-28 11:33:38 +02:00
Max Brunsfeld
5d0b6a3da7 Merge branch 'main' into new-signup-flow 2022-09-27 15:35:05 -07:00
Nathan Sobo
f0c50c1e0a Extract db module from project to its own crate
This will let us use it from the telemetry crate.

Co-authored-by: Joseph Lyons <joseph@zed.dev>
2022-09-26 16:37:09 -06:00
Julia
879a0d8b12 Backward compat format settings 2022-09-26 11:41:31 -04:00
Max Brunsfeld
04baccbea6 Start work on a client-side telemetry system 2022-09-23 12:23:12 -07:00
Julia
f3395cf4fd Add editor action to manually invoke buffer format 2022-09-22 18:21:05 -04:00
Max Brunsfeld
3ae16904b4 Avoid changing entry's kind from Dir to PendingDir in refresh_entry
When lots of filesystem changes are occurring, the filesystem event
for the directory creation may be delivered before the call to
fs::metadata resolves.
2022-08-30 16:13:07 -07:00
Max Brunsfeld
d4bbf21650
Merge pull request #1559 from zed-industries/language-injection
Add language injection support
2022-08-30 11:54:00 -07:00
Max Brunsfeld
ced45cbb0a Use SyntaxMap in Buffer 2022-08-24 13:00:27 -07:00
Antonio Scandurra
f0d35ccc50 Move operation serialization off the main thread 2022-08-23 16:34:25 +02:00
Antonio Scandurra
954695f5fe Stream buffer ops in the background when creating buffer for peers 2022-08-23 16:05:56 +02:00
Antonio Scandurra
13c2021aef Default to language that started LSP when querying project symbols 2022-08-22 14:30:27 +02:00
Antonio Scandurra
9c9bf07e40 Create buffers for remote collaborators out of band
Previously, we would use `Project::serialize_buffer_for_peer` and
`Project::deserialize_buffer` respectively in the host and in the
guest to create a new buffer or just send its ID if the host thought
the buffer had already been sent.

These methods would be called as part of other methods, such as
`Project::open_buffer_by_id` or `Project::open_buffer_for_symbol`.
However, if any of the tasks driving the futures that eventually
called `Project::deserialize_buffer` were dropped after the host
responded with the buffer state but (crucially) before the guest
deserialized it and registered it, there could be a situation where
the host thought the guest had the buffer (thus sending them just the
buffer id) and the guest would wait indefinitely.

Given how crucial this interaction is, this commit switches to creating
remote buffers for peers out of band. The host will push buffers to guests,
who will always refer to buffers via IDs and wait for the host to send them,
as opposed to including the buffer's payload as part of some other operation.
2022-08-17 11:55:36 +02:00
ForLoveOfCats
8ba2f77148 One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Max Brunsfeld
7527850546 Handle RPC requests for type definitions on server and host 2022-08-04 15:10:46 -07:00
ForLoveOfCats
c21314bfbd Add ability to provide custom LSP server initialization options 2022-08-04 14:47:06 -04:00
Antonio Scandurra
fc14100134 Fix tests 2022-08-02 18:48:17 +02:00
Antonio Scandurra
a59813cec5
Merge pull request #1430 from zed-industries/xdg-compliance
Store config files under `~/.config/zed` and data files under `~/Library/Application Support/Zed`
2022-08-01 12:13:08 +02:00
ForLoveOfCats
d474e1e1f4 Deduplicate some lsp_command code 2022-07-29 18:04:14 -04:00
ForLoveOfCats
5149c15329 Add "go to type definition" action 2022-07-29 11:41:08 -04:00
Antonio Scandurra
cfe3ebd2b3 Use XDG-compliant directories for config and cache files 2022-07-29 10:01:48 +02:00
Max Brunsfeld
fa5af4383d Introduce AutoindentMode parameter to Buffer::edit
This controls whether or not we preserve the relative indentation
of inserted text blocks.

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2022-07-28 14:03:31 -07:00
Antonio Scandurra
8552ba15dc Show symbols located in visible paths before ones located externally 2022-07-26 14:48:18 +02:00
Antonio Scandurra
45eb0e7889 Clip invalid edits from LSP instead of reporting an error
This fixes an issue with the Go language server, which reports invalid
formatting ranges when there's a missing newline at the end of the file.
Specifically, if the buffer is `N` lines long, it will try to insert the
newline at `Point(N + 1, 0)`.

I confirmed the behavior is the same in VS Code, and they indeed clip the
LSP ranges as well.
2022-07-26 08:43:27 +02:00
Antonio Scandurra
32662b6b92 Start indexing UTF-16 offsets
This is needed because cocoa will report ranges as UTF-16 indices.
2022-07-21 09:40:48 +02:00
Max Brunsfeld
43613fe2ac Ensure that fs watches are dropped when dropping the event stream 2022-07-18 14:55:24 -07:00
Antonio Scandurra
11ef6bfbae Avoid unnecessarily emitting fake fs events for dirs that exist 2022-07-18 17:36:40 +02:00
Antonio Scandurra
f9df5fe595 Detect cycles also when processing events 2022-07-18 17:31:09 +02:00
Antonio Scandurra
b3218641cd Create intermediate directories in FakeFs::create_dir 2022-07-18 16:38:26 +02:00
Antonio Scandurra
b48118830f Detect cycles when scanning a directory 2022-07-18 13:47:15 +02:00
Max Brunsfeld
f9a5ed3a85 Start work on a test for a worktree with symlink cycles 2022-07-18 12:23:07 +02:00
Max Brunsfeld
f6c1393dfd Restructure FakeFs to let it model symlinks
Instead of storing paths, model the FS more directly
as nodes
2022-07-18 12:23:07 +02:00
Antonio Scandurra
07d269234f Differentiate among tabs with the same name
This commit introduces a new, optional `Item::tab_description` method
that lets implementers define a description for the tab with a certain
`detail`. When two or more tabs match the same description, we will
increase the `detail` until tabs don't match anymore or increasing the
`detail` doesn't disambiguate tabs any further.

As soon as we find a valid `detail` that disambiguates tabs enough, we
will pass it to `Item::tab_content`. In `Editor`, this is implemented by
showing more and more of the path's suffix as `detail` is increased.
2022-07-14 11:54:11 +02:00
Max Brunsfeld
2a478462b6 Fix association of 'json' lsp language id with JSON language 2022-07-12 15:43:59 -07:00
Max Brunsfeld
c02f4ea8dc Rename LanguageSettings -> EditorSettings 2022-07-12 11:42:43 -07:00
Antonio Scandurra
afc8e9050c
Merge pull request #1252 from zed-industries/plugin
Language Server WebAssembly Plugin Integration (Part 2)
2022-07-12 11:04:20 +02:00
Isaac Clayton
815de6da61 Rewrite test_managing_language_servers to add languages after buffers are open
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2022-07-12 10:25:11 +02:00
Isaac Clayton
d8b22a200e Rename LspAdapterTrait to LspAdapter and LspAdapter to CachedLspAdapter 2022-07-12 09:29:38 +02:00
Antonio Scandurra
b1e3b38cb3 Don't prompt guest to save when closing window after disconnection 2022-07-12 09:05:39 +02:00
Isaac Clayton
be41ad44a7 Fix minor issues in plugin and project raised during review 2022-07-11 16:40:12 +02:00
Isaac Clayton
bc94d0d1a9 Restore main version of Project::symbols and convert to async 2022-07-11 16:22:58 +02:00
Isaac Clayton
0600157c38 Restore main version of Project::completions and convert to async 2022-07-11 15:55:07 +02:00
Isaac Clayton
ec327a30c3 Fix minor issues pointed out in the review 2022-07-11 15:54:03 +02:00
Isaac Clayton
3ad8d5363c Remove the blocking call and inline on_lsp_diagnostics_published 2022-07-11 12:11:00 +02:00
Isaac Clayton
8c91c5c575 Minor fixes found during review 2022-07-11 10:37:51 +02:00
Max Brunsfeld
5bafabcb8e
Merge pull request #1314 from zed-industries/code-action-with-edit-and-command
Run code action's commands if their edits are empty
2022-07-08 16:58:12 -07:00
Max Brunsfeld
e101f4e705 Run code action's commands if their edits are empty 2022-07-08 16:12:20 -07:00
Isaac Clayton
8931218dc6 Remove debug statements 2022-07-08 21:28:35 +02:00
Isaac Clayton
6f99d59d38 Require theme directly when creating language 2022-07-08 16:08:40 +02:00
Isaac Clayton
73620dad06 Add channel to notify project when languages are added 2022-07-08 14:37:27 +02:00
Antonio Scandurra
56f9c7bc1b Include ignored files in fuzzy search when root entry is ignored 2022-07-08 11:54:45 +02:00
Antonio Scandurra
32c6ae3188 🎨 2022-07-08 11:42:59 +02:00
Antonio Scandurra
e66144104f Honor gitignores above worktree root 2022-07-08 11:19:46 +02:00
Antonio Scandurra
9328ab121a Use absolute paths to compute ignored status
This lays the groundwork for harvesting gitignores up above the
worktree.
2022-07-08 11:19:21 +02:00
Antonio Scandurra
ca225d0765 Make build_gitignore async 2022-07-08 08:50:21 +02:00
Isaac Clayton
5cb59dfdab Fix errors resulting from rebase 2022-07-07 18:14:16 +02:00
Isaac Clayton
895747476f Done! Finish transition to async, very close to merging 2022-07-07 16:21:20 +02:00
Isaac Clayton
39fdbc593b Fix most warnings 2022-07-07 16:19:49 +02:00
Isaac Clayton
6585daccf9 Further unpropogate async 2022-07-07 16:16:58 +02:00
Isaac Clayton
4f016d5fc4 Switch LspAdapter to struct and revert some async/await 2022-07-07 16:12:10 +02:00
Isaac Clayton
0872e9b1a7 use join_all to build partial symbols and completions asynchronously 2022-07-07 15:44:21 +02:00
Isaac Clayton
602fe14aa4 Going to move LspAdapter from trait to struct 2022-07-07 15:44:21 +02:00
Isaac Clayton
e4a680f47b Uncommented previously commented sections 2022-07-07 15:44:18 +02:00
Isaac Clayton
2b0b341415 Move await outside of a closure, remove future_wrap dependency 2022-07-07 15:42:53 +02:00
Isaac Clayton
172e276411 Fix warnings and propogate async further 2022-07-07 15:42:48 +02:00
Isaac Clayton
ce90dbd06a Temporarily comment out closure errors to address other errors in project 2022-07-07 15:41:34 +02:00
Isaac Clayton
2ff67ef9f6 Factor out await in doubly-nested for loop 2022-07-07 15:40:39 +02:00
Isaac Clayton
db7b863d8c Fix on_settings_changed, need to review that impl is correct 2022-07-07 15:40:01 +02:00
Isaac Clayton
4dad2eb7d7 Refactor closure to extract async 2022-07-07 15:40:01 +02:00
Isaac Clayton
7d128e81aa Add lsp_settings_changed: Task to Project, need to resolve cx in Project::on_settings_changed 2022-07-07 15:39:59 +02:00
Isaac Clayton
f4b4212932 More work on transitioning to async, need to figure out when to stop 2022-07-07 15:38:28 +02:00
Isaac Clayton
feb6cf6789 Allow async to infect some more functions 2022-07-07 15:34:27 +02:00
Isaac Clayton
2c637b83bf Work on updating code to be async 2022-07-07 15:32:41 +02:00
Antonio Scandurra
52b8efca1b Add integration test to exercise formatting via external command 2022-07-07 11:53:32 +02:00
Antonio Scandurra
c6254247c3 Allow providing an external format in format_on_save setting 2022-07-07 11:04:03 +02:00
Antonio Scandurra
2c1906d710 Normalize line endings when parsing completions
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-07-06 19:32:45 +02:00
Max Brunsfeld
7e9beaf4bb Strip carriage returns from all text in text::Buffer
* Moving the logic from Rope to text::Buffer makes it easier
  to keep the Rope in sync with the fragment tree.
* Removing carriage return characters is lossier, but is much
  simpler than incrementally maintaining the invariant that
  there are no carriage returns followed by newlines. We may
  want to do something smarter in the future.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-07-05 17:25:09 -07:00
Max Brunsfeld
4aa19c1a7f Select the last root when right-clicking below all project panel entries 2022-07-05 13:21:41 -07:00
Antonio Scandurra
eac76df0ac Transmit new line ending when buffer is reloaded 2022-07-05 08:01:14 +02:00
Max Brunsfeld
c1b886b0ce Normalize line endings consistently between fake and real FS 2022-07-04 13:00:12 -07:00
Max Brunsfeld
9804c683c0 Rename NewlineStyle -> LineEnding 2022-07-04 12:47:40 -07:00
Max Brunsfeld
0ba12eab22 Handle a file's line endings changing on disk 2022-07-04 12:30:28 -07:00
Max Brunsfeld
b0efa4f5c1 Move project tests into their own file 2022-07-04 12:00:15 -07:00
Antonio Scandurra
3480b50920 Detect buffer newline style and honor it when saving 2022-07-04 17:40:26 +02:00
Antonio Scandurra
d3b9eca791 Merge branch 'main' into user-timeline 2022-07-04 09:23:16 +02:00
Antonio Scandurra
0b2452f666
Merge pull request #1265 from zed-industries/worktree-performance
Fix problems that arise when large numbers of files change on disk
2022-07-04 09:19:18 +02:00
Antonio Scandurra
aca757a02d Don't poll snapshot if processing events unless user manually changed fs 2022-07-04 08:10:31 +02:00
Antonio Scandurra
cf05738f68 Remove redundant calls to poll_snapshot 2022-07-01 14:40:39 +02:00
Antonio Scandurra
a42399bcf3 Grab latest snapshot when invoking LocalWorktree::poll_snapshot 2022-07-01 14:36:51 +02:00
Antonio Scandurra
833aa726d5 🎨 2022-07-01 14:11:21 +02:00
Keith Simmons
ebe733a393 Restart language server using original root path rather than the path of the buffer restarted from 2022-06-30 19:11:21 -07:00
Max Brunsfeld
8a105bf12f WIP - try representing snapshots_to_send as a watch 2022-06-30 18:04:31 -07:00
Keith Simmons
832cc3dd19 Clear language server id for all worktrees when stopping a language server 2022-06-30 17:50:30 -07:00
Keith Simmons
6b50dda28a Fix failing test due to change in stop_language_server function 2022-06-30 17:40:50 -07:00
Keith Simmons
38ca4aab31 add assertion to test_definition ensuring no new language servers are created 2022-06-30 17:24:32 -07:00
Keith Simmons
37b75132b7 Minor comment change 2022-06-30 17:18:28 -07:00
Keith Simmons
f495185a4e add a comment explaining the three language server collections on project 2022-06-30 17:09:23 -07:00
Keith Simmons
5e7651e92e Kill starting servers as well as currently running ones 2022-06-30 17:00:29 -07:00
Keith Simmons
db05e32389 Prevent creating extra language server instances if there already exists one for that workspace 2022-06-30 16:46:26 -07:00
Max Brunsfeld
5fdbc38f46 Don't update worktrees' snapshots in the middle of processing fs events 2022-06-30 15:46:31 -07:00
Max Brunsfeld
b81135e10b Stop waiting for snapshot updates when disconnected from host 2022-06-30 15:07:40 -07:00
Antonio Scandurra
4ee8ee5a06 Ensure newer snapshots are always detected in wait_for_snapshot 2022-06-30 18:04:19 +02:00
Antonio Scandurra
484af8c7c4 Split worktree updates when a peer joins an already-shared project 2022-06-30 16:49:56 +02:00
Antonio Scandurra
845c79ee05 Respond to join project request before sharing project completes
This ensures the guest doesn't observe a huge delay when joining.
2022-06-30 14:29:06 +02:00
Antonio Scandurra
09bb3ddeb8 Split worktree updates and only send 256 entries at a time 2022-06-30 14:06:41 +02:00
Antonio Scandurra
5df0a6a425 Coalesce as many fs events as possible before processing them 2022-06-30 10:20:46 +02:00
Antonio Scandurra
b96962005e Keep looking for a newer snapshot before broadcasting it 2022-06-30 09:54:14 +02:00
Max Brunsfeld
b5d862abfe Only send one UpdateProject msg when changing project's online status 2022-06-29 17:58:02 -07:00
Antonio Scandurra
7bae759a02 Send extension counts when metadata changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-06-29 17:58:11 +02:00
Antonio Scandurra
d1cdacdf14 Skip ignored entries when recording worktree extensions
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-06-29 17:00:16 +02:00
Antonio Scandurra
639cd71a3b Record worktree extensions every 5 minutes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-06-29 16:58:19 +02:00
Antonio Scandurra
f9e0fec396 Maintain extension counts on local worktrees
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-06-29 16:38:24 +02:00
Antonio Scandurra
09f4262fd4 Don't share a project unless it's online and we're allowing a request 2022-06-29 15:16:55 +02:00
Antonio Scandurra
e3cfc7b3ce Register project activity for offline projects as well 2022-06-29 14:55:04 +02:00
Max Brunsfeld
8fe6809932 Exclude hidden worktrees from project's diagnostic summaries 2022-06-28 14:23:24 -07:00
Max Brunsfeld
f05e94d0de Allow diagnostics to be published for hidden worktrees 2022-06-28 13:31:04 -07:00
Antonio Scandurra
ca1d0a6e59 Ignore tokens that were not created via WorkDoneProgressCreate
With the new version of rust-analyzer, we were seeing stray `WorkDoneProgress::End`
messages that create an imbalance in the `pending_diagnostic_updates` that never
resolves. This was causing the diagnostic status bar item to never update because
we wouldn't emit `DiskBasedDiagnosticsStarted` nor `DiskBasedDiagnosticsFinished`.

This commit fixes the above situation by only acknowledging progress report for tokens
that have explicitly been created via the `WorkDoneProgressCreate` request, as stated
by the protocol.

In addition to that, we are replacing the `pending_diagnostic_updates: isize` with
a `has_pending_diagnostic_updates: bool`. We added it at some point to prevent a similar
issue where we would observe begin/end reports in a seemingly random order, which would cause
us to permanently display a `checking...` message in the status bar. I believe this commit
fixes that as well because the `isize` was just a less general solution for the same
underlying issue. As the protocol states: "the token provided in the create request should
only be used once (e.g. only one begin, many report and one end notification should be sent
to it)."
2022-06-28 10:08:43 +02:00
Keith Simmons
a477733bcb Address hover panic and add hint to install go when language server failed to install 2022-06-27 15:48:15 -07:00
Keith Simmons
bc82d98ae5
Merge pull request #1237 from zed-industries/jump-to-definition
Mouse jump to definition
2022-06-27 15:20:07 -07:00
Antonio Scandurra
7bfd7093b1 Don't stop scanning directory if reading one of the children errors 2022-06-27 08:40:37 +02:00
Keith Simmons
92ab107fc9 working jump to definition with tests 2022-06-24 15:09:31 -07:00
Keith Simmons
848445455d Working underline based on symbol origin 2022-06-24 15:05:35 -07:00
Keith Simmons
755636d10e Use NonZeroU32 to ensure settings tabsize cannot be zero 2022-06-23 12:55:38 -07:00
Antonio Scandurra
2cb8a3ccfb Don't override top-level settings with language defaults
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-06-23 16:40:57 +02:00
Antonio Scandurra
2d8ffbdfa2 Don't wait for host's worktree updates if they disconnected
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-06-22 19:45:55 +02:00
Antonio Scandurra
2f09a4af16 Update project metadata when releasing a worktree's weak handle
When a project was getting unshared, we would remove invisible worktrees
from the project's state without notifying the server, which was causing
the randomized tests to fail.

This commit calls `Project::remove_worktree` when a worktree's handle gets
released. Doing so ensures that we update both our local metadata database
as well as the state on the server.
2022-06-22 10:26:10 +02:00
Antonio Scandurra
69aa3d848e Report running language servers when sharing project for the first time
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-06-21 20:39:54 +02:00
Antonio Scandurra
4f215a77cd Don't compute fingerprint for every text summary 2022-06-17 15:15:27 +02:00
Antonio Scandurra
6f7a893ec9 Determine Buffer::is_dirty based on the rope's fingerprint 2022-06-17 12:38:25 +02:00
Antonio Scandurra
dc75b70724 Use word boundaries instead of syntax to infer completion edit ranges 2022-06-16 11:27:22 +02:00
Antonio Scandurra
35889add40 Add failing test for wrong typescript completion 2022-06-16 11:26:35 +02:00
Antonio Scandurra
3a1d0dd692 Track active projects in metrics
An active project is defined as a project where there has been at
least a buffer edit, a join request/response, or a follow update
in the last minute.
2022-06-15 10:33:20 +02:00
Keith Simmons
93158bfcff Fix delayed lsp request 2022-06-09 17:03:45 -07:00
Max Brunsfeld
87ba68e3ea
Merge pull request #1155 from zed-industries/golang
Add Go support
2022-06-09 14:18:37 -07:00
Max Brunsfeld
4ce4c0ef03 Ignore completions from gopls that we can't yet handle
We only support additionalEdits if they are provided when resolving the
completion, not if they are provided immediately.
2022-06-09 13:08:08 -07:00
Antonio Scandurra
213b31607c Remove language server statuses synchronously when stopping a server 2022-06-09 10:59:02 +02:00
Antonio Scandurra
69170fc33a Add unit test to ensure changing enable_language_server works 2022-06-09 10:48:06 +02:00
Antonio Scandurra
36a1a7a819 Start/stop language servers when enable_language_server changes 2022-06-09 10:08:11 +02:00
Antonio Scandurra
9d7476afc6 Extract a Project::stop_language_server method when restarting server
This will be useful later to stop a language server when detecting
configuration changes.
2022-06-09 10:05:35 +02:00
Max Brunsfeld
36ce3eb5ef Handle messages associated with LSP WorkDoneProgress::Begin messages
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-08 10:26:41 -07:00
Antonio Scandurra
eda569d6b2 Snapshot file instead of path when creating a buffer snapshot 2022-06-08 14:29:14 +02:00
Antonio Scandurra
d8b885e3ec Provide tab_size when formatting document using LSP range formatting 2022-06-08 09:56:11 +02:00
Keith Simmons
9d5111e86a
Merge pull request #1078 from zed-industries/lsp-hover
LSP Hover Information
2022-06-07 14:45:43 -07:00
Keith Simmons
1b66e1e185 Add integration test and fix hovering over the wire 2022-06-07 14:22:02 -07:00
Keith Simmons
a6c0ee472c Add vim bindings for hover
Allow scrolling in hover popover
2022-06-07 13:07:53 -07:00
Keith Simmons
67d9abc00f Move highlighting to editor code and implement proto message types for hover response 2022-06-07 11:54:52 -07:00
Keith Simmons
c7cc07aafb working markdown rendering 2022-06-07 11:54:51 -07:00
Keith Simmons
b014352740 Syntax highlighting working. Getting started on markdown support 2022-06-07 11:54:33 -07:00
Isaac Clayton
d529a1deb4 Add basic debounce, fix flickering 2022-06-07 11:54:31 -07:00
Keith Simmons
560dff7329 Pull hover popover out of context menu 2022-06-07 11:54:00 -07:00
Isaac Clayton
470c70d394 Get minimal POC working 2022-06-07 11:52:52 -07:00
Antonio Scandurra
b04e62d895 Fix tracking of in-progress disk-based diagnostics on indicator
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-06-07 19:35:53 +02:00
Antonio Scandurra
bbfa6580a4 Avoid refreshing diagnostics for language servers that didn't update
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-06-07 19:05:06 +02:00
Antonio Scandurra
1ecc51f035 Fix warnings 2022-06-06 16:23:49 +02:00
Antonio Scandurra
70afc06666 Handle out-of-order edits coming from LSP 2022-06-06 16:15:11 +02:00
Max Brunsfeld
ed14fd6e0d Add setting to make projects online/offline by default 2022-06-03 17:01:15 -07:00
Max Brunsfeld
24aafde1e8 Avoid persisting project's state before it has been initialized 2022-06-03 16:40:16 -07:00
Max Brunsfeld
e18bc24989 Rename project's 'public'/'private' flag to 'online'/'offline' 2022-06-03 14:39:06 -07:00
Max Brunsfeld
afdd386057 Move persistence and restoration logic from workspace into project
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-03 11:52:14 -07:00
Max Brunsfeld
36a4d31b5b Keep unregistered projects' ids until pending contact updates are done 2022-06-02 18:04:54 -07:00
Max Brunsfeld
f7e7a7c6a7 Use rocksdb to store project paths' public/private state 2022-06-02 17:38:33 -07:00
Max Brunsfeld
d45db1718e Style the contact panel while public/private operations are in-flight 2022-06-02 17:38:33 -07:00
Max Brunsfeld
d11beb3c02 Change project registration RPC APIs to smooth out UI updates
* Make `UnregisterProject` a request. This way the client-side project can wait
  to clear out its remote id until the request has completed, so that the
  contacts panel can avoid showing duplicate private/public projects in the
  brief time after unregistering a project, before the next UpdateCollaborators
  message is received.
* Remove the `RegisterWorktree` and `UnregisterWorktree` methods and replace
  them with a single `UpdateProject` method that idempotently updates the
  Project's list of worktrees.
2022-06-02 17:32:43 -07:00
Max Brunsfeld
3ea061a11e Allow making projects private 2022-06-02 17:32:42 -07:00
Max Brunsfeld
7ef9de32b1 Show private projects in the contacts panel
Introduce a ProjectStore that lets you iterate through all open projects.
Allow projects to be made public by clicking the lock.
2022-06-02 17:29:11 -07:00
Max Brunsfeld
a60fef52c4 Start work on private projects 2022-06-02 17:29:11 -07:00
Antonio Scandurra
6baf8b033b Don't reuse the same diagnostic group id across buffers
This lets us use the group id as the key for an `ElementState`, which
fixes a panic that would occur in project diagnostics when opening it
while there were multiple diagnostic groups with the same id.
2022-06-02 12:05:28 +02:00
Max Brunsfeld
b9dc476e74 Avoid sending unnecessary messages for local projects that aren't shared 2022-06-01 14:49:12 -07:00
Antonio Scandurra
339069b1d3 Cap MessageStream buffer size to 1MB
We temporarily let it grow when the message size exceed the limit,
but restore the buffer's capacity shortly after. This ensures that,
for each connection in its entire lifetime, we only ever use 1MB.
2022-05-31 11:16:32 +02:00
Antonio Scandurra
354488ebdf Don't eagerly populate copied subdirectory
This can race anyway with snapshot updates, so we just eagerly refresh
the root entry and wait for updates to come in to populate it.
2022-05-31 08:11:07 +02:00
Antonio Scandurra
20e1044d49 Merge branch 'main' into project-panel-with-new-mouse-events 2022-05-30 18:29:46 +02:00
Antonio Scandurra
88fdd8606a Eagerly populate child entries when copying a directory via RPC 2022-05-30 18:01:46 +02:00
Antonio Scandurra
3336bc6ab3 Implement copy paste for ProjectPanel 2022-05-30 14:52:34 +02:00
Max Brunsfeld
e6be151a64 Emit the WorktreeRemoved event when removing a worktree from a project 2022-05-27 10:49:10 -07:00
Max Brunsfeld
a1a4c70845 Emit an event when adding a worktree to a project 2022-05-27 10:48:47 -07:00
Antonio Scandurra
3ac6fc89c1 Pretty-print JSON of server snapshot 2022-05-26 09:34:39 +02:00
Antonio Scandurra
ec88288d5e Bump chunk size to 256 2022-05-24 09:54:53 +02:00
Antonio Scandurra
85f228dade Fix logic error when streaming ignored entries
We were calling `next` twice, which led us to skip every other entry.
This commit also enhances the `test_share_project` integration test
to exercise this new streaming logic.
2022-05-24 09:03:05 +02:00
Antonio Scandurra
94e70bc1a6 WIP: log received updated_entries on remote worktree
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-23 19:39:24 +02:00
Antonio Scandurra
c65dae8095 Correctly assign ignored status in refresh_entry
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-23 19:19:13 +02:00
Antonio Scandurra
23ca9dce2e WIP: stream ignored entries 2022-05-23 16:38:16 +02:00
Antonio Scandurra
fe1498dc1d Fix worktree::Snapshot::entries(true) always being empty 2022-05-23 15:38:20 +02:00
Max Brunsfeld
ef0b584532 Remove AppState from workspace actions
This allows those actions to be bound to keystrokes in the keymap.
Also, remove the WorkspaceParams struct, simplify how Workspaces are
constructed.
2022-05-19 14:37:26 -07:00
Antonio Scandurra
7b161b81b5 WIP: accept to join requests if user is already participating
There's a panic caused by `Store::check_invariants` that we still
need to figure out.
2022-05-17 13:21:20 +02:00
Nathan Sobo
d821e7a4c1 Cancel join requests when the requester closes the window 2022-05-16 20:29:36 -06:00
Antonio Scandurra
ed6ed99d8f Show the reason why a join request was declined
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-16 19:57:50 +02:00
Antonio Scandurra
47ce8ae05c Poll snapshot after refreshing entry 2022-05-16 11:50:21 +02:00
Antonio Scandurra
b144995f27 Grab share state after retrieving metadata when refreshing entry 2022-05-16 11:46:49 +02:00
Max Brunsfeld
842bfae3af WIP - update worktree's scan_id when mutating it in the foreground 2022-05-13 17:03:48 -07:00
Antonio Scandurra
5789aeea24 Fix randomized test failure caused by unsharing while guest was joining
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-13 17:39:13 +02:00
Antonio Scandurra
dd684d26a1 Make Project::share and Project::unshare private
This is still in-progress because randomized tests are failing.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-13 17:17:20 +02:00
Max Brunsfeld
be51a58311 Start work on requesting to join projects
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-12 17:53:11 -07:00
Max Brunsfeld
3dee656490 Avoid panic when language server is dropped before being initialized in tests
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-09 18:05:10 -07:00
Max Brunsfeld
054d697fb7 Remove remaining code associated with .zed.toml files 2022-05-09 16:31:30 -07:00
Max Brunsfeld
2aec4ff234 Pick files directly from the Fs in simulate_host
Previously, the list of all existing files was maintained separately, but
it was not updated when a guest created a file.
2022-05-09 15:39:45 -07:00
Max Brunsfeld
ea81737a88 Allow fuzzy-search for potential contacts in the contacts panel
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-05 14:14:44 -07:00
Antonio Scandurra
6212f2fe30 Wait for remote worktree to catch up with host before mutating entries
This ensures that entries don't randomly re-appear on remote worktrees
due to observing an update too late. In fact, it ensures that the remote
worktree has the same starting state of the host before preemptively applying
the fs operation locally.
2022-05-05 13:47:53 +02:00
Antonio Scandurra
ecb847a027 Fix bugs in FakeFs::{remove_dir,rename} 2022-05-05 09:02:31 +02:00
Max Brunsfeld
4b1c46fa45 Allow deleting entries from the project panel 2022-05-04 18:00:23 -07:00
Max Brunsfeld
509ede0e80 Allow guests to create directories 2022-05-04 16:52:46 -07:00
Max Brunsfeld
40e0f10195 Allow creating directories from the project panel 2022-05-04 16:47:11 -07:00
Max Brunsfeld
a2c22a5e43 Prevent eager snapshot mutations from being clobbered by background updates
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-04 15:10:39 -07:00
Max Brunsfeld
438e4e7a19 Allow guests to rename stuff
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-04 10:28:44 -07:00
Nathan Sobo
470d693d5e Rename entries via the project to prepare for guest support
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-04 10:28:44 -07:00
Max Brunsfeld
657ea264cc Allow guests to create files from the project panel
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-04 10:28:44 -07:00
Max Brunsfeld
8291b8108d Update snapshot atomically when processing FS events 2022-05-04 10:28:44 -07:00
Max Brunsfeld
0ff39f1280 Select new files in the project panel after creating them 2022-05-04 10:28:44 -07:00
Max Brunsfeld
a19766931d Rename entry atomically in LocalWorktree::rename 2022-05-04 10:28:44 -07:00
Max Brunsfeld
8fdc5c9be3 Improve the appearance of project panel filename editor
* Always layout single-line editors with a fixed height
* Preserve directory chevron when editing folder names
* Allow theming the filename editor

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-05-04 10:28:44 -07:00
Max Brunsfeld
333b4aaf4e Implement Rename command in project panel 2022-05-04 10:28:09 -07:00
Max Brunsfeld
a217e2e64b Implement basic AddFile command in project panel 2022-05-04 10:28:09 -07:00
Max Brunsfeld
d4492086b3 Abstract more local project setup inside Project::test helper 2022-05-04 10:28:09 -07:00
Keith Simmons
d4bef67cf2
Merge pull request #929 from zed-industries/non-uniform-batched-edits
Allow batched edits where each range is associated with different insertion text
2022-04-29 16:14:38 -07:00
Keith Simmons
b4b61b4bbc Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Keith Simmons
04fc1d5982 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Antonio Scandurra
c955645bc0 Update share icon and swap its posiiton 2022-04-26 14:35:13 +02:00
Max Brunsfeld
45922603f8 Infer completions old ranges based on the syntax tree 2022-04-25 13:14:05 -07:00
Max Brunsfeld
8ddc7e6458 Respect lsp completions' 'insert_text' property when present
Fixes #839
2022-04-22 14:33:13 -07:00
Antonio Scandurra
63cdf61c53 Fix Project::test_rename 2022-04-22 15:59:20 +02:00
Antonio Scandurra
f91fdd2ba0 Return None when prepare rename is not available on language server 2022-04-22 15:43:23 +02:00
Max Brunsfeld
f52050a9ec Use the 'jsonc' language id for all JSON files
This way, comments are allowed by the language server.
2022-04-21 12:08:16 -07:00
Antonio Scandurra
8ef6b1d8a9 Don't emit event when LSP reports consecutive empty diagnostics
This is related to #849: in that pull request we avoided *storing*
empty diagnostics, but we'd still report an event when receiving
consecutive empty diagnostics. So if the project diagnostics editor
was open, it could happen that opening a buffer would cause the
language server to report zero diagnostics. We would therefore close
the buffer because there were no diagnostics, but doing so would cause
the LSP to report another event with zero diagnostics. This would repeat
forever, causing Zed to use a lot of CPU and the UI not to refresh properly.

With this commit we will simply avoid emitting a `DiagnosticsUpdated` event
altogether if no diagnostics were present before *and* the LSP is reporting
a `PublishDiagnostics` event with no diagnostics in it.
2022-04-20 15:02:38 +02:00
Antonio Scandurra
ef784cf21e Remove summaries that don't contain any errors or warnings
When opening a buffer, some language servers might start reporting
diagnostics. When closing a buffer, they might report that no diagnostics
are present for that buffer. Previously, we would keep an empty summary entry
which would cause us to open a buffer in the project diagnostics view, only to
drop it because it contained no diagnostics. However, the act of opening it
caused the language server to asynchronously report non-empty diagnostics.
We would therefore handle this as an update, but the previous closing of the
buffer would cause the language server to report empty diagnostics again. This
would cause the project diagnostics view to thrash infinitely between these two
states, pegging the CPU and constantly refreshing the UI.

With this commit we won't maintain empty summary entries for files that contain
no diagnostics, which fixes the above issue.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-19 15:30:46 +02:00
Antonio Scandurra
eaa6637b05 Use the entire ProjectPath to find open buffer for an LSP diagnostic
Previously, we would only compare the path relative to the worktree root, which
would cause Zed to sometimes update diagnostics on the wrong buffer. This
manifested in the project diagnostics not showing those errors/warnings while
the status bar and the tab title displayed a summary with errors/warnings.

This commit simply uses `Project::get_open_buffer` which correctly locates a
buffer with the given project path.
2022-04-19 12:06:14 +02:00
Max Brunsfeld
6317c049c5
Merge pull request #800 from zed-industries/tolerate-lsp-workspace-symbols-failure
Avoid bailing out of Project::symbols when one LSP request fails
2022-04-11 21:14:51 -07:00
Max Brunsfeld
ae9f71cc07 Avoid bailing out of Project::symbols when one LSP request fails 2022-04-11 21:09:01 -07:00
Max Brunsfeld
949fbe7cd3 Allow dumping the project diagnostic view's state as JSON
Also, improve DebugElements action so that it shows the JSON in an editor.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-04-11 19:51:46 -07:00
Nathan Sobo
17195e615e
Merge pull request #781 from zed-industries/structured-logging
Introduce structured logging
2022-04-09 07:40:24 -06:00
Nathan Sobo
7e5a3f9f6b Introduce structured logging
We're enabling the log crate feature everywhere, but only using it on the server for now.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-08 10:06:51 -06:00
Antonio Scandurra
c994263225 Don't insert an empty vector in Project::buffer_snapshots
Other code paths rely on at least a version always being there, so
we should enforce that invariant everywhere.
2022-04-08 14:14:45 +02:00
Antonio Scandurra
663beab1b9 Avoid panicking when receiving a request for a dropped buffer 2022-04-08 12:10:45 +02:00
Antonio Scandurra
3daaef02ca Replace postage::oneshot with futures::channel::oneshot
This fixes an error in the randomized test that would cause the future
returned from `Worktree::share` to never finish due to a bug in `postage`
that causes its waker to not be notified upon drop.
2022-04-08 12:03:09 +02:00
Max Brunsfeld
f73de202d0 Fix diagnostic updates after restarting an LSP w/ a pending diagnostic job 2022-04-06 22:02:27 -07:00
Max Brunsfeld
8f38ac8270 Tweak structure of Project::on_lsp_progress so it can be auto-formatted
Previously, rustfmt seems to have given up on formatting this method.
2022-04-06 16:35:58 -07:00
Keith Simmons
1812480cbb Tab size is pulled properly from settings instead of hardcoded 2022-04-06 10:23:37 -07:00
Antonio Scandurra
cc45658b2d Clear diagnostics from buffer when unregistering it from language server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-05 16:01:33 +02:00
Antonio Scandurra
5c7f2bb029 Close and re-open buffer in language server when it gets renamed 2022-04-05 15:15:43 +02:00
Antonio Scandurra
9188f51993 Add unit test to illustrate how language server renames should work 2022-04-05 14:47:37 +02:00
Max Brunsfeld
fe27a27cb6 Merge branch 'main' into prompt-on-close 2022-04-01 15:29:23 -07:00
Max Brunsfeld
6f28033efe Add explanatory comments in unit test for code actions w/ commands 2022-04-01 13:00:06 -07:00
Max Brunsfeld
fe8e06e781 Fix clipping when using label-only completions 2022-04-01 12:07:41 -07:00
Max Brunsfeld
ba009724dd Handle LSP apply workspace edit request fully before responding 2022-04-01 11:59:21 -07:00