elbywan / crystalline

A Language Server Protocol implementation for Crystal. 🔮
MIT License
436 stars 23 forks source link

Hover provider returning "?" for any variable #4

Closed davidepaolotua closed 2 years ago

davidepaolotua commented 4 years ago

Hi, first of all, gratz for the great work!

That being said, I have a problem with the hover provider, I am probably doing something wrong from my part, but I cannot really understand what. For any variable, when I hover on it, I always get a "?" as an answer, like the following one: image Is it something normal or is something I can fix?

elbywan commented 4 years ago

Hi @jinn999,

first of all, gratz for the great work!

Thanks! ❤️

For any variable, when I hover on it, I always get a "?" as an answer, like the following one:

? means that the semantic analysis is unable to type your variable. (see Limitations)

Is it located inside a function that never gets called in your code by any chance?

For instance: (the hidden function signature is def a(string : String))

One way to work around that issue would be to write specs testing your code (or create a file calling your functions), and use that as the entry point for crystalline.

davidepaolotua commented 4 years ago

Thanks, that was kinda it - but I'm screwed any way :) What was happening is that

I found out that the reason for this is that I don't use the normal builtin library for specs, but "spectator". Code written in specs goes into a macro, so that is probably the reason why I was not seeing anything :/

Thanks a lot for the info and again gratz!

elbywan commented 4 years ago

Code written in specs goes into a macro, so that is probably the reason why I was not seeing anything

Ah yeah I guess that's it unfortunately :/.