4 files changed,
66 insertions(+),
2 deletions(-)
Author:
Smirnov Oleksandr
ss2316544@gmail.com
Committed at:
2022-09-26 10:42:08 +0300
Parent:
18041c7
M
lua/configs/lsp/init.lua
@@ -1,4 +1,5 @@
require "configs.lsp.diagnostic"() +require "configs.lsp.inlayhints" require "configs.lsp.null-ls" require("mason-lspconfig").setup { ensure_installed = { "sumneko_lua" },@@ -12,8 +13,8 @@ capabilities = require("cmp_nvim_lsp").update_capabilities(
vim.lsp.protocol.make_client_capabilities() ), } + +require("lua-dev").setup {} for name, conf in pairs(require "configs.lsp.servers") do lspconfig[name].setup(vim.tbl_extend("force", options, conf)) end - -lspconfig.sumneko_lua.setup(require("lua-dev").setup { lspconfig = options })
A
lua/configs/lsp/inlayhints.lua
@@ -0,0 +1,38 @@
+local hints = require "lsp-inlayhints" + +local group = vim.api.nvim_create_augroup("LspAttach_inlayhints", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = group, + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + + local client = vim.lsp.get_client_by_id(args.data.client_id) + hints.on_attach(client, args.buf) + end, +}) + +hints.setup { + debug_mode = false, + inlay_hints = { + parameter_hints = { + show = false, + prefix = "<- ", + separator = ", ", + }, + type_hints = { + show = true, + prefix = "", + separator = ", ", + remove_colon_end = false, + remove_colon_start = false, + }, + labels_separator = " ", + max_len_align = false, + max_len_align_padding = 1, + right_align = false, + right_align_padding = 7, + highlight = "Comment", + }, +}
M
lua/configs/lsp/servers.lua
@@ -11,6 +11,30 @@ gopls = {
linksInHover = false, staticcheck = true, analyses = { unusedparams = true, unreachable = true }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + }, + }, + }, + sumneko_lua = { + settings = { + Lua = { + format = { enable = false }, + hint = { + enable = true, + arrayIndex = "Disable", -- "Enable", "Auto", "Disable" + await = true, + paramName = "Disable", -- "All", "Literal", "Disable" + paramType = false, + semicolon = "Disable", -- "All", "SameLine", "Disable" + setType = true, + }, }, }, },
M
lua/plugins.lua
@@ -150,6 +150,7 @@ { "williamboman/mason-lspconfig.nvim", module = "mason-lspconfig" },
{ "jose-elias-alvarez/null-ls.nvim", module = "null-ls" }, { "b0o/schemastore.nvim", modules = "schemastore" }, { "folke/lua-dev.nvim", module = "lua-dev" }, + { "lvimuser/lsp-inlayhints.nvim", module = "lsp-inlayhints" }, }, }