From 35a331f8276ddb49be5445ae75038aa6edcd6729 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Wed, 25 Mar 2026 10:24:31 +0100 Subject: [PATCH] [Lua] Load luarocks modules directory --- README.md | 4 ++++ nvim/lua/plugins/lsp/ls/luals.lua | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1c7967..a804cec 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ It uses Lazy.nvim as the plugin manager, lspconfig for the language server confi ## Linter configs You may find the linter configs and setup-scripts for some linters that require some extra setup [here](https://git.janishutz.com/janishutz/dotfiles/) +# Lua notes +To get your luarocks packages to be picked up by the language server, it is currently configured to only look at the `cwd` that nvim is open in. +I may expand that in the future to do a proper search for all open buffers, but that would require a language server restart to apply on every buffer add + # Issues with jdtls Ensure you have jdk21-opnejdk or newer installed. On Arch (and derivatives) you can switch the preferred java version using `archlinux-java set ` diff --git a/nvim/lua/plugins/lsp/ls/luals.lua b/nvim/lua/plugins/lsp/ls/luals.lua index 1e29813..3bd89c4 100644 --- a/nvim/lua/plugins/lsp/ls/luals.lua +++ b/nvim/lua/plugins/lsp/ls/luals.lua @@ -20,12 +20,13 @@ lsp.config("lua_ls", { library = { vim.fn.expand("$VIMRUNTIME/lua"), vim.fn.stdpath("config") .. "/lua", - vim.fn.expand("~/.luarocks/share/lua/5.3"), + vim.fn.expand("~/.luarocks/share/lua/5.4"), -- To use LÖVR, follow https://lovr.org/docs/dev/VS_Code_Setup#manual-installation -- TL;DR run lovr api cats in the lovr-docs repo and update the path below -- Then update the blow path (if you have not used the script in this repo) vim.fn.expand("~/.local/share/lovr-docs/api/cats"), - "/usr/share/lua/5.3", + vim.fn.expand(vim.fn.getcwd() .. "/lua_modules/share/lua/5.4"), + "/usr/share/lua/5.4", }, }, },