scalameta / metals-sublime

Sublime Text package for Metals, a language server for Scala
https://packagecontrol.io/packages/LSP-metals
Apache License 2.0
16 stars 10 forks source link

Import the right symbol upon completion selection #32

Closed jvican closed 3 years ago

jvican commented 3 years ago

Hey folks :wave: I'd like to report a bug I run into often when using this plugin.

  1. Start writing some characters. The plugins shows completions.
  2. Select a candidate entry of the completion list and click enter.
  3. Go to the beginning of the file and find that a symbol different from the one you selected is imported.

Here's a quick reproduction video.

https://user-images.githubusercontent.com/2462974/105575351-4eceed80-5d6b-11eb-9243-b4da6b6f2a72.mov

The weird thing is that sometimes the right symbol is imported and sometimes it isn't. However, this happens often enough in my computer to be an annoying behavior that gets in the way of my coding flow.

I haven't had a look at the implementation, but my guess would be that there's some reordering of the results either on the client or server side and the index sent by the Sublime Text client doesn't match the one in the server.

ayoub-benali commented 3 years ago

Hi @jvican, this is a known bug with ST3 which can't be fixed due to it's API. Good news is that is is already fixed in ST4 (still in Beta), you can fetch it here: https://discord.com/channels/280102180189634562/650695903446827011

I recommend you give it a try :)

Actually the https://github.com/sublimelsp/LSP package has much better LSP UX with ST4 due to it's improved plugin API. I should probably update the readme.

jvican commented 3 years ago

Very nice! I love the new ST4 Beta, thanks for the recommendation @ayoub-benali. I'm happy this bug is fixed there. Should we leave it open in case other users also run into it or should we close the ticket?

ayoub-benali commented 3 years ago

Glad that ST4 fixed your issue :)

I will close the issue because it wouldn't be fixed in this repo any way but rather in https://github.com/sublimelsp/LSP which actually implements LSP on top of sublime API.

This repo only takes care of installing Metals automatically and allow some customization.