castwide / vscode-solargraph

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

Make IntelliSense work with my own functions #33

Closed garyking closed 6 years ago

garyking commented 6 years ago

This works great for showing the parameters needed for standard Ruby functions, but how do I get it to work with functions that I've created myself? And especially those that are imported from other files using require_relative?

castwide commented 6 years ago

It should work with your own functions. This is what I get with a single file:

image

Support for require_relative is in progress, but Solargraph should automatically map other Ruby files in your workspace. Simple example: if you open a folder containing two files and one of them defines a class, you should get results for the class and its methods in the other file same as above.

garyking commented 6 years ago

Thanks I can confirm everything you said regarding Classes auto-completion.

Does Solargraph only work for classes and not functions? This doesn't work:

def foo(bar)
end

foo()

There's no IntelliSense for foo().

Also does this project support "Go to symbol in workspace"? Or is that the responsibility of other VSC extensions?

castwide commented 6 years ago

Does Solargraph only work for classes and not functions?

Yes, that's a known limitation. Methods defined in the global namespace don't get detected in the maps. There's a fix for it in the gem repo, so it should work correctly in gem version 0.17.4.

Also does this project support "Go to symbol in workspace"? Or is that the responsibility of other VSC extensions?

That's not supported yet, but I expect to add it. I'm in the process of modifying the gem to use the language server protocol and hope to implement as many of its features as possible. ("Go to Definition" and "Peek Definition" currently work.)

garyking commented 6 years ago

Okay thanks. You don't know of any other VSCode extensions that provide "Go to symbol in file/workspace" for Ruby in VSC, would you? Just so I can use those for now. I'm new to VSC and surprised to find that this doesn't already exist for Ruby.

Also, I look forward to the 0.17.4 gem release.

castwide commented 6 years ago

Sorry, I don't. Ruby debug support has been solid for a while thanks to the Ruby extension, but advanced language features are a more recent development.

castwide commented 6 years ago

Gem 0.17.4 with the fix for this issue is published.

castwide commented 6 years ago

The latest versions of the gem and extension use the language server protocol and include support for "Go to symbol in file/workspace."