Rewrite Variable Logic From Scratch
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- powershell
- Domain
- devtools
Research direction
No files or tests are named. Start by reviewing the scope and rule questions in this issue and linked issues #127, #129–#133, and #138; done requires a defined grammar rewrite covering the listed variable forms and highlighting cases, but the planned format is still TBD.
Written by the indexing model from the issue text.
Description
There are multiple issues with variables as they stand now in the grammar some of which have been reported and some of which haven't:
- Punctuation in variables with properties and methods isn't scoped correctly: #131
- The sigil for a sub-expression is not handled the same way as the sigil on a variable: #132
- Some language variables like
$_,$$,$?are treated differently depending on context and are currently scoped incorrectly: #133 - Properties and method highlighting breaks when the variable has an array position specified: #127
- Multiple legal characters break variable highlighting (
$Var?Iable), and special automatic variables like$<drive letter>:folderdon't highlight correctly: #49
There are also questions about the correct scope of properties and methods (mentioned #131) and questions about to what extent the grammar should be concerned with user expectation/"most themes" vs either correctness (subjective) or consistency (with which languages?) (#130 and #129).
Background
The following cases need to be covered with as little repetition / complexity as possible:
- Regular variables with and without scopes, properties, array position, methods, etc.
- Variables contained within strings.
- Variables contained within sub-expressions with and without scopes, properties, array position, methods, etc.
- Variables in and out of strings and sub-expressions when using the
${Variable}format again with and without scopes, properties, array position, methods, etc.
The following gotchas need to be taken in to account:
- Which special characters are legal within
${Variable}syntax vs$Variablesyntax. - International characters (
\p{L}vs [A-z]`). - Access of variables through splatting where the sigil is
@. - Separate scoping for constants, automatic variables, language variables, etc.
$$where"$$Hello"needs to show$$as the variable andHelloas part of the double quoted string and other similar oddities.- Lots of others...
Planned Format/Rules
??? tbd
Re: Scope selection -> See #138
- Dominant language
- PowerShell
- Stars
- 151
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PowerShell/EditorSyntax
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
PowerShell/EditorSyntax#224 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
PowerShell/EditorSyntax#222 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
PowerShell/EditorSyntax#221 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
PowerShell/EditorSyntax#220 · 2 comments · 1 reaction ·
-
Issue-Bug
Difficulty 3/5 1-2 days Newbie friendliness 48/100
PowerShell/EditorSyntax#219 · 2 comments ·
All issues in PowerShell/EditorSyntax
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
newrelic-experimental/preflight#793 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
babalae/bettergi-scripts-list#3674 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
caddyserver/caddy#8046 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zilliztech/memsearch#759 ·
-
comp/cron P2 sweeper:risk-automation type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#117792 · 1 comment ·