Max Brunsfeld
ededfff3a8
Download language servers on-demand
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 13:54:52 -08:00
Antonio Scandurra
aee479d615
Show message indicating when we're downloading language servers
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 17:25:52 +01:00
Antonio Scandurra
793d9e8bba
Download rust-analyzer from GitHub
2022-02-21 16:15:54 +01:00
Antonio Scandurra
fafe521e9f
Introduce LspPostProcessor::download_language_server
2022-02-21 09:46:18 +01:00
Antonio Scandurra
1ca50d0134
Make language server initialization asynchronous
2022-02-21 09:39:28 +01:00
Antonio Scandurra
b8523509da
Revert "WIP: avoid code-signing rust-analyzer to prevent proc macro errors"
...
This reverts commit fc3bccc1a1
.
2022-02-21 08:13:05 +01:00
Antonio Scandurra
fc3bccc1a1
WIP: avoid code-signing rust-analyzer to prevent proc macro errors
...
If this works, I think we should set the permissions asynchronously,
maybe as part of starting the language server, so that we avoid doing
synchronous I/O.
2022-02-20 12:14:43 +01:00
Antonio Scandurra
30e4ea1a4c
Fix warnings
2022-02-17 17:26:03 +01:00
Antonio Scandurra
50a31721eb
Wait for version before returning completions
2022-02-17 11:41:19 +01:00
Max Brunsfeld
e3c4ce208a
Remove unnecessary waiting when handling save RPC requests
...
Add saving to the randomized integration test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:47:21 -08:00
Max Brunsfeld
41ba980c9b
Remove unnecessary waiting during completion RPC requests
...
Also, add completion requests to the randomized collaboration integration test,
to demonstrate that this is valid.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:23:16 -08:00
Max Brunsfeld
c4dff12d69
Allow multiple fake language servers to be started for a given project
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:10:36 -08:00
Max Brunsfeld
d358072c74
Include the desired version in a SaveBuffer RPC request
...
When handling this messages on the host, wait until the desired
version has been observed before performing the save.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 17:51:26 -08:00
Antonio Scandurra
fadb94afb2
Use selection instead of just the cursor when fetching code actions
2022-02-14 14:13:36 +01:00
Antonio Scandurra
e354133be0
Remove stray log statements
2022-02-12 12:32:57 +01:00
Max Brunsfeld
d84fc3beec
Remove Buffer::apply_lsp_edits
...
Always use `edits_from_lsp`.
2022-02-11 16:22:19 -08:00
Antonio Scandurra
4929b8c525
Move Buffer::format
to Project::format
2022-02-11 12:07:46 +01:00
Max Brunsfeld
645df73a37
Finish implementing Buffer::edits_from_lsp
2022-02-10 18:01:18 -08:00
Max Brunsfeld
3a1f9bb212
Start work on applying LSP edits via a diff
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 11:14:06 -08:00
Nathan Sobo
9936bb2efa
Undo subsequent edits when undoing in multi-buffer
...
When undoing in the multi-buffer, don't preserve edits that occurred outside the multi-buffer after the edit being undone.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 09:04:53 -07:00
Antonio Scandurra
0e1318dfe4
WIP: Make editor
crate compile again
...
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Max Brunsfeld
8b1fb9a2cc
Fix unused import warnings
2022-02-08 16:27:33 -08:00
Max Brunsfeld
6731d92f60
Give the editor a handle to the project, not a weak handle to the workspace
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 15:48:44 -08:00
Max Brunsfeld
93bcde953c
Consolidate logic for completion alongside code actions in Project
...
This way, completions are dealt with more consistently with code actions,
and the logic is not spread across so many places. The `language::File`
trait and the multibuffer no longer need to deal with completions. Completions
are no longer generic over an anchor type.
2022-02-08 14:24:45 -08:00
Max Brunsfeld
722c84c976
Consolidate all code actions logic into Project
2022-02-08 13:17:57 -08:00
Max Brunsfeld
e0fe8b5a7c
Merge branch 'main' into assists
2022-02-08 12:41:57 -08:00
Max Brunsfeld
a32dffdd2b
Apply lsp edits in reverse order
...
This fixes the handling of multiple edits on the same line.
2022-02-08 12:41:30 -08:00
Antonio Scandurra
36ff31858b
Set file in test_diagnostics
to excercise language server
2022-02-08 20:09:53 +01:00
Antonio Scandurra
7d8641afb6
Make transactions serializable to enable edits on behalf of other users
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 19:48:21 +01:00
Antonio Scandurra
624eb5907e
Serialize buffer in terms of operations rather than state
...
This is required because, after joining, we want to be able to refer
to operations that have happened prior to joining, which are not
captured by the state. There is probably a way of reconstructing operations
from the state, but that seems unnecessary and we've already talked about
wanting to have the server store operations rather than state once we start
persisting worktrees.
2022-02-08 14:59:46 +01:00
Antonio Scandurra
dca974c7d4
Apply code actions remotely
2022-02-08 12:18:14 +01:00
Antonio Scandurra
9ce3b1adf2
Send DidCloseTextDocument
when dropping buffer
...
Closes https://github.com/zed-industries/zed/issues/434
2022-02-08 10:02:26 +01:00
Max Brunsfeld
e3f055d950
Use a pool of databases to speed up integration tests
...
Also, use env_logger consistently in the tests for each crate.
Only initiallize the logger at all if some RUST_LOG env var is set.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:00:00 -08:00
Antonio Scandurra
8f3ff1590e
Apply edits received from LSP code actions and open all touched buffers
2022-02-07 18:48:45 +01:00
Antonio Scandurra
7a35ea7b25
Tolerate language servers reporting non-monotonic buffer versions
...
This isn't perfect but we'll retain up to 10 old versions just in case there
are race conditions in the language server. We haven't seen this in the wild
but we're concerned about diagnostic reporting racing with code action
resolution.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 16:29:05 +01:00
Antonio Scandurra
982e90539d
WIP: Start on applying code actions
2022-02-07 12:20:03 +01:00
Nathan Sobo
93a3f4b615
Move rendering and select prev/next into ContextMenu enum
...
This prepares the way to have a code actions context menu.
2022-02-05 10:19:43 -07:00
Max Brunsfeld
83d4fe8e3a
Start work on code actions
...
Just print out the returned code actions for now
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 17:45:00 -08:00
Max Brunsfeld
4900019e9b
Add a ToPointUtf16 trait in text and multibuffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 17:35:37 -08:00
Max Brunsfeld
7fc951853d
Adjust assertion to reflect rust grammar upgrade
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 13:31:41 -08:00
Max Brunsfeld
3e232f7115
Refine behavior of select_larger_syntax_node
...
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2022-02-04 13:19:00 -08:00
Max Brunsfeld
3dfff3866a
Add integration test for getting and resolving completions
2022-02-03 15:24:16 -08:00
Antonio Scandurra
ab26a175a4
Opt into language-aware features when getting buffer chunks
...
We use chunks a lot to transform points and sync the various display maps,
and always querying tree-sitter or the LSP diagnostics in those cases is
unnecessarily expensive.
2022-02-03 11:21:30 +01:00
Antonio Scandurra
d246a39b57
Syntax highlight even when the label doesn't contain a detail
2022-02-03 09:57:04 +01:00
Max Brunsfeld
439d12cb85
Start work on syntax highlighting completions
2022-02-02 18:14:30 -08:00
Max Brunsfeld
45898daf83
Fix hang in editor completion unit test
2022-02-02 17:09:36 -08:00
Max Brunsfeld
bbdf62f263
Introduce Language::highlight_text method
2022-02-02 17:01:48 -08:00
Max Brunsfeld
88adddb324
Remove theme parameters from buffer/display map's chunks methods
...
Change Chunks to contain highlight ids instead of actual highlight
styles. Retrieve the actual highlight style from the theme in the
editor element layer.
This is to set us up to perform syntax highlighting in other code
paths where the theme is not available.
2022-02-02 16:33:04 -08:00
Antonio Scandurra
8149bcbb13
Improve formatting of function autocompletion labels in Rust
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-02 18:43:55 +01:00
Antonio Scandurra
8d7815456c
Don't apply completion's edit when it wouldn't change the buffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-02 18:00:30 +01:00
Antonio Scandurra
924eb622ae
Wait for additional edits before pushing transaction in remote buffer
2022-02-02 17:01:23 +01:00
Antonio Scandurra
d765e75bad
Apply additional edits for completion when the buffer is remote
2022-02-02 16:29:13 +01:00
Antonio Scandurra
91e5c2dfac
Broadcast completion triggers to remote participants
2022-02-02 14:07:41 +01:00
Antonio Scandurra
ed549e352f
Start on requesting completions for remote buffers
2022-02-02 12:22:47 +01:00
Max Brunsfeld
7270fd00ba
Start work on handling snippet completions
2022-02-01 15:35:02 -08:00
Max Brunsfeld
1371a20e58
🎨 Return an option task from confirm_completion
2022-02-01 14:27:01 -08:00
Antonio Scandurra
6c7d2cf6b5
Apply additional edits when confirming a completion
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 17:38:11 +01:00
Antonio Scandurra
bcc57036a5
Fix warnings in language::FakeFile
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 16:59:03 +01:00
Antonio Scandurra
b89a39bcb3
Filter and sort suggestions in autocomplete
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 15:11:20 +01:00
Nathan Sobo
fde03b1b37
Make the anchor range inclusive on completions
...
This will help us to correctly interpolate the replacement range when we confirm before receiving new completions after typing with a completion open.
2022-01-31 18:26:26 -07:00
Max Brunsfeld
1d1f8df180
Trigger completion when typing words or trigger characters
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 17:07:24 -08:00
Max Brunsfeld
8d2b7ba032
Insert completion text on enter
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:46:50 -08:00
Nathan Sobo
ab6eb0a655
Start on completion rendering
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-31 12:19:17 -07:00
Nathan Sobo
0344c543af
Return anchored completions from Buffer::completions
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-31 11:25:00 -07:00
Antonio Scandurra
03bcbdc33d
WIP
2022-01-31 19:12:35 +01:00
Antonio Scandurra
bd2527e691
Use StringMatchCandidate::new to construct candidates more conveniently
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 19:11:13 +01:00
Antonio Scandurra
f055053fc9
Avoid grouping transactions created by different editors
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-27 15:51:46 +01:00
Antonio Scandurra
121b45e249
Sanitize language server diagnostics coming from Rust
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 17:49:50 +01:00
Antonio Scandurra
96b66dcce1
Fix race condition when opening a buffer and getting a definition to it
2022-01-24 18:47:55 +01:00
Antonio Scandurra
245490f934
Implement Project::definition
when the buffer is remote
2022-01-24 13:10:13 +01:00
Antonio Scandurra
f859d444ff
Don't show conflict indicator on remote buffer after a reload
2022-01-24 10:17:36 +01:00
Antonio Scandurra
4372fe1ed0
Maintain remote buffers via UpdateBufferFile
messages sent by host
2022-01-24 09:32:40 +01:00
Nathan Sobo
da13d028a3
Send File protos as part of Buffer protos
...
Use the File proto to build the File associated with the buffer rather than relying on the local entry.
2022-01-22 22:19:04 -07:00
Nathan Sobo
66fce5ec8e
Introduce LocalFile trait
...
If you want to call `abs_path` or `load`, the file needs to be local. You call `as_local` which returns `Option<dyn LocalFile>` with those local-only methods. I think this makes it more explicit what works only locally vs everywhere.
2022-01-22 15:52:14 -07:00
Nathan Sobo
d192b6ebc7
Remove Worktree::abs_path
...
I'd like to only have methods related to absolute paths on local worktrees, because it's not really possible to implement them on remote worktrees since we don't know the full path being shared and wouldn't have anything to do with it anyway if we did.
2022-01-22 14:44:58 -07:00
Nathan Sobo
e2a2073bdb
Remove worktree_path from File struct
2022-01-22 14:29:36 -07:00
Nathan Sobo
83418204b6
Assign diagnostics on buffer even if it doesn't have a language
...
This shouldn't be necessary in practice but makes testing easier.
2022-01-22 09:54:25 -07:00
Max Brunsfeld
bd49a02c92
Move buffers from worktree to project
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-21 15:46:27 -08:00
Antonio Scandurra
71082d4cdc
Return a Task<Result<()>>
in {ItemView,Buffer,MultiBuffer}::save
2022-01-20 09:58:24 +01:00
Max Brunsfeld
f43dcd6763
Move logic for starting language servers to the project
2022-01-19 14:05:06 -08:00
Max Brunsfeld
ea69dcd42a
Match on names only when outline query has no spaces
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-14 09:16:29 -08:00
Nathan Sobo
b52db22544
Only enable smart case if the query contains an uppercase character
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-14 09:16:09 -07:00
Nathan Sobo
f934370e7f
Match full path when query contains spaces
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-14 09:02:04 -07:00
Antonio Scandurra
be24e58926
Associate StringMatchCandidate
with an id
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-14 14:55:03 +01:00
Antonio Scandurra
a64ba8b687
Allow matching of context items in outline view
2022-01-14 11:09:02 +01:00
Antonio Scandurra
9c1f58ee89
Maintain order of outline items when filling out tree's missing parts
2022-01-14 09:12:30 +01:00
Max Brunsfeld
adeb7e6864
Incorporate syntax highlighting into symbol outline view
...
Still need to figure out how to style the fuzzy match characters
now that there's syntax highlighting. Right now, they are
underlined in red.
2022-01-13 18:10:02 -08:00
Max Brunsfeld
7913a1ea22
Include highlighting runs in Outline
2022-01-13 14:46:15 -08:00
Max Brunsfeld
3e1c559b2d
Allow multiple disjoint nodes to be captured as matcheable in the outline query
2022-01-13 14:04:25 -08:00
Antonio Scandurra
055d48cfb2
Select the closest outline item when the outline view's query is empty
...
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-13 18:43:49 +01:00
Antonio Scandurra
2660d37ad8
Return Outline<Anchor>
from MultiBuffer::outline
...
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-13 18:24:00 +01:00
Antonio Scandurra
e165f1e16c
Use OutlineItem::depth
to include ancestors of matching candidates
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-13 16:59:52 +01:00
Antonio Scandurra
06ba1c64cf
Implement Outline::search
2022-01-13 15:10:29 +01:00
Antonio Scandurra
d6ed2ba642
Start on rendering the outline view
2022-01-13 12:01:11 +01:00
Antonio Scandurra
ef596c64f8
Add OutlineItem::depth so that we can render a tree in the outline view
2022-01-13 11:35:43 +01:00
Max Brunsfeld
63a401ac5d
Add Buffer::outline method
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:17:49 -08:00
Antonio Scandurra
66694b4c9a
Fix failing tests
...
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-12 18:43:23 +01:00
Antonio Scandurra
310def2923
Implement Buffer::format
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Nathan Sobo
d7a78e14ac
Allow disk-based diagnostic progress begin/end events to interleave
...
When multiple saves occur, we can have multiple start events followed by multiple end events. We don't want to update our project diagnostics view until all pending progress is finished.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-06 09:32:08 -07:00
Max Brunsfeld
fee7657fd7
Merge branch 'main' into polish-project-diagnostics
2022-01-05 20:38:20 -08:00