Last active
January 10, 2024 16:02
-
-
Save julian-wendt/5146f2990e1b106ec1de7c0d68f6b907 to your computer and use it in GitHub Desktop.
Load Visual Studio Code Workspace Profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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