I'm pretty new to Visual Studio Code, and I'm trying to edit some Ruby code. I installed Ruby support, and I enabled the language server, but Ctrl-clicking on a function name doesn't work, and neither does F12. Both of these features work fine for Python code.
How can I navigate from a function call to its definition in Ruby code?
Here's the Ruby code I tried:
def foo
puts "In foo."
end
foo()
Here are my settings:
{
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"terminal.integrated.fontSize": 15,
"git.confirmSync": false,
"ruby.useLanguageServer": true,
"editor.rulers": [80, 120]
}
Here's the Python code that works fine:
def foo():
print('In foo.')
foo()
VS Code provides two powerful commands to navigate in and across files with easy-to-use key bindings. Hold Ctrl and press Tab to view a list of all files open in an editor group. To open one of these files, use Tab again to pick the file you want to navigate to, then release Ctrl to open it.
For jumping to function in currently opened file use Ctrl+Shift+O . From docs: You can navigate symbols inside a file with Ctrl+Shift+O.
VSCode supports multiple languages like C, C++, Python, Ruby, etc.
Go To Definition If you are a keyboard user, place your text cursor somewhere inside the symbol name and press F12. If you are a mouse user, either select Go To Definition from the right-click menu or use the Ctrl-click functionality described in the following section.
Thanks to Chris's suggestion, I got a better error message. Following that lead, I found that Ruby's code navigation seems to require a second language server: solargraph. I don't know if you require both, but I can now navigate to Ruby definitions. I also have autocomplete working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With