keywords scoped in places where not actually keywords, IF inside simple interpolation `()` for instance
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 42/100
Direção de pesquisa
Start by reproducing the reported scoping with the PowerShell samples in the issue and compare the result with PSReadLine, where the construct is treated as a command. Inspect the syntax grammar's root patterns and repositories, then verify that if and similarly limited keywords such as in are scoped only where valid, without regressing valid interpolation highlighting.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Environment
- Editor and Version: VS Code: 1.31 Insiders / 1.30.1
- Your primary theme: Monokai Dimmed (modified)
Issue Description
In the following image and code, the if is being scoped as 'keyword.control', as if it was valid to utilize an IF statement at this point. However it is not valid, and the code instead causes an error stating that The term 'if' is not recognized as the name … No syntax error is reported by EditorServices either. PSReadLine however does indicate that the if would be treated as a command instead of a keyword.
Screenshots
VS Code:

PSReadLine

(keywords would be green)
Expected Behavior
I would like to expect that this case would not receive 'keyword.control' scoping, so that I am not led to believe the given command might actually be correct. A quick attempt to correct this indicates that this will require some reorganization, because too many items are in the root patterns and not in the repository.
This also shows that there is more to argument mode vs. expression mode than I had originally thought. Control statements cannot always be used everywhere a command can be used. This also affects other limited scope keywords, such as in, which is scoped as 'keyword.control' in more places than it should be.
Code Samples
'<?xml version="1.0"' + (if ($encoding) {' encoding="' + $encoding + '"'}) + '?>'
The correct code:
'<?xml version="1.0"' + $(if ($encoding) {' encoding="' + $encoding + '"'}) + '?>'
- Linguagem predominante
- PowerShell
- Estrelas
- 151
- Forks
- 55
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de PowerShell/EditorSyntax
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
PowerShell/EditorSyntax#224 · 2 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
PowerShell/EditorSyntax#222 · 2 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
PowerShell/EditorSyntax#221 · 2 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
PowerShell/EditorSyntax#220 · 2 comentários · 1 reação ·
-
Issue-Bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
PowerShell/EditorSyntax#219 · 2 comentários ·
Todas as issues de PowerShell/EditorSyntax
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
nightscout/nocturne#1424 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Abertaarea: repo bug perceived difficulty: 2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
impl detach for native Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
paritytech/zombienet-sdk#591 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
mruangutai/harness#1897 ·