You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add document highlight for template control flow keywords
Implement textDocument/documentHighlight LSP capability to highlight matching
template control flow keywords (if/else/end, range/end, with/end, etc.).
When the cursor is on a template keyword like {{if}}, {{else}}, or {{end}},
all related keywords in the same control flow block are highlighted together.
This leverages the existing NextLinkedSibling circular list that the parser
already creates for control flow nodes.
title: Add document highlight for template brace matching
4
+
status: completed
5
+
type: feature
6
+
priority: normal
7
+
created_at: 2026-01-19T02:56:39Z
8
+
updated_at: 2026-01-19T03:00:40Z
9
+
---
10
+
11
+
Implement textDocument/documentHighlight LSP capability to highlight matching template control flow keywords (e.g., clicking {{end}} highlights its corresponding {{if}}/{{range}}/etc.).
12
+
13
+
## Background
14
+
The parser already links matching template blocks via `NextLinkedSibling` pointers in `GroupStatementNode`. This creates a linked list connecting related control flow statements:
15
+
```
16
+
{{if .foo}} → {{else if .bar}} → {{else}} → {{end}}
17
+
```
18
+
19
+
## Checklist
20
+
-[ ] Add DocumentHighlightProvider capability to server initialization
21
+
-[ ] Add textDocument/documentHighlight method registration in protocol.go
22
+
-[ ] Implement ProcessDocumentHighlightRequest in methods.go
23
+
-[ ] Create helper to find GroupStatementNode at cursor position
24
+
-[ ] Traverse NextLinkedSibling chain to collect all related keywords
25
+
-[ ] Return highlight ranges for all matched keywords
26
+
-[ ] Add tests for document highlight functionality
0 commit comments