sublimelsp / LSP

Client implementation of the Language Server Protocol for Sublime Text

Home Page:https://lsp.sublimetext.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LSP Slows down normal autocomplete

aubreypwd opened this issue · comments

Describe the bug

When LSP is enabled, I can start to type something that would normally autocomplete:

CleanShot 2024-03-06 at 12 54 59

But with LSP enabled:

CleanShot 2024-03-06 at 12 55 49

Note: It will eventually pop up sometimes, after a long delay.

Expected behavior

Autocomplete still works as normal.

Logs

📹 https://a.supportally.com/v/2140Ye

:: [13:10:19.317] --> LSP-copilot getCompletions (17): <params with 88181 characters>
LSP-copilot: [getCompletions] Producing empty completions due to document version mismatch. Completions requested for document version 27 but document version was 17.
:: [13:10:19.378] --> LSP-copilot getCompletionsCycling (18): <params with 88181 characters>
LSP-copilot: [getCompletions] Producing empty completions due to document version mismatch. Completions requested for document version 27 but document version was 17.```

**Environment (please complete the following information):**

- OS: MacOS Sonoma
- Sublime Text version: https://a.supportally.com/i/2GCSTG
- LSP version: 1.29.0
- Language servers used: LSP-copilot

Note, it does not make a difference if I enable/disable copilot.

**Additional context**

I tried enabling and disabling my SublimeLinter* packages, that also did not help. Only LSP.

From your screencast it doesn't look like completions are not slowed down but rather completely suppressed.

Do you have any other servers running in php files? What is shown in the bottom-left corner?

Also check Sublime Text console for any errors.

I find:

Producing empty completions due to document version mismatch. Completions requested for document version 32 but document version was 27.

...to be interesting. I don't know what it means, but I do get empty completions.

CleanShot 2024-03-06 at 13 13 45@2x

After about 15 seconds or more I do eventually get a list of completions.

If LSP-copilot for some reason takes a long time to generate completions then it's an expected behavior. We can't show completions until server responds.

But you said that it happens with LSP-copilot disabled and I'm interested in that case rather.

If it doesn't happen with LSP-copilot disabled then there is nothing to fix here. Just make sure that LSP-copilot works faster. Since it relies on cloud, it's probably some issue related to your network.

Eventually you can try filing an issue against LSP-copilot.

It does happen with LSP-coplot disabled:

CleanShot.2024-03-06.at.18.21.41.mp4

Here I enable both LSP and LSP-copilot, then I disable LSP-copilot, then I disable LSP and it finally starts working again.

Try disabling copilot and then closing and reopening the file.

There might be a special case happening in disabling a package that we don't handle correctly.

I tried that... didn't seem to make a change. But I did find that some files were slow, while other files were faster:

📹 https://a.supportally.com/v/94QnzY

Maybe a file size or complexity issue?

Again all I have enabled is:

  • LSP
  • LSP-copilot

I also tested with LSP-copilot disabled (after a ST restart) and I still had the weird per-file speed issues.

When it's slow, what is shown in the bottom left corner of the ST window?

I assume you mean the status bar? Nothing of note:

CleanShot 2024-03-07 at 12 59 41@2x

CleanShot 2024-03-07 at 12 59 10

Pretty sure it won't happen in Safe Mode (you can install Package Control and LSP in it for testing) in which case it would likely be due to some other plugin. Maybe some weird interaction between LSP and another plugin...

You can try Safe Mode and if it doesn't reproduce there then in your original installation try disabling various other plugins.

I have decided to give up on Sublime Text after 10+ years lol! I am not going to re-test this again in safe mode, sorry. Feel free to close the issue if you still think this isn't an issue. Thanks for building this though!

We can't do much about an issue when there is no reproduction and you are the first in years to report it.