zigtools / zls

A Zig language server supporting Zig developers with features like autocomplete and goto definition
MIT License
2.86k stars 290 forks source link

use document highlighting to show matching control flow statements #2004

Open Techatrix opened 1 month ago

Techatrix commented 1 month ago

The textDocument/documentHighlight request can be used to highlight control flow statements like continue and break with their for or while loop and vice versa. The end result should look similar to the following demo:

https://github.com/user-attachments/assets/7130f4bb-574e-494b-945c-ff70916eaed8

This could also be applied to symbol references i.e "Find All References" / "Go to References". Perhaps other keywords like defer, try, return could get similar features.