summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-05-19 19:29:42 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-05-19 19:32:44 +0200
commitb5dcfa4345287ae20edc52093c2546de39589ec8 (patch)
tree1e6ca61c07c8ea576a65fa01a84746a601706d73
parenta146a3dee5260d1352fe34b1b60dbe8aa5a1d68a (diff)
downloaddotfiles-b5dcfa4345287ae20edc52093c2546de39589ec8.tar.gz
dotfiles-b5dcfa4345287ae20edc52093c2546de39589ec8.zip
fix: root Claude Code lua_ls at ~/.config/nvim
- lua-lsp rooted lua_ls at $HOME: ignored .luarc.json, flooded 'Undefined global vim', no IntelliSense on the nvim config. - New local marketplace/plugin lua-lsp-local@local-lsp: .lsp.json sets workspaceFolder=~/.config/nvim, Neovim runtime as workspace.library, diagnostics.libraryFiles=Disable. - Disable official lua-lsp (enabledPlugins) so one server owns .lua. - Verified by probe: rootUri now file:///home/tvanbesi/.config/nvim, flood gone. - Annotate the intentional open_floating_preview monkey-patch (clears the now-correct duplicate-set-field). - README: validate/add/install/disable repro + plugin-update workflow.
-rw-r--r--.claude/lsp-marketplace/.claude-plugin/marketplace.json13
-rw-r--r--.claude/lsp-marketplace/README.md38
-rw-r--r--.claude/lsp-marketplace/plugins/lua-lsp-local/.claude-plugin/plugin.json8
-rw-r--r--.claude/lsp-marketplace/plugins/lua-lsp-local/.lsp.json25
-rw-r--r--.claude/settings.json13
-rw-r--r--.config/nvim/plugin/50-lsp.lua1
6 files changed, 96 insertions, 2 deletions
diff --git a/.claude/lsp-marketplace/.claude-plugin/marketplace.json b/.claude/lsp-marketplace/.claude-plugin/marketplace.json
new file mode 100644
index 0000000..4821b64
--- /dev/null
+++ b/.claude/lsp-marketplace/.claude-plugin/marketplace.json
@@ -0,0 +1,13 @@
+{
+ "name": "local-lsp",
+ "owner": {
+ "name": "tvanbesi"
+ },
+ "plugins": [
+ {
+ "name": "lua-lsp-local",
+ "source": "./plugins/lua-lsp-local",
+ "description": "lua-language-server rooted at the Neovim config, with the Neovim runtime as library"
+ }
+ ]
+}
diff --git a/.claude/lsp-marketplace/README.md b/.claude/lsp-marketplace/README.md
new file mode 100644
index 0000000..135b0f9
--- /dev/null
+++ b/.claude/lsp-marketplace/README.md
@@ -0,0 +1,38 @@
+# local-lsp marketplace
+
+Local Claude Code marketplace holding `lua-lsp-local` — a `lua-language-server` config that roots at `~/.config/nvim`
+(via `.lsp.json` `workspaceFolder`) with the Neovim runtime as `workspace.library`, so `vim` resolves and the
+`$HOME`-root diagnostic flood is gone.
+
+Why this exists: the official `lua-lsp@claude-plugins-official` roots `lua_ls` at `$HOME`, which ignored
+`~/.config/nvim/.luarc.json` and flooded `Undefined global vim` (no IntelliSense). See memory
+`reference_claude_lua_lsp.md`.
+
+## Install / reproduce (fresh machine)
+
+`settings.json` (`enabledPlugins`, `extraKnownMarketplaces`) carries the result, but on a clean setup run, in order:
+
+```sh
+claude plugin validate /home/tvanbesi/.claude/lsp-marketplace/plugins/lua-lsp-local
+claude plugin marketplace add /home/tvanbesi/.claude/lsp-marketplace
+claude plugin install lua-lsp-local@local-lsp # user scope
+claude plugin disable lua-lsp@claude-plugins-official # one server owns .lua
+```
+
+Then restart the session (LSP servers only start fresh on launch).
+
+## After editing this plugin
+
+Claude copies the plugin to its cache on install; source edits don't apply until:
+
+```sh
+claude plugin marketplace update local-lsp
+claude plugin install lua-lsp-local@local-lsp # reinstall
+```
+
+(or bump `version` in `plugins/lua-lsp-local/.claude-plugin/plugin.json`), then restart.
+
+## Verify
+
+Throwaway-edit a `.lua` file under `~/.config/nvim`; the Claude `lua_ls` (`ps`-child of `claude`) log should show
+`rootUri = file:///home/tvanbesi/.config/nvim` and no `Undefined global vim`.
diff --git a/.claude/lsp-marketplace/plugins/lua-lsp-local/.claude-plugin/plugin.json b/.claude/lsp-marketplace/plugins/lua-lsp-local/.claude-plugin/plugin.json
new file mode 100644
index 0000000..8819760
--- /dev/null
+++ b/.claude/lsp-marketplace/plugins/lua-lsp-local/.claude-plugin/plugin.json
@@ -0,0 +1,8 @@
+{
+ "name": "lua-lsp-local",
+ "description": "lua-language-server configured for the Neovim dotfiles: rooted at ~/.config/nvim with the Neovim runtime as a library so `vim` resolves and the $HOME-root diagnostic flood is avoided.",
+ "version": "1.0.0",
+ "author": {
+ "name": "tvanbesi"
+ }
+}
diff --git a/.claude/lsp-marketplace/plugins/lua-lsp-local/.lsp.json b/.claude/lsp-marketplace/plugins/lua-lsp-local/.lsp.json
new file mode 100644
index 0000000..6d8e3dd
--- /dev/null
+++ b/.claude/lsp-marketplace/plugins/lua-lsp-local/.lsp.json
@@ -0,0 +1,25 @@
+{
+ "lua": {
+ "command": "lua-language-server",
+ "extensionToLanguage": {
+ ".lua": "lua"
+ },
+ "workspaceFolder": "/home/tvanbesi/.config/nvim",
+ "settings": {
+ "Lua": {
+ "runtime": {
+ "version": "LuaJIT"
+ },
+ "workspace": {
+ "checkThirdParty": false,
+ "library": [
+ "/home/tvanbesi/.local/share/nvim/share/nvim/runtime"
+ ]
+ },
+ "diagnostics": {
+ "libraryFiles": "Disable"
+ }
+ }
+ }
+ }
+}
diff --git a/.claude/settings.json b/.claude/settings.json
index e60abaf..9e93121 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -52,8 +52,17 @@
},
"enabledPlugins": {
"clangd-lsp@claude-plugins-official": true,
- "lua-lsp@claude-plugins-official": true,
- "pyright-lsp@claude-plugins-official": true
+ "lua-lsp@claude-plugins-official": false,
+ "pyright-lsp@claude-plugins-official": true,
+ "lua-lsp-local@local-lsp": true
+ },
+ "extraKnownMarketplaces": {
+ "local-lsp": {
+ "source": {
+ "source": "directory",
+ "path": "/home/tvanbesi/.claude/lsp-marketplace"
+ }
+ }
},
"theme": "auto",
"editorMode": "vim",
diff --git a/.config/nvim/plugin/50-lsp.lua b/.config/nvim/plugin/50-lsp.lua
index 7f62dae..3b3fd4f 100644
--- a/.config/nvim/plugin/50-lsp.lua
+++ b/.config/nvim/plugin/50-lsp.lua
@@ -27,6 +27,7 @@ vim.api.nvim_create_user_command("LspInspect", inspect_lsp, { desc = "Inspect LS
-- The float is still clamped to the available screen space, so a signature
-- longer than the popup can fit will still wrap (just less often).
local open_floating_preview = vim.lsp.util.open_floating_preview
+---@diagnostic disable-next-line: duplicate-set-field -- intentional monkey-patch
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.max_width = opts.max_width or 120