자바스크립트를 활성화 해주세요

v008 vscode 기본 터미널쉘을 Powershell Integrated Console로 하기

 ·  ☕ 2 min read

VSCode의 터미널 정보를 보면, PowerShell이 나오는 경우와 PowerShell Integrated Console이 나오는 경우가 있습니다.
결론부터 말씀드리면, 전자는 PSEdit가 안되고, 후자는 가능합니다.

PowerShell

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
PS C:\Users\Administrator\blog> $host

Name             : ConsoleHost
Version          : 5.1.14393.3471
InstanceId       : 22e2c0f2-c640-4f9f-b954-cbd4eaff67ca
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : ja-JP
CurrentUICulture : ja-JP
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

PowerShell Integrated Console

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
PS C:\Users\Administrator\blog\content\ko> $host

Name             : Visual Studio Code Host
Version          : 2020.6.0
InstanceId       : 6a159ca9-c70e-4043-ab3f-8c17ba153b79
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : ja-JP
CurrentUICulture : ja-JP
PrivateData      : Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorServicesPSHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

VSCode Powershell 전용 Module

Get-Module해보면 다음과 같은 모듈이 Integrated Console에 더 있고,

  • PowerShellEditorServices.VSCode
  • PowerShellEditorServices.Commands

이하와 같은 커맨드를 더 사용할 수 있습니다.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

PS C:\Users\Administrator> Gcm -Module PowerShellEditorServices.VSCode


CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Close-VSCodeHtmlContentView                        0.2.0      PowerShellEditorServices.VSCode
Cmdlet          New-VSCodeHtmlContentView                          0.2.0      PowerShellEditorServices.VSCode
Cmdlet          Set-VSCodeHtmlContentView                          0.2.0      PowerShellEditorServices.VSCode
Cmdlet          Show-VSCodeHtmlContentView                         0.2.0      PowerShellEditorServices.VSCode
Cmdlet          Write-VSCodeHtmlContentView                        0.2.0      PowerShellEditorServices.VSCode


PS C:\Users\Administrator> Gcm -Module PowerShellEditorServices.Commands


CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Clear-Host                                         0.2.0      PowerShellEditorServices.Commands
Function        ConvertFrom-ScriptExtent                           0.2.0      PowerShellEditorServices.Commands
Function        ConvertTo-ScriptExtent                             0.2.0      PowerShellEditorServices.Commands
Function        Find-Ast                                           0.2.0      PowerShellEditorServices.Commands
Function        Get-Token                                          0.2.0      PowerShellEditorServices.Commands
Function        Import-EditorCommand                               0.2.0      PowerShellEditorServices.Commands
Function        Join-ScriptExtent                                  0.2.0      PowerShellEditorServices.Commands
Function        New-EditorFile                                     0.2.0      PowerShellEditorServices.Commands
Function        Open-EditorFile                                    0.2.0      PowerShellEditorServices.Commands
Function        Out-CurrentFile                                    0.2.0      PowerShellEditorServices.Commands
Function        Register-EditorCommand                             0.2.0      PowerShellEditorServices.Commands
Function        Set-ScriptExtent                                   0.2.0      PowerShellEditorServices.Commands
Function        Test-ScriptExtent                                  0.2.0      PowerShellEditorServices.Commands
Function        Unregister-EditorCommand                           0.2.0      PowerShellEditorServices.Commands

이 중에 Open-EditorFile이 psedit 명령어입니다.

$profile 도 별도로 설정되어 있습니다.

1
2
3
4
5
6
7
8
PS C:\Users\Administrator> $profile
C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1

PS C:\Users\Administrator> psedit $profile

PS C:\Users\Administrator> "" > $profile

PS C:\Users\Administrator> psedit $profile

Default Shell 선택

f1을 눌러서요, Terminal: Select Default Shell을 선택합니다.

나오는 쉘 중에서 powershell을 선택하시고 재시작하시면 됩니다.

intergrated terminal

공식 문서는 여기에 있습니다.
https://code.visualstudio.com/docs/editor/integrated-terminal

위 문서를 한글로 좀 적어보자.

터미널을 빠르게 스위치하려면

필수로 사용하고 있는 설정은 아닙니다만, 필요한 경우 다음을 사용하고 있습니다.

//and this will help you quickly change console
{ 
    "key": "ctrl+shift+j", 
    "command": "workbench.action.terminal.focusNext" 
},
{
    "key": "ctrl+shift+k", 
    "command": "workbench.action.terminal.focusPrevious" 
}

PowerLine

저는 사용하고 있지 않습니다만, 장식을 좋아하시는 분들에게는 PowerLine사용해 보시는 것도 좋을 것 같습니다.

지금은 StarShip을 추천합니다.

1
"terminal.integrated.fontFamily": "Meslo LG M DZ for Powerline"

Starship

제대로된 프롬프트를 사용하고 싶다면 StarShip을 추천합니다.

1
2
scoop instal starship
Invoke-Expression (&starship init powershell)

$profile의 제일 뒤에 Invoke-Expression (&starship init powershell)를 추가해 두는 것이 좋습니다.

레퍼런스

이 레퍼런스에는 아주 다양한 terminal 관련 설정이 들어 있습니다.

공유하기

tkim
글쓴이
tkim
Software Engineer