From a2f689281b892332599737439ec80f91ed8c7a69 Mon Sep 17 00:00:00 2001 From: Einherjar Date: Thu, 21 Sep 2023 06:24:23 -0300 Subject: [PATCH] fix: tested with neovim 0.10 --- README.md | 2 +- lua/plugins/lsp.lua | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 24b9cdf..a0721e6 100644 --- a/README.md +++ b/README.md @@ -17,5 +17,5 @@ vscode-langservers-extracted pyright lua-language-server` ## Tmux -Additinally you can use my tmux config to have a nice status bar. +Additionally you can use my tmux config to have a nice status bar. They are located in `tmux.conf`. diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 7c26990..e048182 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -53,9 +53,6 @@ return { config = true, }, }, - opts = function(_, opts) - opts.inlay_hints.enabled = true - end, config = function() -- IMPORTANT: make sure to setup neodev BEFORE lspconfig require("neodev").setup() @@ -105,12 +102,14 @@ return { vim.keymap.set("n", "cwl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, { desc = "[L]ist Folders" }) - -- Enable inlay hints (depends on neovim 0.10) - if vim.lsp.inlay_hint then - vim.lsp.buf.inlay_hint(0, true) -- toggle on by default + -- Enable inlay hints + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client.supports_method("textDocument/inlayHint") then + vim.g.inlay_hints_visible = true + vim.lsp.inlay_hint(ev.buf, true) -- set the keymap to toggle on/off vim.keymap.set("n", "ch", function() - vim.lsp.inlay_hint(0, nil) + vim.lsp.inlay_hint(ev.buf, nil) end, { desc = "Toggle Inlay [H]ints" }) end end,