From 8497608cef900bd8820195364acd9307dd8b3d4c Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sun, 13 Nov 2022 15:11:02 +0100 Subject: Upgrade to neovim 0.8 --- .config/nvim/lua/keybinds.lua | 6 ++--- .config/nvim/lua/lsp.lua | 55 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua index 8f2de84..3d4eac2 100644 --- a/.config/nvim/lua/keybinds.lua +++ b/.config/nvim/lua/keybinds.lua @@ -16,14 +16,14 @@ vim.api.nvim_command("vnoremap :m '<-2gv=gv") vim.keymap.set("n", "n", nt_api.tree.toggle) vim.keymap.set("n", "", vim.lsp.buf.code_action) vim.keymap.set("n", "K", vim.lsp.buf.hover) -vim.keymap.set("n", "D", vim.lsp.buf.definition) -vim.keymap.set("n", "R", vim.lsp.buf.references) -vim.keymap.set("n", "F", vim.lsp.buf.formatting) +vim.keymap.set("n", "F", vim.lsp.buf.format) vim.keymap.set("n", "d", vim.diagnostic.open_float) vim.keymap.set("n", "J", vim.lsp.buf.signature_help) vim.keymap.set("n", "f", telescope.find_files) vim.keymap.set("n", "", telescope.buffers) +vim.keymap.set("n", "D", telescope.lsp_definitions) +vim.keymap.set("n", "R", telescope.lsp_references) vim.keymap.set("n", "m", ":MinimapToggle") vim.keymap.set("n", ",", ":TroubleToggle") diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 5610629..9f9253a 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -66,18 +66,53 @@ cmp.setup({ local on_attach = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - local inlayhints = require("lsp-inlayhints") - inlayhints.setup() - inlayhints.on_attach(client, bufnr) local lsp_signature = require("lsp_signature") lsp_signature.on_attach({ bind = true }, bufnr) + require("lsp-inlayhints").setup() + require("lsp-inlayhints").on_attach(client, bufnr) end +vim.api.nvim_create_augroup("LspAttach_inlayhints", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_inlayhints"; + callback = function(args) + if not (args.data and args.data.client_id) then return end + + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + require("lsp-inlayhints").on_attach(client, bufnr) + end; +}) + local lsputils = require("lspconfig").util require("lspconfig").tsserver.setup({ on_attach = on_attach; root_dir = lsputils.root_pattern("package.json", "tsconfig.json"); + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayVariableTypeHints = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayEnumMemberValueHints = true; + }; + }; + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayVariableTypeHints = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayEnumMemberValueHints = true; + }; + }; + }; }) require("deno-nvim").setup({ @@ -85,7 +120,19 @@ require("deno-nvim").setup({ root_dir = vim.loop.cwd; capabilities = capabilities; on_attach = on_attach; - settings = { enable = true; unstable = true; config = "./deno.jsonc" }; + settings = { + deno = { + unstable = true; + inlayHints = { + enumMemberValues = { enabled = true }; + functionLikeReturnTypes = { enabled = true }; + parameterNames = { enabled = "all" }; + parameterTypes = { enabled = true }; + propertyDeclarationTypes = { enabled = true }; + variableTypes = { enabled = true; suppressWhenTypeMatchesName = false }; + }; + }; + }; }; }); -- cgit v1.2.3