From ec6aec85e325232b307774b383f3f599cc19a665 Mon Sep 17 00:00:00 2001 From: winston Date: Mon, 24 Oct 2022 04:35:00 +0200 Subject: [PATCH] feat(nvim): add `go.nvim` --- dot_config/nvim/lua/lsp.lua | 33 +++++++++++++++++++++++++++++++++ dot_config/nvim/lua/plugins.lua | 1 + 2 files changed, 34 insertions(+) diff --git a/dot_config/nvim/lua/lsp.lua b/dot_config/nvim/lua/lsp.lua index e645549..9bcc4ba 100644 --- a/dot_config/nvim/lua/lsp.lua +++ b/dot_config/nvim/lua/lsp.lua @@ -150,6 +150,39 @@ lspconfig.gopls.setup({ on_attach = on_attach, }) +require("go").setup({ + disable_defaults = true, + lsp_inlay_hints = { + enable = true, + -- Only show inlay hints for the current line + only_current_line = false, + -- Event which triggers a refersh of the inlay hints. + -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but + -- not that this may cause higher CPU usage. + -- This option is only respected when only_current_line and + -- autoSetHints both are true. + only_current_line_autocmd = "CursorHold", + -- whether to show variable name before type hints with the inlay hints or not + -- default: false + show_variable_name = true, + -- prefix for parameter hints + parameter_hints_prefix = " ", + show_parameter_hints = true, + -- prefix for all the other hints (type, chaining) + other_hints_prefix = "=> ", + -- whether to align to the lenght of the longest line in the file + max_len_align = false, + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + -- whether to align to the extreme right or not + right_align = false, + -- padding from the right if right_align is true + right_align_padding = 6, + -- The color of the hints + highlight = "Comment", + }, +}) + lspconfig.sumneko_lua.setup({ capabilities = capabilities, on_attach = on_attach, diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua index 24f70f4..a57babd 100644 --- a/dot_config/nvim/lua/plugins.lua +++ b/dot_config/nvim/lua/plugins.lua @@ -268,6 +268,7 @@ return packer.startup({ use("hrsh7th/vim-vsnip") use("petertriho/cmp-git") use("onsails/lspkind.nvim") + use("ray-x/go.nvim") use("rafamadriz/friendly-snippets") use("jose-elias-alvarez/null-ls.nvim") use({