OpsaC - Operating as PowerShell code
published: February 6, 2021 author: Tinu tags: PowerShell categories: Visual-Studio-Code
During the installation, select Additional Tasks, Other and acivate:
The Marketplace offers a variety of extensions for VSCode.
In my opinion, the following extensions are necessary:
Download the desired extension and copy it to the target server.
Set-Location "$($env:ProgramFiles)\Microsoft VS Code\bin"
$Extensions = 'D:\Sources\VSCode'
foreach($item in (get-childitem $Extensions -Filter '*.vsix')){
code --install-extension $item.FullName
}
The extensions are installed in $env:USERPROFILE.vscode\extensions.
After installing the PowerShell Language Support for Visual Studio Code Extension, select the ISE color theme with Ctrl. + K + T, PowerShell ISE.
Press Ctrl + Shift + P, Preferences: Open Settings (JSON) complete with the following entries:
{
"terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"git.ignoreMissingGitWarning": true,
"workbench.sideBar.location": "left",
"workbench.statusBar.visible": true,
"workbench.activityBar.visible": true,
"editor.minimap.enabled": false,
"editor.renderControlCharacters": true,
"explorer.confirmDelete": false,
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"workbench.startupEditor": "newUntitledFile",
"editor.tabCompletion": "on",
"powershell.integratedConsole.focusConsoleOnExecute": true,
"powershell.integratedConsole.showOnStartup": false,
"files.defaultLanguage": "powershell",
"files.autoSave": "onWindowChange",
"git.autofetch": true,
"git.confirmSync": false,
"editor.largeFileOptimizations": false,
"workbench.colorTheme": "Visual Studio Dark",
"terminal.integrated.rendererType": "dom",
"editor.codeActionsOnSave": null,
"python.languageServer": "Pylance",
}
To customize the colors of your vscode, paste this settings into the settings.json:
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#4249a8",
"titleBar.inactiveBackground": "#a8ace6",
"titleBar.activeForeground": "#fff",
"titleBar.inactiveForeground": "#c5c3c3",
"statusBar.foreground": "#fff",
"statusBar.background": "#4249a8"
}
How to replicate the ISE experience in Visual Studio Code
code --extensions-dir
Set the root path for extensions.
code --list-extensions
List the installed extensions.
code --show-versions
Show versions of installed extensions, when using --list-extension.
code --install-extension ( | )
Installs an extension.
code --uninstall-extension ( | )
Uninstalls an extension.
code --enable-proposed-api ()
Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.
Visual Studio Code on Docs.