Skip to content

Instantly share code, notes, and snippets.

@julian-wendt
Last active January 10, 2024 16:02
Show Gist options
  • Save julian-wendt/5146f2990e1b106ec1de7c0d68f6b907 to your computer and use it in GitHub Desktop.
Save julian-wendt/5146f2990e1b106ec1de7c0d68f6b907 to your computer and use it in GitHub Desktop.
Load Visual Studio Code Workspace Profile
# Add this snippet to your PowerShell profile to detect if PowerShell is running in the integrated terminal of VS Code.
# If true, the snippet immports .vscode.ps1 from the root dir or profile.ps1 from your .vscode directory.
$ScriptRoot = [System.IO.Directory]::GetCurrentDirectory()
if ($env:TERM_PROGRAM -eq 'vscode') {
if ([System.IO.File]::Exists("$ScriptRoot/.vscode.ps1")) {
Import-Module -Name "$ScriptRoot/.vscode.ps1"
return "Successfully loaded workspace profile."
}
elseif ([System.IO.File]::Exists("$ScriptRoot/.vscode/profile.ps1")) {
Import-Module -Name "$ScriptRoot/.vscode/profile.ps1"
return "Successfully loaded workspace profile."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment