i have hints working for lua, but not for go.
i've already tried a bunch of stuff like several go configs, though it seems like it is a server problem, because Settings: {} is what i get in healthcheck (so they basically shouldn't be empty, should they?).
syntax autocompletion works fine, "go to declaration" works too.
init.lua:
local capabilities = require('blink.cmp').get_lsp_capabilities()
capabilities.textDocument = capabilities.textDocument or {}
capabilities.textDocument.inlayHint = { dynamicRegistration = false }
local servers = {
clangd = {},
gopls = {
cmd = { 'gopls' },
filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' },
settings = {
gopls = {
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
},
},
},
pyright = {},
ts_ls = {},
lua_ls = {
-- cmd = { ... },
-- filetypes = { ... },
-- capabilities = {},
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
},
},
},
}
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
require('mason-lspconfig').setup {
ensure_installed = {},
automatic_installation = false,
handlers = {
function(server_name)
local server = servers[server_name] or {}
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
}
end,
healthcheck:
vim.lsp: Active Clients ~
- gopls (id: 1)
- Version: {"GoVersion":"go1.25.4","Path":"golang.org/x/tools/gopls", ...}
- Root directory: ~/Documents/coding/learn-go
- Command: { "gopls" }
- Settings: {}
- Attached buffers: 3
- stylua (id: 2)
- Version: 2.3.1
- Root directory: ~/.config/nvim
- Command: { "stylua", "--lsp" }
- Settings: {}
- Attached buffers: 8
- lua_ls (id: 3)
- Version: 3.16.4
- Root directory: ~/.config/nvim
- Command: { "lua-language-server" }
- Settings: {
Lua = {
codeLens = {
enable = true
},
hint = {
enable = true,
semicolon = "Disable"
}
}
}
- Attached buffers: 8
i have tried the following configs for gopls, none of them worked:
gopls = {
settings = {
gopls = {
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
},
},
},
gopls = {
['ui.inlayhint.hints'] = {
compositeLiteralFields = true,
constantValues = true,
parameterNames = true,
},
},
also tried to use plagin, but didn't help either: MysticalDevil/inlay-hints.nvim
also found the go hints definition, but i don't know how do i use this info (also there's an inlay_hint.go):
https://pkg.go.dev/golang.org/x/tools/gopls
please help understand why i can't get inlay hints in neovim for go and how to fix it