Skip to content

Add keymaps for LSP document highlight #149

@peter-bread

Description

@peter-bread
document_highlight()                        *vim.lsp.buf.document_highlight()*
    Send request to the server to resolve document highlights for the current
    text document position. This request can be triggered by a key mapping or
    by events such as `CursorHold`, e.g.: >vim
        autocmd CursorHold  <buffer> lua vim.lsp.buf.document_highlight()
        autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
        autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
<

    Note: Usage of |vim.lsp.buf.document_highlight()| requires the following
    highlight groups to be defined or you won't be able to see the actual
    highlights. |hl-LspReferenceText| |hl-LspReferenceRead|
    |hl-LspReferenceWrite|

One keymap to highlight, another to clear references.

Perhaps in the first, it should clear then highlight so you don't have multiple items highlighted.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions