google / xls

XLS: Accelerated HW Synthesis
http://google.github.io/xls/
Apache License 2.0
1.2k stars 176 forks source link

LSP: highlight all other places of a symbol under the cursor (`textDocument/documentHighlight`) #1660

Open hzeller opened 2 hours ago

hzeller commented 2 hours ago

When the cursor is over a symbol, highlight all other places where this particular symbol is used or where it is defined.

This requires to understand the scope of the symbol, but that information should already be fully there (the rename functionality will already do that).

Spec: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentHighlight

This need to receive verible::lsp::DocumentHighlightParams and return a std::vector<verible::lsp::DocumentHighlight> which are already defined in the lsp-protocol.yaml. The LSP will then advertise that it implements a documentHighlightProvider in its capabilities.

hzeller commented 2 hours ago

@cdleary this sounds like a good recreational LSP feature implementation fun for you.