JohnnyMorganz / luau-lsp

Language Server Implementation for Luau
MIT License
235 stars 59 forks source link

goto definition on require paths #612

Open itsfrank opened 4 months ago

itsfrank commented 4 months ago

This is the one feature I miss the most from lua-ls.

In lua-ls if I have my cursor on the string portion of a require statement, e.g.:

local foo = require("./f[]oo")` -- where '[]' is my cursor

If I hit my "goto definition" hotkey (in my case: <leader>gd) it will send me to line 1, column 1 of that file.

This does not seem to work in luau-lsp, it would be a helpful feature to add.

I could see how this would be challenging with Roblox paths however

JohnnyMorganz commented 4 months ago

We already support document links as part of the protocol, and we add these for require statements - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentLink

Are these not sufficient for your usecases? For example in vscode you will see below: image

It's not the same as go to definition protocol, but i don't think it really makes sense here. It sounds like you are using (neo)vim, maybe check what the keybind for follow link is there?

lopi-py commented 4 months ago

He seems to be using neovim. I don't think neovim supports lsp's follow link, but other servers (clangd, rust-analyzer, tsserver, lua-ls, etc) do support this as go-to-definition