Skip to content

Commit

Permalink
feat: clear lsp references on ui open
Browse files Browse the repository at this point in the history
if you are hovering over some text with an lsp, it highlights
all the references, when entering ssr these highlights are still
visible, this can be visually noisy
  • Loading branch information
A-Lamia committed Aug 10, 2023
1 parent bc9c0d2 commit e38f2cf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/ssr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ function Ui:open()
self.ns = api.nvim_create_namespace ""
self.cur_match_ns = api.nvim_create_namespace ""

local function clear_extmark(namespace)
local ns_id = vim.api.nvim_get_namespaces()[namespace]
vim.api.nvim_buf_clear_namespace(self.origin_buf, ns_id, 0, -1)
end

pcall(clear_extmark, "vim_lsp_references")

local function set_extmark(row, text)
return api.nvim_buf_set_extmark(self.ui_buf, self.ns, row, 0, { virt_text = text, virt_text_pos = "overlay" })
end
Expand Down

0 comments on commit e38f2cf

Please sign in to comment.