solargraph icon indicating copy to clipboard operation
solargraph copied to clipboard

Completions not working

Open MuhammadAdam-CodeInterview opened this issue 3 years ago • 2 comments

I have installed solargraph on Ubuntu and added below configuration in the YCMD (A code-completion & code-comprehension server) gem install solargraph "language_server": [{ "name": "solargraph", "cmdline": [ "solargraph", "stdio" ], "filetypes": [ "rb" ] }] the server gets starting but while getting completions from server it does not return anything

Now I am able to get the completions data but this is how I am getting it. a = [] a. # <-- shows nothing a.* # <-- shows menu a.an # <-- shows menu why do we need to add * it should get with dot?

I assume you're opening a file that looks like this:

a = []
a.

The trailing . is a syntax error. The parser can't tokenize invalid code, so the file doesn't get mapped.

Solargraph works around this limitation by fixing incremental changes in the textDocument/didChange message that would otherwise result in a parser error. If you start with a file like this:

a = []
a

...then use textDocument/didChange to add the ., Solargraph should be able to give you code completions.

If you're using YCMD from an editor, the above should work. I'm not familiar with how YCMD works, so this might be a limitation on their end.

castwide avatar Jun 04 '22 19:06 castwide