Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
33 changes: 16 additions & 17 deletions snippets/PowerShell.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down