Skip to content

Commit a8b28e0

Browse files
Fix #5086 - Invalid JSON in the snippets file (#5087)
* Fixed JSON * Added test for making sure all JSON files are valid JSON * Run in correct dir * Simplify title of the new step Co-authored-by: Andy Jordan <[email protected]> * Fix path double nesting Co-authored-by: Andy Jordan <[email protected]> * Add spaces after commas Co-authored-by: Andy Jordan <[email protected]> * Use $PWD instead of '.\' for current dir 🐧 * Only test the snippets JSON file * Oops, typo --------- Co-authored-by: Andy Jordan <[email protected]>
1 parent 18b7263 commit a8b28e0

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

.github/workflows/ci-test.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ name: CI Tests
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
77
# The branches below must be a subset of the branches above
8-
branches: [ main ]
8+
branches: [main]
99
merge_group:
10-
types: [ checks_requested ]
10+
types: [checks_requested]
1111

1212
jobs:
1313
ci:
1414
name: node
1515
strategy:
1616
matrix:
17-
os: [ windows-latest, macos-latest, ubuntu-latest ]
17+
os: [windows-latest, macos-latest, ubuntu-latest]
1818
runs-on: ${{ matrix.os }}
1919
env:
2020
DOTNET_NOLOGO: true
@@ -33,6 +33,11 @@ jobs:
3333
with:
3434
path: vscode-powershell
3535

36+
- name: Validate snippets JSON file
37+
shell: pwsh
38+
run: $null = ConvertFrom-Json -InputObject (Get-Content -Raw -Path './snippets/PowerShell.json')
39+
working-directory: vscode-powershell
40+
3641
- name: Install dotnet
3742
uses: actions/setup-dotnet@v4
3843
with:

snippets/PowerShell.json

+16-17
Original file line numberDiff line numberDiff line change
@@ -162,24 +162,23 @@
162162
]
163163
},
164164
"Foreach with Progress": {
165-
"prefix": "foreach-progress",
165+
"prefix": "foreach-progress",
166166
"description": "Insert a foreach loop with Write-Progress initialized",
167-
"body": [
168-
\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$array.count,4) * 100)",
169-
170-
Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$array.count - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
171-
"\\$i = 1",
172-
"foreach ($${2:item} in $${1:array}) {",
173-
" \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
174-
" Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
175-
" # Insert Code Here",
176-
" ${0}",
177-
" ",
178-
" \\$i++",
179-
"}",
180-
""
181-
]
182-
},
167+
"body": [
168+
"\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$array.count,4) * 100)",
169+
"Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$array.count - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
170+
"\\$i = 1",
171+
"foreach ($${2:item} in $${1:array}) {",
172+
" \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
173+
" Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
174+
" # Insert Code Here",
175+
" ${0}",
176+
" ",
177+
" \\$i++",
178+
"}",
179+
""
180+
]
181+
},
183182
"ForEach-Object -Parallel": {
184183
"prefix": "foreach-parallel",
185184
"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",

0 commit comments

Comments
 (0)