From 8397547c2fe1553cc0823815303a54cb4ec0c49f Mon Sep 17 00:00:00 2001 From: user3301 <26126682+user3301@users.noreply.github.com> Date: Mon, 5 Oct 2026 22:36:08 +1100 Subject: [PATCH 1/2] Fix Go semantic token initialization in Neovim Enable semantic tokens during gopls initialization so it advertises its own token legend instead of relying on LazyVim's incompatible fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 343d3984-6409-428d-8816-7df7961af61c --- nvim/.config/nvim/README.md | 4 ++++ nvim/.config/nvim/lua/plugins/lsp.lua | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/nvim/.config/nvim/README.md b/nvim/.config/nvim/README.md index 2a0c43d..25de5da 100644 --- a/nvim/.config/nvim/README.md +++ b/nvim/.config/nvim/README.md @@ -30,6 +30,10 @@ Go servers, Mason management is disabled on NixOS and enabled elsewhere. NixOS installs servers, formatters, compiler tools, and fswatch through `home/modules/neovim.nix`. +Go enables semantic tokens in initialization options so gopls advertises its own +token legend. LazyVim's fallback legend does not match modern gopls tokens and +can cause semantic-highlighting errors. + The Nix server `nil` always has Mason management disabled; provide it on `PATH` yourself outside NixOS if you edit Nix files. Native package manifests do not install all language runtimes, servers, or formatters. Mason-managed tools may diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index 231a059..07ffe26 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -59,6 +59,10 @@ return { }, gopls = { mason = not is_nixos, + -- Request gopls's own legend at initialization instead of LazyVim's fallback legend. + init_options = { + semanticTokens = true, + }, -- Explicitly use Nix-installed gopls on NixOS to ensure we don't pick up -- any other version (e.g., from Mason cache, system package, or Go install) cmd = is_nixos and { vim.fn.exepath("gopls") } or nil, From 36fd2458b56c86055d5afa7bd7f6038bdb91220b Mon Sep 17 00:00:00 2001 From: user3301 <26126682+user3301@users.noreply.github.com> Date: Mon, 5 Oct 2026 22:55:21 +1100 Subject: [PATCH 2/2] Remove redundant Go override and document plugin restore The installed LazyVim checkout was 28db03f9, not the locked 99970099 revision. The locked Go extra already supplies semanticTokens in init_options. Remove the duplicate configuration and document restoring the locked plugin instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 343d3984-6409-428d-8816-7df7961af61c --- nvim/.config/nvim/README.md | 8 +++++--- nvim/.config/nvim/lua/plugins/lsp.lua | 4 ---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/nvim/.config/nvim/README.md b/nvim/.config/nvim/README.md index 25de5da..a2337dd 100644 --- a/nvim/.config/nvim/README.md +++ b/nvim/.config/nvim/README.md @@ -30,9 +30,11 @@ Go servers, Mason management is disabled on NixOS and enabled elsewhere. NixOS installs servers, formatters, compiler tools, and fswatch through `home/modules/neovim.nix`. -Go enables semantic tokens in initialization options so gopls advertises its own -token legend. LazyVim's fallback legend does not match modern gopls tokens and -can cause semantic-highlighting errors. +The pinned LazyVim Go extra already enables semantic tokens during gopls +initialization; no local override is needed. An installed plugin checkout can +lag behind `lazy-lock.json`. If Go reports missing `textDocument` capabilities +or semantic-token legend errors, use `:Lazy restore LazyVim` and restart Neovim +to load the locked revision before adding capability workarounds. The Nix server `nil` always has Mason management disabled; provide it on `PATH` yourself outside NixOS if you edit Nix files. Native package manifests do not diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index 07ffe26..231a059 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -59,10 +59,6 @@ return { }, gopls = { mason = not is_nixos, - -- Request gopls's own legend at initialization instead of LazyVim's fallback legend. - init_options = { - semanticTokens = true, - }, -- Explicitly use Nix-installed gopls on NixOS to ensure we don't pick up -- any other version (e.g., from Mason cache, system package, or Go install) cmd = is_nixos and { vim.fn.exepath("gopls") } or nil,