diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 1b448c7eb4..8d416d460a 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -2,19 +2,19 @@ name: CI Tests on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] merge_group: - types: [ checks_requested ] + types: [checks_requested] jobs: ci: name: node strategy: matrix: - os: [ windows-latest, macos-latest, ubuntu-latest ] + os: [windows-latest, macos-latest, ubuntu-latest] runs-on: ${{ matrix.os }} env: DOTNET_NOLOGO: true @@ -33,6 +33,11 @@ jobs: with: path: vscode-powershell + - name: Validate snippets JSON file + shell: pwsh + run: $null = ConvertFrom-Json -InputObject (Get-Content -Raw -Path './snippets/PowerShell.json') + working-directory: vscode-powershell + - name: Install dotnet uses: actions/setup-dotnet@v4 with: diff --git a/snippets/PowerShell.json b/snippets/PowerShell.json index bd478f1ff3..5e25f10286 100644 --- a/snippets/PowerShell.json +++ b/snippets/PowerShell.json @@ -162,24 +162,23 @@ ] }, "Foreach with Progress": { - "prefix": "foreach-progress", + "prefix": "foreach-progress", "description": "Insert a foreach loop with Write-Progress initialized", - "body": [ -\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$array.count,4) * 100)", - -Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$array.count - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", - "\\$i = 1", - "foreach ($${2:item} in $${1:array}) {", - " \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)", - " Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", - " # Insert Code Here", - " ${0}", - " ", - " \\$i++", - "}", - "" - ] - }, + "body": [ + "\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$array.count,4) * 100)", + "Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$array.count - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", + "\\$i = 1", + "foreach ($${2:item} in $${1:array}) {", + " \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)", + " Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", + " # Insert Code Here", + " ${0}", + " ", + " \\$i++", + "}", + "" + ] + }, "ForEach-Object -Parallel": { "prefix": "foreach-parallel", "description": "[PS 7+] Process multiple objects in parallel using runspaces. This has some limitations compared to a regular ForEach-Object. More: Get-Help ForEach-Object",