castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
423 stars 25 forks source link

Not working in a `.erb` enviroment #142

Open guledali opened 5 years ago

guledali commented 5 years ago

Nothing happens in a .erb file, is there no support for erb files at all?

Or maybe I'm doing something wrong, I feel like this plugin should be covering the template files as well. Particularly something as basic as an erb file.

Then there is a lot of rails method that I'm not getting intellisense & type definition for like validates in activemodel, before_action in controllers and same goes for redirect_to method even the assertions for mini-testing.

Again a lot stuff missing, I do see intellisense for my own created methods which nice but not enough when you are using a framework like rails.

shamca65 commented 4 years ago

Is this just a matter of adding **.html.erb to the .solargraph.yml ?

castwide commented 4 years ago

Unfortunately, it's a lot more complicated. First, the extension would need to be modified to include .erb files in server queries. Then there are some internal issues that need to be resolved:

I might have a workable solution for the parser issue. The rest are much more difficult, and they're necessary to get accurate results for things like autocomplete.

shanlalit commented 3 years ago

Instead of full auto-completion can we expect the go-to definition to work in Rails views? I'm using a helper method in a view and for some reason, the go-to definition doesn't work for helper methods in the views.

metalelf0 commented 3 years ago

@shanlalit my two-cents workaround, for the moment, is to resort to ctags to navigate from erb and slim files. You could go as far as remapping your LSP navigation commands when inside those files, so you could use the same keys instead of <C-]>. It requires maintaining a tags file, and it might be an hassle depending on your project, but it's still better than nothing.

ksweetie commented 2 years ago

I would also appreciate just the go-to definition from Rails views. The parser could potentially ignore most of the file, since any ruby code should be to the right of a - or =.

# slim
div = foo_helper(bar)
martinbarilik commented 9 months ago

Is it just like that ? It's not possible to use solargraph in html.erb files ? Model, nor template or partial go to definitions are not working.

Is it expected ? Just to be sure, i have spend too much time trying to make it work :)