From ca5de9306c00d07cce1daef1f0038c937098bc66 Mon Sep 17 00:00:00 2001 From: Chinmay Dalal Date: Tue, 20 Jun 2023 11:36:54 +0530 Subject: feat(lsp): inlay hints #23984 Add automatic refresh and a public interface on top of #23736 * add on_reload, on_detach handlers in `enable()` buf_attach, and LspDetach autocommand in case of manual detach * unify `__buffers` and `hint_cache_by_buf` * use callback bufnr in `on_lines` callback, bufstate: remove __index override * move user-facing functions into vim.lsp.buf, unify enable/disable/toggle Closes #18086 --- test/functional/plugin/lsp/inlay_hint_spec.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/functional') diff --git a/test/functional/plugin/lsp/inlay_hint_spec.lua b/test/functional/plugin/lsp/inlay_hint_spec.lua index b134095c4f..103fd8d968 100644 --- a/test/functional/plugin/lsp/inlay_hint_spec.lua +++ b/test/functional/plugin/lsp/inlay_hint_spec.lua @@ -63,7 +63,7 @@ describe('inlay hints', function() end) it( - 'inlay hints are applied when vim.lsp._inlay_hint.refresh() is called', + 'inlay hints are applied when vim.lsp.buf.inlay_hint(true) is called', function() exec_lua([[ bufnr = vim.api.nvim_get_current_buf() @@ -72,7 +72,7 @@ describe('inlay hints', function() ]]) insert(text) - exec_lua([[vim.lsp._inlay_hint.refresh({bufnr = bufnr})]]) + exec_lua([[vim.lsp.buf.inlay_hint(bufnr, true)]]) screen:expect({ grid = [[ auto add(int a, int b)-> int { return a + b; } | @@ -89,7 +89,7 @@ describe('inlay hints', function() end) it( - 'inlay hints are cleared when vim.lsp._inlay_hint.clear() is called', + 'inlay hints are cleared when vim.lsp.buf.inlay_hint(false) is called', function() exec_lua([[ bufnr = vim.api.nvim_get_current_buf() @@ -98,7 +98,7 @@ describe('inlay hints', function() ]]) insert(text) - exec_lua([[vim.lsp._inlay_hint.refresh({bufnr = bufnr})]]) + exec_lua([[vim.lsp.buf.inlay_hint(bufnr, true)]]) screen:expect({ grid = [[ auto add(int a, int b)-> int { return a + b; } | @@ -112,7 +112,7 @@ describe('inlay hints', function() | ]] }) - exec_lua([[vim.lsp._inlay_hint.clear()]]) + exec_lua([[vim.lsp.buf.inlay_hint(bufnr, false)]]) screen:expect({ grid = [[ auto add(int a, int b) { return a + b; } | -- cgit