vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Highlight related keywords under cursor

Open MartinGC94 opened this issue 1 year ago • 1 comments

Prerequisites

  • [X] I have written a descriptive issue title.
  • [X] I have searched all issues to ensure it has not already been reported.

Summary

Some keywords relate to each other, like "break" or "continue" inside a loop statement. It would be nice if these keywords got highlighted when placing the cursor on them just like it happens in VS and VScode when writing C# code. Here's an example: image

This makes it easier to tell at a glance which loop I'm breaking out of in a nested loop scenario.

The scenarios that C# covers from my memory are:
1: Obvious pairs (if/else, try/catch/finally)
2: Return statements inside methods
3: Loops and flow control statements

All 3 seem like they would be pretty simple to handle with some AST analysis, however because PowerShell has loop labels extra care should be taken when determining what loop the flow control statements relate to.

Proposed Design

No response

MartinGC94 avatar Oct 06 '24 19:10 MartinGC94

I believe this is the LSP for that: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentHighlight

JustinGrote avatar Oct 07 '24 16:10 JustinGrote