Context
- Dim dims "matching" parts of code. The matchs are characterized as "secondary" parts of the source code, thus they need to be de-ranked in the user interface's order of attention.
- Since now, Dim asked users for the matching rules. Which has allowed flexible use of extension, across languages and for different purposes. The syntax is still using Regular expressions.
- Regular expressions are not feasible for defining patterns that suppose to match source code, as source code often inherently repeats the tokens normally used for denoting the start of end of match sequence for recursive code blocks often called scopes, or sub-scopes.
Problem
Defining rules with regular expressions may lead unexpected results for users when the areas supposed to match also use the ending token for ending sub-sections (eg. nested scopes).
Suggestion
Change the extension to aplpy dimming on each block of code that the uesr is not actively working inside it. The block patterns are not defined by the user but detected by the extension. The detection unit accounts syntax of the block defining elements differ across languages which examples are shown in the table below. The active use of a block means the presence of a caret inside the block's code range.
| Block kind |
Example block |
Example languages |
| Brace-delimited blocks |
{ ... } |
JS, TS, Java, C#, C, C++ |
| Indentation-delimited blocks |
: |
Python, YAML |
| Paired keyword blocks |
begin...end, if...fi |
Shell |
| Tag regions |
<tag>...</tag> |
XML/HTML |
Without additional effort, the suggestion above also means that the extension will also dim the inactive siblings of any active block. Results with the blocks that (eventually) contains the "active leaf block" follow a non-basic (eg. rectangular) shape after they are "carved out" from the inactive sub-sections.
Existing solutions
There is no direct competitor which provides the suggested feature.
- Another extension called Blockman seems to perform similar block detection job for different purpose. Instead, it uses the information to make the block boundaries and block hierarchy more prominent to user. Which in one sense, is the exact opposite of the suggested feature.
Context
Problem
Defining rules with regular expressions may lead unexpected results for users when the areas supposed to match also use the ending token for ending sub-sections (eg. nested scopes).
Suggestion
Change the extension to aplpy dimming on each block of code that the uesr is not actively working inside it. The block patterns are not defined by the user but detected by the extension. The detection unit accounts syntax of the block defining elements differ across languages which examples are shown in the table below. The active use of a block means the presence of a caret inside the block's code range.
{ ... }:begin...end,if...fi<tag>...</tag>Without additional effort, the suggestion above also means that the extension will also dim the inactive siblings of any active block. Results with the blocks that (eventually) contains the "active leaf block" follow a non-basic (eg. rectangular) shape after they are "carved out" from the inactive sub-sections.
Existing solutions
There is no direct competitor which provides the suggested feature.