castwide / vscode-solargraph

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

Looking for the definitions is one character off #207

Closed arashm closed 3 years ago

arashm commented 3 years ago

Having a class defined like this Clients::Registrations::Request.new, if I put my courser just before R and after :: of Request part, and select "go to definition", it won't find the definition. If I put the cursor on any other character after the first one, it works fine.

Looking at the logs, it seems like the plugin is sending the request to Solargraph server, one character before the one I have my cursor on.

castwide commented 3 years ago

Confirmed. I'll work on a fix for a patch release.

castwide commented 3 years ago

Fixed in gem v0.40.4.

arashm commented 3 years ago

Not sure what's the correct behavior, but my expectation when I'm after the last :: is to get the definition for Clients::Registrations::Request, but with this fix, I'm getting the definitions for Clients::Registrations. This is a bit confusing specially with vim mode (or in VIM itself), the cursor would look like this:

Screenshot 2021-03-03 at 14 56 09

Here if I look for the definition, I get Clients::Registrations, if I move it 1 character and hover e, then I get Request.

castwide commented 3 years ago

Gotcha. It still occurs after the second nested namespace. From Clients::, it correctly goes to the definition for Clients::Registrations; but from Clients::Registrations::, it finds Clients::Registrations instead of Clients::Registrations::Requests. I'll work on another fix.

castwide commented 3 years ago

Fixed in gem v0.41.0.

arashm commented 3 years ago

Well it's weird now. I'm using v0.41.1 and nothing works in VIM using coc plugin. It's like the project is not scanned at all by Solargraph and it always return definition was not found. Yet I can't reproduce the issue in VSCode and it seems the first call to solargraph, scans the project and works just fine. Not sure if it's an issue with coc-solargraph or solargraph itself. Got any advise?

arashm commented 3 years ago

Ignore me. I think it works fine and if I noticed something, I'll open a new bug report. Thank you very much for the great work!