castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
425 stars 24 forks source link

Errors when creating a function #38

Closed garyking closed 6 years ago

garyking commented 6 years ago

I'm using a Mac.

I create a new file, and if I type "d", then I get the following error:

[Error - 14:26:16] Request completionItem/resolve failed.
  Message: Completion item could not be resolved
  Code: -32600 

GIF below:

vsc-ruby


If I change focus to another app then back to VSC, I get a different error:

[Error - 14:36:59] Request textDocument/completion failed.
  Message: Invalid offset
  Code: -32603 

GIF below. As you can see, it does show the snippet for def correctly here.

vsc-ruby

castwide commented 6 years ago

Confirmed.

The completionItem/resolve error should not be an error at all, since there are valid reasons for a completion item to have nothing to resolve; for example, the def keyword should be available as a completion item, but it doesn't have any documentation. It'll be fixed in gem version 0.18.2.

The "Invalid offset" error is more legitimate, but it probably shoudn't be sent to the client, since it usually just means that the document is in the process of being changed. I'll look for a reasonable solution.

castwide commented 6 years ago

Gem 0.18.2 is published. It stops reporting both errors to the client.

garyking commented 6 years ago

I can confirm it fixes it. But before the language server starts up, "def" allows me to auto-complete the function creation snippet like in my second GIF above, yet when the server starts up, it just shows me the dropdown as seen in the first GIF.

The first method is preferable, even though the second is what I actually see most of the time.

castwide commented 6 years ago

The snippet is still there, but it appears below case-sensitive matches, i.e., everything that starts with d. The same thing happens in my setup. Here are my results with the snippet selected:

image

You can change where snippets appear with the editor.snippetSuggestions setting. Valid options are top, bottom, inline, and none.