Hi people!
Currently crystal tool hierarchy isn't showing class location.
class MiClase
end
a = MiClase.new
a
$ crystal tool hierarchy mi_clase.cr -e MiClase --no-color
- class Object (4 bytes)
|
+- class Reference (4 bytes)
|
+- class MiClase (4 bytes)
I think it is very useful to find clases using extensions like vscode-crystal-lang
This idea was suggested by @Qwerp-Derp
Can you add support for finding the definition of a function/class/module/etc., like with other language plugins in VSCode?
So for example, in this code:
def foo
Bar::Baz(10)
end
If I go to Bar and right-click, and select "Peek definition", it should bring me to where Bar is defined
Some similar to https://github.com/crystal-lang/crystal/issues/4766
/cc @MakeNowJust :sweat_smile:
I think we can have the docs tool output JSON format and include location of types and methods. That way you can solve your use case by using that.
locations, for methods and macros it's source_link. Though the latter could certainly be improved.4746 implements this already.
Hi @straight-shoota, Would be possible to output modules and classes in JSON using crystal tool command?
What command do you refer to? crystal tool hierarchy can already output JSON (--format json).
@straight-shoota I mean class and module location file:line:column to be able to use it within extensions
For the hierarchy command or docs?
It should be easily doable to include this in the docs JSON. I don't know much about the hierarchy tool, but since it works on ASTNodes it should be no big deal as well.
Have someone looked into this yet? Otherwise I might to help the editor integrations out there.