Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 12e78ec

Browse files
committed
Add more VS Code config
1 parent a42429d commit 12e78ec

File tree

9 files changed

+47
-11
lines changed

9 files changed

+47
-11
lines changed

build.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,10 @@ Section "-Pico environment" SecPico
509509
SetOutPath "`${PICO_REPOS_DIR}\pico-examples"
510510
File /r "build\pico-examples\*.*"
511511
SetOutPath "`${PICO_REPOS_DIR}\pico-examples\.vscode"
512-
File /oname=cmake-kits.json "packages\pico-examples\vscode-cmake-kits.json"
513-
File /oname=launch.json "packages\pico-examples\vscode-launch.json"
514-
File /oname=settings.json "packages\pico-examples\vscode-settings.json"
512+
File "packages\pico-examples\ide\vscode\cmake-kits.json"
513+
File "packages\pico-examples\ide\vscode\extensions.json"
514+
File "packages\pico-examples\ide\vscode\launch.json"
515+
File "packages\pico-examples\ide\vscode\settings.json"
515516
516517
SetOutPath "`$INSTDIR\pico-sdk-tools"
517518
File "build\pico-sdk-tools\mingw$bitness\*.*"
@@ -539,8 +540,7 @@ Section "-Pico environment" SecPico
539540
WriteRegStr `${PICO_REG_ROOT} "`${UNINSTALL_KEY}" "Publisher" "$company"
540541
541542
# Find Visual Studio Code, so we can point our shortcut icon to code.exe
542-
ReadEnvStr `$0 COMSPEC
543-
nsExec::ExecToStack '$('"$0" /c call "$TEMP\RefreshEnv.cmd" && where code.cmd' -replace '"', ('"' * 3))'
543+
nsExec::ExecToStack 'cmd.exe /c call "`$TEMP\RefreshEnv.cmd" && where code.cmd'
544544
Pop `$0 # return value/error/timeout
545545
Pop `$1 # stdout
546546
# Get the last line of output
@@ -549,6 +549,11 @@ Section "-Pico environment" SecPico
549549
`${GetParent} "`$1" `$1
550550
StrCpy `$1 "`$1\Code.exe"
551551
552+
`${IfNot} `${FileExists} "`$1"
553+
# Just use the default install location for the icon, in case the user installs VS Code later
554+
StrCpy `$1 "%LOCALAPPDATA%\Programs\Microsoft VS Code\Code.exe"
555+
MessageBox MB_OK|MB_ICONEXCLAMATION "Installation of Visual Studio Code failed. Please install it manually by downloading the installer from:${endl}${endl}https://code.visualstudio.com/" /SD IDOK
556+
`${EndIf}
552557
553558
; Set the working directory for our terminals to the repos directory
554559
SetOutPath "`${PICO_REPOS_DIR}"

config/x64-standalone.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
{
66
"name": "Visual Studio Code",
77
"file": "Install-VSCode.ps1",
8-
"execToLog": "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command & \"$0\" -BuildEdition Stable-User -AdditionalExtensions marus25.cortex-debug,ms-vscode.cmake-tools,ms-vscode.cpptools,ms-vscode.cpptools-extension-pack,ms-vscode.vscode-serial-monitor; & \"$${env:LocalAppData}\\Programs\\Microsoft VS Code\\bin\\code.cmd\" --version",
9-
"href": "https://raw.githubusercontent.com/PowerShell/vscode-powershell/main/scripts/Install-VSCode.ps1"
8+
"execToLog": "cmd.exe /c call \"$PLUGINSDIR\\install-vscode.cmd\" \"$0\"",
9+
"href": "https://raw.githubusercontent.com/PowerShell/vscode-powershell/main/scripts/Install-VSCode.ps1",
10+
"additionalFiles": [
11+
"packages\\pico-setup-windows\\install-vscode.cmd",
12+
"packages\\pico-examples\\ide\\vscode\\extensions.json"
13+
]
1014
},
1115
{
1216
"name": "GNU Arm Embedded Toolchain",

config/x64.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
{
77
"name": "Visual Studio Code",
88
"file": "Install-VSCode.ps1",
9-
"execToLog": "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"$0\" -BuildEdition Stable-User -AdditionalExtensions 'marus25.cortex-debug','ms-vscode.cmake-tools','ms-vscode.cpptools','ms-vscode.cpptools-extension-pack','ms-vscode.vscode-serial-monitor'",
10-
"href": "https://raw.githubusercontent.com/PowerShell/vscode-powershell/main/scripts/Install-VSCode.ps1"
9+
"execToLog": "cmd.exe /c call \"$PLUGINSDIR\\install-vscode.cmd\" \"$0\"",
10+
"href": "https://raw.githubusercontent.com/PowerShell/vscode-powershell/main/scripts/Install-VSCode.ps1",
11+
"additionalFiles": [
12+
"packages\\pico-setup-windows\\install-vscode.cmd",
13+
"packages\\pico-examples\\ide\\vscode\\extensions.json"
14+
]
1115
},
1216
{
1317
"name": "GNU Arm Embedded Toolchain",

config/x86.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
{
77
"name": "Visual Studio Code",
88
"file": "Install-VSCode.ps1",
9-
"execToLog": "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"$0\" -BuildEdition Stable-User -AdditionalExtensions 'marus25.cortex-debug','ms-vscode.cmake-tools','ms-vscode.cpptools','ms-vscode.cpptools-extension-pack','ms-vscode.vscode-serial-monitor'",
10-
"href": "https://raw.githubusercontent.com/PowerShell/vscode-powershell/main/scripts/Install-VSCode.ps1"
9+
"execToLog": "cmd.exe /c call \"$PLUGINSDIR\\install-vscode.cmd\" \"$0\"",
10+
"href": "https://raw.githubusercontent.com/PowerShell/vscode-powershell/main/scripts/Install-VSCode.ps1",
11+
"additionalFiles": [
12+
"packages\\pico-setup-windows\\install-vscode.cmd",
13+
"packages\\pico-examples\\ide\\vscode\\extensions.json"
14+
]
1115
},
1216
{
1317
"name": "GNU Arm Embedded Toolchain",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"marus25.cortex-debug",
4+
"ms-vscode.cmake-tools",
5+
"ms-vscode.cpptools",
6+
"ms-vscode.cpptools-extension-pack",
7+
"ms-vscode.vscode-serial-monitor"
8+
]
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@if not defined _echo echo off
2+
3+
rem We don't want to fail and stop the installer if the Visual Studio Code installation fails.
4+
rem So we use a cmd script instead of a PowerShell one, just in case executing PowerShell fails.
5+
6+
setlocal
7+
set "vscode_exts=(Get-Content '%~dp0extensions.json' | ConvertFrom-Json).recommendations"
8+
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%1' -BuildEdition Stable-User -AdditionalExtensions %vscode_exts%"
9+
10+
exit /b 0

0 commit comments

Comments
 (0)