From 10693af512c10f175ce3335bf6833e17b8a7d3b5 Mon Sep 17 00:00:00 2001 From: Will Ehrendreich Date: Thu, 2 May 2024 11:06:14 -0500 Subject: [PATCH] fix(errors) new vim.lsp.inlay_hint api, new vim.lsp.get_clients api, fixed Autocommands --- lua/ionide/init.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lua/ionide/init.lua b/lua/ionide/init.lua index 5b5109e..6ad0aed 100644 --- a/lua/ionide/init.lua +++ b/lua/ionide/init.lua @@ -1208,10 +1208,14 @@ end --- - Function which can be used to cancel all the requests. You could instead --- iterate all clients and call their `cancel_request()` methods. function M.CallFSharpWorkspacePeek(directoryPath, depth, excludedDirs, handler) - ---@type LspClient - -- local i= vim.lsp.get_client_by_id( - local i = vim.lsp.get_client_by_id(0) - vim.notify("Lsp peek client" .. vim.inspect(i)) + ---@type vim.lsp.get_clients.Filter + local lspFilter = { + name = "ionide", + } + + ---@type vim.lsp.Client + local i = vim.lsp.get_clients(lspFilter) + vim.notify("Lsp peek client " .. vim.inspect(i)) -- i. return M.Call("fsharp/workspacePeek", M.CreateFSharpWorkspacePeekRequest(directoryPath, depth, excludedDirs), handler) @@ -1399,10 +1403,10 @@ function M.RegisterAutocmds() if M.MergedConfig.settings.FSharp.inlayHints.enabled == true then vim.defer_fn(function() -- M.notify("enabling lsp inlayHint") - if vim.lsp.inlay_hint then - vim.lsp.inlay_hint(args.buf, true) - elseif vim.lsp.buf.inlay_hint then + if vim.lsp.buf.inlay_hint then vim.lsp.buf.inlay_hint(args.buf, true) + elseif vim.lsp.inlay_hint then + vim.lsp.inlay_hint.enable(true) else end end, 2000) @@ -1431,7 +1435,7 @@ function M.RegisterAutocmds() end, }) - autocmd({ "CursorHold,InsertLeave" }, { + autocmd({ "CursorHold", "CursorHoldI", "InsertLeave" }, { desc = "Ionide Show Signature on cursor move or hold", group = grp("FSharp_ShowSignatureOnCursorMoveOrHold", { clear = true }), pattern = "*.fs,*.fsi,*.fsx",