vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Terminal with starship: escape characters above prompt

Open diego-pm opened this issue 9 months ago • 2 comments

Type: Bug

I have configured starship on WSL, with bash. However, the prompt appears 2 times, and the first time it appears with escape characters:

\]project\[\] on \[\] master\[\] \[\][?]\[\] via \[\] v3.12.3 (venv) \[\]on \[\]  (eu-west-1) \[\];;71ad3c63-8c89-454e-8323-810a9b3e151e\]❯\[\] \[\];;71ad3c63-8c89-454e-8323-810a9b3e151e
project on  master [?] via  v3.12.3 (venv) on   (eu-west-1) 

I found that the issue does not appear if I disable the following setting: "terminal.integrated.shellIntegration.environmentReporting"

VS Code version: Code 1.98.0 (6609ac3d66f4eade5cf376d1cb76f13985724bcb, 2025-03-04T21:06:18.612Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 5.15.167.4-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 7 165U (14 x 2688)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.46GB (2.05GB free)
Process Argv --crash-reporter-id 74d13807-d8a0-4836-95d0-b6a8d2261209
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.15.167.4-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) Ultra 7 165U (14 x 0)
Memory (System) 7.49GB (5.79GB free)
VM 0%
Extensions (36)
Extension Author (truncated) Version
markdown-mermaid bie 1.27.0
ruff cha 2025.14.0
path-intellisense chr 2.10.0
copilot Git 1.277.0
copilot-chat Git 0.25.0
vscode-pull-request-github Git 0.106.0
rainbow-csv mec 3.17.0
git-graph mhu 1.30.0
debugpy ms- 2025.4.0
python ms- 2025.2.0
vscode-pylance ms- 2025.3.1
datawrangler ms- 1.20.1
jupyter ms- 2025.2.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.1.0
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
color-highlight nau 2.8.0
vscode-conventional-commits viv 1.26.0
better-comments aar 3.0.2
vscode-kmonad can 0.2.0
vscode-lark dir 0.1.0
dotenv mik 1.0.1
jupyter-keymap ms- 1.1.2
remote-containers ms- 0.401.0
remote-ssh ms- 0.118.0
remote-ssh-edit ms- 0.87.0
remote-wsl ms- 0.88.5
vscode-remote-extensionpack ms- 0.26.0
remote-explorer ms- 0.4.3
remote-server ms- 1.5.2
material-icon-theme PKi 5.20.0
rewrap stk 1.16.3
pdf tom 1.2.2
errorlens use 3.24.0
material-theme zhu 3.19.0

(1 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt551cf:31249601
vscod805cf:30301675
binariesv615:30325510
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
f8hc8238:30694864
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
968h8231:31253945
jda6j935:31233686

diego-pm avatar Mar 07 '25 11:03 diego-pm

@diego-pm did you explicitly set terminal.integrated.shellIntegration.environmentReporting when you saw this? It should be off in stable VS Code.

Tyriar avatar Mar 07 '25 15:03 Tyriar

@anthonykim1 we might be hitting an edge case specific to WSL where this check doesn't work since we check isWindows on the Linux side:

https://github.com/microsoft/vscode/blob/4a929292eef1717c181a0231e4f009f62639c8d9/src/vs/platform/terminal/node/terminalEnvironment.ts#L92-L95

Tyriar avatar Mar 07 '25 15:03 Tyriar

@diego-pm did you explicitly set terminal.integrated.shellIntegration.environmentReporting when you saw this? It should be off in stable VS Code.

I manually set terminal.integrated.shellIntegration.environmentReporting to true when I updated vs code to v1.98, but I did not have starship installed yet. Then, I installed and setup the starship prompt for bash, and saw the problem. I tried changing the settings related to integrated terminal to see if anything changed.

diego-pm avatar Mar 10 '25 08:03 diego-pm

I also saw this issue start last week with Insiders on WSL2, and did not have terminal.integrated.shellIntegration.environmentReporting in my settings at all. It must default to true, as I added it as false and the escape characters went away after restarting the shell.

bewing avatar Mar 10 '25 14:03 bewing

Fixed in https://github.com/microsoft/vscode/pull/243804

Tyriar avatar Mar 21 '25 13:03 Tyriar

@diego-pm could you just make sure you don't see the weird characters on your prompt? I've made some fixes #243804 which should address this issue. Thanks sm.

anthonykim1 avatar Mar 23 '25 23:03 anthonykim1

@diego-pm could you just make sure you don't see the weird characters on your prompt? I've made some fixes #243804 which should address this issue. Thanks sm.

I haven't received an update for vscode yet, so the problem still exists if I activate the option terminal.integrated.shellIntegration.environmentReporting. Should I install the insiders version?

diego-pm avatar Mar 24 '25 11:03 diego-pm

@diego-pm you will need to restart your terminal after setting terminal.integrated.shellIntegration.environmentReporting, the fix for when it's enabled is only on the Insiders version which is our nightly build.

Tyriar avatar Mar 24 '25 12:03 Tyriar

@diego-pm you will need to restart your terminal after setting terminal.integrated.shellIntegration.environmentReporting, the fix for when it's enabled is only on the Insiders version which is our nightly build.

I have checked with the insiders version and I no longer see the escape characters. Thanks!

diego-pm avatar Mar 24 '25 12:03 diego-pm