Skip to content

Faster completion support for remotes #17993

Closed
maan2003 wants to merge 4 commits into
zed-industries:mainfrom
maan2003:push-ulosmxvvopwv
Closed

Faster completion support for remotes #17993
maan2003 wants to merge 4 commits into
zed-industries:mainfrom
maan2003:push-ulosmxvvopwv

Conversation

@maan2003
Copy link
Copy Markdown
Contributor

@maan2003 maan2003 commented Sep 18, 2024

Before this change we canceled every completion task on each keystroke.
This works fine when the latency to the LSP is low, but on a remote that
may be a few hundred ms away, this means you are always having to wait
until the completions show.

This also help if language server takes a while to respond to completion requests.

Release Notes:

  • Improved perceived latency of completions over the network

ConradIrwin and others added 2 commits September 18, 2024 14:13
Before this change we cancled every completion task on each keystroke.
This works fine when the latency to the LSP is low, but on a remote that
may be a few hundred ms away, this means you are always having to wait
until the completions show.

Co-Authored-By: Maan2003 <manmeetmann2003@gmail.com>
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Sep 18, 2024
@maan2003
Copy link
Copy Markdown
Contributor Author

supersedes #17954, so I can also push changes

Comment thread crates/editor/src/editor.rs Outdated
Comment on lines +4345 to +4346
// the task didn't get cancelled, so we manually return
return;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise completions from this show sometimes after this.

@maan2003
Copy link
Copy Markdown
Contributor Author

latency saved is time taken to type the last word before completion.

@maan2003
Copy link
Copy Markdown
Contributor Author

maan2003 commented Sep 18, 2024

noticed that filtering completions can be really slow in some cases

from logs
[crates/editor/src/editor.rs:1360:9] start.elapsed() = 181.814619ms

and looks like filter is running multiple times per keystroke

@maan2003
Copy link
Copy Markdown
Contributor Author

just dropping completions future doesn't cancel the request to remote server (tested in ssh case).

and rust analyzer sends huge completions response every time (~800KB) due to including docs.

this delays future responses because you have to wait for x * 800KB data to be received where x is number of keystrokes

@osiewicz
Copy link
Copy Markdown
Member

osiewicz commented Oct 2, 2024

just fyi @maan2003, @SomeoneToIgnore has recently landed a PR which significantly reduces the amount of data sent back by RA: rust-lang/rust-analyzer#18167

@maan2003
Copy link
Copy Markdown
Contributor Author

maan2003 commented Oct 2, 2024

nice!

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

This looks somewhat stale and outdates, so I'll close this to keep the PR queue cleaner.
Feel free to resubmit when ready.

@maan2003 maan2003 deleted the push-ulosmxvvopwv branch February 2, 2025 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants