teal-language / teal-language-server

A language server for Teal, a typed dialect of Lua
MIT License
78 stars 8 forks source link

make textDocument/hover smarter #6

Open euclidianAce opened 3 years ago

euclidianAce commented 3 years ago

currently it only looks at the hovered token, which is fine for simple things, but for indexing in particular it gives no information at all i.e.

local record Foo
   x: number
   record Bar
      y: string
   end
end

hovering on Foo will show the definition

but for hovering something like Foo.Bar will not show any info (except for when you hover over the Foo, but whatever)

To implement this without reimplementing the parser, we either need changes in the teal api to expose more info about nodes or bring in something like tree-sitter. While tree-sitter is nice, I'd like to avoid external deps when possible, especially one that can require some extra steps to install like tree-sitter.