teal-language / teal-language-server

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

[next] `textDocument/hover` fails in `tl.tl` #20

Closed pdesaulniers closed 1 month ago

pdesaulniers commented 1 month ago

To reproduce:

1) Install tl from the next branch and lua-language-server from the tl-next branch 2) Add a tlconfig.lua file in https://github.com/teal-language/tl/tree/next (see https://github.com/teal-language/teal-language-server/issues/19) 3) Run the language server in tl's source tree (next branch) 4) Hover pretty much any symbol with the mouse

{
    "message": "Error in handler for request with method {0}: {1}",
    "level": "ERROR",
    "module": "lsp_events_manager",
    "timestamp": 1726792888,
    "fields": {
        "1": "/home/patrick/.luarocks/share/lua/5.4/tl.lua:13399: attempt to index a nil value (field 'reporter')\nstack traceback:\n\t/home/patrick/.luarocks/share/lua/5.4/tl.lua:13399: in function 'tl.get_types'\n\t...luarocks/share/lua/5.4/teal_language_server/document.lua:158: in function 'teal_language_server.document.get_type_report'\n\t...luarocks/share/lua/5.4/teal_language_server/document.lua:427: in function 'teal_language_server.document.type_information_at'\n\t...cks/share/lua/5.4/teal_language_server/misc_handlers.lua:286: in function 'teal_language_server.misc_handlers._on_hover'\n\t...cks/share/lua/5.4/teal_language_server/misc_handlers.lua:317: in field '?'\n\t...hare/lua/5.4/teal_language_server/lsp_events_manager.lua:41: in function <...hare/lua/5.4/teal_language_server/lsp_events_manager.lua:41>\n\t[C]: in function 'xpcall'\n\t...hare/lua/5.4/teal_language_server/lsp_events_manager.lua:40: in function 'teal_language_server.lsp_events_manager._trigger'\n\t...hare/lua/5.4/teal_language_server/lsp_events_manager.lua:78: in function <...hare/lua/5.4/teal_language_server/lsp_events_manager.lua:69>",
        "0": "textDocument/hover"
    },
    "time": 19.485117641998
}
pdesaulniers commented 1 month ago

Sorry, I opened this issue too fast! It seems like the tl-check branch doesn't typecheck yet :)

svermeulen commented 1 month ago

At least one of the issues was that the lua wasn't generated yet for TLS in tl-next branch. I've generated it now, but it still may not work yet since I haven't tested it