Commit Graph

764 Commits

Author SHA1 Message Date
Julia
03115c8d71 Skip LSP additional completion edits which fall within primary edit 2022-11-10 15:28:11 -05:00
Nathan Sobo
fb03eb7a3c Store absolute path on server when sharing worktree
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-11-10 09:34:16 -07:00
Julia
7482660456 Don't restrict which kind of code actions we ask the LSP server for 2022-11-08 16:23:31 -05:00
Julia
8361b4d47a Add test for go-to hunk and fix discovered bugs 2022-10-28 15:08:13 -04:00
Julia
ae2021e073 WIP start setting up test infrastructure for editor diff actions
Co-Authored-By: Kay Simmons <kay@zed.dev>
2022-10-28 15:08:13 -04:00
Antonio Scandurra
bb0f6e85a8 Assign a new language when remote buffer is renamed 2022-10-26 17:52:39 +02:00
Antonio Scandurra
19adfdf8bb Match progress token's prefix to detect disk-based diagnostic progress
The new version of rust-analyzer changed the disk-based diagnostic token
to `rust-analyzer/checkOnSave/0`. The trailing number could be different
from 0 when there are multiple Rust projects open using the same rust-analyzer
instance.

As such, with this commit we will perform a prefix match as opposed to a strict
equality check when detecting a disk-based diagnostics progress token.
2022-10-25 11:35:59 +02:00
K Simmons
79cf5dbd4b remove rocksdb 2022-10-18 17:21:15 -07:00
Mikayla Maki
5bb2edca8b Added absolute path info to remote worktrees (updated protocol version) 2022-10-17 15:27:46 -07:00
Mikayla Maki
1789dfb8b1 Fixed tests 2022-10-17 14:53:52 -07:00
Mikayla Maki
f473eadf2d Fixed failing test, now to make breadcrumbs scrollable... 2022-10-17 13:57:29 -07:00
Mikayla Maki
1f161b9aa1 Show full, absolute paths when displaying a local worktree 2022-10-17 13:35:45 -07:00
Max Brunsfeld
2d3d07d4d7 Clear project's shared state upon every disconnection
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Antonio Scandurra <as-cii@zed.dev>
2022-10-14 10:17:59 -07:00
Antonio Scandurra
37a0fd33c5 Use fake file system for buffer identity test 2022-10-13 09:33:55 +02:00
Antonio Scandurra
f28cc5ca0c Preserve buffer identity when underlying entry temporarily disappears 2022-10-13 09:10:10 +02:00
Antonio Scandurra
0a1aea6cb8 Add test to ensure buffer identity is kept across Project::rename 2022-10-13 08:17:35 +02:00
Max Brunsfeld
6cdf4e98fc Re-export basic text types from text and language crates
Also avoid production dependencies on fs and rope in collab
2022-10-12 15:48:19 -07:00
Max Brunsfeld
69dcfbb423 Send guests DiskBasedDiagnosticsFinished messages when they join a project
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2022-10-12 13:49:09 -07:00
Max Brunsfeld
3c3671a193 Avoid sending stale diagnostics after sharing a worktree
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2022-10-12 11:33:19 -07:00
Antonio Scandurra
9adbab5d99 Fix opening a buffer after leaving and joining the same project
This bug existed prior to #1700 and was caused by not clearing the
buffers that were already shared with a peer that left and opened
a project using the same connection. When such peer would re-join
the project and open a buffer that it had opened previously, the
host assumed the peer had already seen that buffer and wouldn't bother
sending it again.
2022-10-12 10:31:06 +02:00
Mikayla Maki
0beb97547e Finished refactoring out fs and rope 2022-10-11 15:25:54 -07:00
Mikayla Maki
0a8e2f6bb0 Moved fs to it's own crate, build failing due to cyclic dependency on rope 2022-10-11 13:03:36 -07:00
Antonio Scandurra
afaacba41f Merge remote-tracking branch 'origin/main' into room 2022-10-10 15:43:38 +02:00
Max Brunsfeld
ec76146a23
Merge pull request #1692 from zed-industries/avoid-duplicate-autoformat-edits
Avoid duplicate autoformat edits
2022-10-07 09:35:10 -07:00
Antonio Scandurra
386de03f46 Fix room disconnection problems when creating room and sharing project 2022-10-07 14:39:11 +02:00
Antonio Scandurra
b479c8c8ba Move project sharing into Room 2022-10-07 10:14:17 +02:00
Julia
d67fad8dca Extend a test to cover repos not at worktree root 2022-10-06 22:20:10 -04:00
Max Brunsfeld
47a8e4222a Don't allow multiple concurrent formatting requests for the same buffer
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-10-06 17:03:38 -07:00
Julia
771215d254 Reload git index on file events to catch new contents 2022-10-06 12:01:21 -04:00
Julia
3f4be5521c Load diff base from correct relative path 2022-10-05 16:04:55 -04:00
Antonio Scandurra
41240351d3 Simplify Collaborator to stop including the user
It can be retrieved from the `Room` and we're guaranteed to have
a room in order to have collaborators in a project.
2022-10-04 18:00:54 +02:00
Mikayla Maki
499e95d16a Removed debugs, simplified settings 2022-10-03 17:43:05 -07:00
Mikayla Maki
6f7547d28f Fixed a couple bugs in tests and worktree path handling 2022-10-03 17:18:38 -07:00
Julia
6f6d72890a Once again respect user settings for git gutter
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-10-03 15:42:30 -04:00
Julia
e6487de069 Rename head text to indicate that it's not always going to be from head
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-10-03 15:11:06 -04:00
Julia
a5c2f22bf7 Move git gutter settings out of editor settings
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-10-03 14:53:33 -04:00
Julia
8f4b3c3493 Store repo content path as absolute
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-10-03 14:00:58 -04:00
Julia
9427bb7553 Be clearer about using GitFilesIncluded setting 2022-10-03 11:58:48 -04:00
Antonio Scandurra
6426037653 Adapt integration tests to always pass a room id to Project::share
Randomized test is failing, so we'll look into that next.
2022-10-03 15:44:11 +02:00
Mikayla Maki
5769cdc354 made git diff rendering respect line wrap 2022-10-02 18:00:13 -07:00
Mikayla Maki
512f817e2f Added proto messages for updating the head text 2022-10-01 18:18:35 -07:00
Mikayla Maki
8c24c858c9 Touched up comments 2022-09-30 17:36:22 -07:00
Mikayla Maki
af0974264c Refactored git repository code to seperate out repository entry tracking data and git2 mocking code.
Co-authored-by: Max <max@zed.dev>
Co-authored-by: Julia <julia@zed.dev>
2022-09-30 17:33:34 -07:00
Julia
c95646a298 WIP Start refactoring separation of concerns for repo metadata
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-30 18:25:25 -04:00
Julia
42b7820dbb Perform git diff on remote buffer open 2022-09-30 18:05:09 -04:00
Julia
ce7f6dd082 Start a test for remote git data updating
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-30 15:51:32 -04:00
Antonio Scandurra
964a5d2db7 WIP: require sharing projects on a given Room 2022-09-30 18:21:47 +02:00
Julia
bce25918a0 Fix test build 2022-09-30 11:13:22 -04:00
Antonio Scandurra
074b8f18d1 Rip out project registration and use sharing/unsharing instead 2022-09-30 12:23:57 +02:00
Antonio Scandurra
be8990ea78 Remove project join requests 2022-09-30 11:35:50 +02:00
Julia
e865b85d9c Track index instead of head for diffs 2022-09-29 13:16:02 -04:00
Mikayla Maki
113d3b88d0 Added test, and fix, for changed_repos method on LocalWorktree 2022-09-29 13:16:02 -04:00
Julia
f7714a25d1 Don't pretend this is async 2022-09-29 13:16:02 -04:00
Mikayla Maki
71b2126eca WIP, re-doing fs and fake git repos 2022-09-29 13:16:02 -04:00
Julia
d5fd531743 Move git related things into specialized git crate
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
bf3b3da6ed Build again 2022-09-29 13:16:02 -04:00
Julia
7e5d49487b WIP Notifying buffers of head text change
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
759b7f1e07 Update repo scan id when files under dot git dir events
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
d2b18790a0 Remove git repos from worktree when deleted on storage
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
4251e0f5f1 Find repos under worktree & return correct results for repo queries
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Mikayla Maki
c8e63d76a4 Get the test to failing,,, correctly 2022-09-29 13:16:02 -04:00
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