"Request textDocument/definition failed" from Hanami project
Closed this issue · 4 comments
RuBAN-GT commented
Prerequisites
My environment:
- System:
MacOS 13.4.1
- Ruby:
3.2.1
- Solargraph:
0.49.0
- Hanami:
2.0.3
How to reproduce
- Generate a new project using Hanami CLI:
hanami new web
- Open project using vscode and relevant extension: https://github.com/castwide/vscode-solargraph
- You should see the error from Output panel:
[Error - 10:23:10 PM] Request textDocument/definition failed.
Message: [NoMethodError] undefined method `filename' for ["/Users/dkruban/Development/web/lib"]:Array
Code: -32603
In order to save your time I published it: https://github.com/RuBAN-GT/hanami-example
Problem place
lib/solargraph/library.rb:278
Whenlocate_ref
method ofLibrary#locate_ref
can't find the appropriate location it responds with theworkspace
variable content (array), thereforeDefinition#require_location
raises above error.
Ideas
The most quickest fix - is returns nil when workspace doesn't have needed location, but it still doesn't have any result. So it's just hotfix.
dj-sf commented
I am also having this problem
castwide commented
Fixed on master. The fix will be included in the next gem release later this month.
castwide commented
Released in v0.50.0.