-
Notifications
You must be signed in to change notification settings - Fork 286
Go to Definition Not Working for Functions Defined in Same File #294
Comments
Recently, "Go To Definition" disappeared for me and others - this is because somehow it was switched to being powered by It's possible you're experiencing a difference between I've since since tried both of the settings and |
Thanks, but now the feature doesn't work at all :D Putting that setting in means "Go to Definition" doesn't find anything, and removing it means the menu item "Go to Definition" doesn't even appear. Looking in "Default Settings" (as opposed to "User Settings"), I see that there is no option "ruby.intellisense", for whatever that's worth. |
There are several ways to get "Go to Definition" working:
We probably need to buff up the readme, as well as the warnings/errors produced by vscode.ruby for these various scenarios. I will probably attempt to address that once my outstanding PRs have been merged. |
Thanks mate. So just to confirm, with option 2, I'd be putting in the following into my user settings:
When I have that, I get the old "No definition found ..." for Go to Definition. When I change it to "solargraph", or omit the option (and I have solagraph installed), the entire option of Go to Definition is unavailable. |
That's correct - setting it to rubyLocate should turn on the rubyLocate feature built into vscode-ruby. It might fail to work for various reasons and the error messages may not be implemented. For example, it only works if you open a project (not a file). For more debugging hints try "Help > Toggle Developer Tools". You can also see if it seems to be indexing by checking your status bar. A VS code restart might be required to turn it on. Solargraph has its own set of constraints, which I'm not as familiar with. Last time I tried it I was able to get great results for stdlib methods and decent results for stuff in my project. |
So! Turns out that solargraph wasn't installed. I'm sure it was up until last week, but perhaps it had something to do with RVM (some things to do with a new Ruby changed on my machine last week). Keeping it set to solargraph seems to be working pretty well, so I'll see how it goes. "rubyLocate" still doesn't work, and bringing up debugging as suggested shows problems all over the place ;) This was the last thing that was keeping me from switching from Atom, so I guess I'll be configuring all my keyboard shortcuts and whatnot for the rest of the day. Thanks buddy! |
not working again. I wonder what is the fix these days |
Not working here to. I've installed the Ruby by Peng Lv and add this: to my settings.json But, it had no effect 😞 |
Your environment
vscode-ruby
version: 0.17.0Expected behavior
The "Go to Definition" / "Peek Definition" feature finds local file definitions.
Actual behavior
Above features work for definitions if they are located in other files, but not the same file. i.e. If I look do "Go to Definition" for a function, it is only found if that function is defined in a different file, not the file I triggered the find from.
Steps to reproduce the problem
"Go to Definition" on a function defined in the same file.
The text was updated successfully, but these errors were encountered: