`Invoke-Formatter -Range` silently drops corrections after earlier fixes shift text
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 68/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- powershell
- Domínio
- tooling
Direção de pesquisa
Comece pelo ponto de entrada Invoke-Formatter -Range e reproduza o comando fornecido nas versões especificadas do PSScriptAnalyzer. Rastreie como as correções iterativas de formatação são filtradas em relação ao intervalo selecionado e, em seguida, verifique se todas as correções dentro da instrução completa são aplicadas, incluindo o espaço final antes de }.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Steps to reproduce
Format only the second line, with the range covering the complete statement:
Invoke-Formatter -ScriptDefinition "if(`$a){'x'}`nif(`$b){'y'}" -Range @(2, 1, 2, 12)
Expected behavior
Every formatting correction within the selected statement should be applied:
if($a){'x'}
if ($b) { 'y' }
Actual behavior
The space before the final } is missing:
if($a){'x'}
if ($b) { 'y'}
The formatter applies fixes iteratively. Earlier corrections make the selected line longer, but later violations are still filtered against the original fixed range coordinates. Once a correction shifts beyond the original range end, it is silently dropped even though it belongs to the statement selected by the caller.
Expected resolution
Track the range through applied edits, or filter corrections once against their original extents, so that a range covering a complete statement formats that statement completely.
Environment data
Reproduced with:
- PSScriptAnalyzer 1.25.0 on PowerShell 7.5.2
- PSScriptAnalyzer built from
mainat PowerShell/PSScriptAnalyzer@4b0117ca7d2887711c9699f467ba7171f8859156 on PowerShell 7.6.4
- Linguagem predominante
- C#
- Estrelas
- 2.2k
- Forks
- 415
- Merge médio
- 13h 1min
- PRs com merge (30d)
- 2
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/PSScriptAnalyzer
-
Up-for-Grabs
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 78/100
PowerShell/PSScriptAnalyzer#2213 · 2 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
PowerShell/PSScriptAnalyzer#2217 · 1 comentário ·
-
PSUseConsistentIndentation double-indents attribute bodies that open a scriptblock (`[Attr({ … })]`) Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 70/100
PowerShell/PSScriptAnalyzer#2216 · 2 comentários ·
-
`PSPlaceOpenBrace` and `PSPlaceCloseBrace` leave trailing whitespace when expanding one-line blocks Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 70/100
PowerShell/PSScriptAnalyzer#2210 ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
PowerShell/PSScriptAnalyzer#2209 ·
Todas as issues de PowerShell/PSScriptAnalyzer
Issues semelhantes
-
bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
azurenoops/spin_agent#975 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
SubtitleEdit/subtitleedit#15108 · 1 comentário ·