Open rktjmp opened 8 months ago
With such a config, jump to definition (in another file under the same fnl/
directory) is working?
I have tried to make it work in the past with no success.
I'm not sure if fennel-ls supports jump to definition, but if it does I imagine it will help it work since it could then find the correct files.
Do you know how to add the lua runtime paths to fennel-ls? It would be nice to have completion for plugins and the neovim api.
Guide assumes you're using
lspconfig
.By default, fennel-ls does not include
fnl/
directories in its module and macro search paths.You may either pass updated paths as options to fennel-ls, via
settings.fennel-ls.macro-path|fennel-path
or (IMO, the simpler way) setfnl/
as theroot_dir
for the lsp server, as shown below.The
root_dir
option is a function, which receives the current buffer file path.vim.fs.find
searches from this file path upwards through the tree until it finds a directory namedfnl
or.git
and returns a list of matching paths (by default limited to only the first match). By fetching the first element, we return the path.../fnl/
or nil if there is no match.We also set "vim" as a valid global variable.
Below is an example configuration to pass to
lspconfig.fennel_ls.setup()
:Additionally you may want to disable hotpots own diagnostics as fennel-ls should provide the same errors along with additional linting. There should be no negative impact in keeping both enabled, besides the repeated error reporting.