vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Terminal suggestions break after tabbing for suggestions

Open Wim-De-Clercq opened this issue 2 weeks ago โ€ข 4 comments

Type: Bug

The terminal suggestions become bad after <TAB>'ing for suggestions.

(example with git but any command will do, even cd): Expected:

  1. Type git , <ctrl-space> -- popup opens with proper suggestions.

Reproduce

  1. Type git <TABx2> -- system shell will display suggestions.
  2. (Shell continues with git ). Press <ctrl-space> for vscode suggestions

Result: Suggestions are wrong and stay wrong (if you were to press again) until a whole new command is started by pressing ctrl-c or enter


until a whole new command is started by pressing ctrl-c or enter

By this I mean, you could git <TABx2>, delete the whole line with backspace, start typing cd and suggestions will still be broken. You must CTRL-C to get a working one again.

https://github.com/user-attachments/assets/9ca26d6f-d6f0-4ea1-9521-1717b4368d6d

VS Code version: Code 1.106.3 (bf9252a2fb45be6893dd8870c0bf37e2e1766d61, 2025-11-25T22:28:18.024Z) OS version: Linux x64 6.8.0-88-generic Modes:

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 x 1806)
GPU Status 2d_canvas: enabled
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 15.34GB (5.53GB free)
Process Argv --crash-reporter-id 244fe0bb-843f-4f1b-be62-d635686bff96
Screen Reader no
VM 0%
DESKTOP_SESSION xfce
XDG_CURRENT_DESKTOP XFCE
XDG_SESSION_DESKTOP xfce
XDG_SESSION_TYPE x11
Extensions disabled
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
aj953862:31281341
nes-set-on:31351930
6abeh943:31336334
cloudbuttont:31379625
todos-1:31405332
3efgi100_wstrepl:31403338
trigger-command-fix:31379601
auto_model_enabled:31396818
use-responses-api:31390855
ddidt:31399633
je187915:31401257
3i15c187:31428712
ec5jj548:31422691
terminalsuggestenabled:31431119
cp_cls_c_966_ss:31426491
chatvisible:31426294
expandedtokens:31427242
c0683394:31419495
478ah919:31426797
ge8j1254_inline_auto_hint_haiku:31431912
fa76a614:31426880
5j92g670_sonnet:31426790
cp_jb_t_lixleitest:31428973
h0hdh950:31428394

Wim-De-Clercq avatar Dec 10 '25 14:12 Wim-De-Clercq

Thanks for the issue. Could you please provide your shell startup config so I can repro? Looks like your prompt is multi-line.

meganrogge avatar Dec 10 '25 14:12 meganrogge

The resulting PS1 is this

$ echo "$PS1"
\n\e[34m\t\e[0m \e[95m$(virtualenv_info)\e[0m\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$  \e[91m$(parse_git_branch)\e[0m\n$ 

The actual config of it is in multiple steps. I'll try scrabble them together from bashrc

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi  

case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

function virtualenv_info(){
    # Get Virtual Env
    if [[ -n "$VIRTUAL_ENV" ]]; then
        # Strip out the path and just leave the env name
        venv="${VIRTUAL_ENV##*/}"
    else
        # In case you don't have one activated
        venv=''
    fi
    [[ -n "$venv" ]] && echo "($venv) "
}
# disable the default virtualenv prompt change
export VIRTUAL_ENV_DISABLE_PROMPT=1

blue="\e[34m"
light_pink="\e[95m"
light_red="\e[91m"
end_color="\e[0m"

time="${blue}\t${end_color}"
venv="${light_pink}\$(virtualenv_info)${end_color}"
git_branch="${light_red}\$(parse_git_branch)${end_color}"

export PS1="\n${time} ${venv}${PS1} ${git_branch}\n$ "

Wim-De-Clercq avatar Dec 10 '25 14:12 Wim-De-Clercq

Thanks for all the info. Still not reproducing ๐Ÿซ  ...

https://github.com/user-attachments/assets/de566731-9819-4b8e-9045-828272383cb9

meganrogge avatar Dec 10 '25 16:12 meganrogge

What would help a lot is knowing the state of the prompt input model when you see this. Could you please use ctrlCmd+/ to show this info when the bug surfaces?

Image

meganrogge avatar Dec 10 '25 16:12 meganrogge

Thanks for all the info. Still not reproducing ๐Ÿซ  ... demo.mov

In your video, you don't seem to be <TAB>'ing without the popup open, you must get the default terminal's suggestions first. For me, with default settings as far as I know, the popup suggestions don't appear after the space of cd

So to reproduce you should type cd (you get a popup here, close it with ESC), then tab twice for default terminal suggestions. And then press CTRL-Space to open the vscode suggestions again.

Wim-De-Clercq avatar Dec 11 '25 08:12 Wim-De-Clercq

I'll post my settings here, but I don't think it would contain something relevant, there are zero terminal.suggest.* entries in it.

vscode settings ``` { "workbench.colorTheme": "Ra Calm", "python.analysis.typeCheckingMode": "standard", "editor.minimap.enabled": false, "workbench.editor.empty.hint": "hidden", "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, "search.exclude": { "*frontend*": true }, "search.defaultViewMode": "tree", "editor.formatOnSave": true, "python.analysis.packageIndexDepths": [ { "name": "", "depth": 5, "includeAllSymbols": true } ], "workbench.startupEditor": "none", "outline.problems.colors": false, "files.autoSave": "onFocusChange", "editor.rulers": [ { "column": 80, "color": "#4b4b4b" }, { "column": 88, "color": "#763f3f" } ], "files.enableTrash": false, "files.insertFinalNewline": true, "search.useIgnoreFiles": false, "python.analysis.autoImportCompletions": true, "isort.args": [ "--profile", "pycharm", "-sl", "--case-sensitive", "--dont-order-by-type", "--thirdparty=alembic", "--project=tests" ], "isort.check": true, "python.testing.pytestArgs": ["-s", "-vv"], "workbench.tree.indent": 16, "workbench.tree.renderIndentGuides": "always", "editor.inlineSuggest.syntaxHighlightingEnabled": false, "workbench.colorCustomizations": { "editor.selectionBackground": "#7708e6", "sideBar.foreground": "#ffffff", "list.activeSelectionForeground": "#bfffbf", "list.inactiveSelectionForeground": "#ff9e3d", "list.hoverForeground": "#ff9e3d", "list.focusForeground": "#ff9e3d", "gitDecoration.ignoredResourceForeground": "#0084ffc7", "editorGhostText.foreground": "#ff9100", "editor.findMatchHighlightBackground": "#67a9ff", "editor.findMatchHighlightForeground": "#000000", "editor.findMatchBackground": "#47c037", "editor.findMatchForeground": "#000000", "editor.wordHighlightBorder": "#008d9599", "editor.wordHighlightBackground": "#00000000", "editor.wordHighlightStrongBackground": "#001aff81", "editor.stackFrameHighlightBackground": "#00971cb0", "editor.focusedStackFrameHighlightBackground": "#00971cb0" }, "files.exclude": { "**/__pycache__": true }, "editor.inlayHints.enabled": "off", "python.analysis.disableTaggedHints": true, "python.analysis.logLevel": "Warning", "python.analysis.userFileIndexingLimit": 5000, "git.suggestSmartCommit": false, "editor.hover.enabled": false, "debug.toolBarLocation": "docked", "scm.diffDecorationsGutterWidth": 5, "workbench.iconTheme": "vscode-icons", "workbench.productIconTheme": "a-file-icon-vscode-product-icon-theme", "debug.allowBreakpointsEverywhere": true, "debug.console.closeOnEnd": true, "debug.internalConsoleOptions": "neverOpen", "window.title": "${rootNameShort}", "problems.decorations.enabled": false, "editor.smartSelect.selectSubwords": false, "python.analysis.extraPaths": ["./backend"], "redhat.telemetry.enabled": false, "workbench.activityBar.location": "top", "explorer.excludeGitIgnore": false, "editor.defaultFormatter": "esbenp.prettier-vscode", "launch": { "version": "0.2.0", "configurations": [ { "name": "๐Ÿš€ Server", "type": "debugpy", "request": "launch", "module": "pyramid.scripts.pserve", "args": ["${workspaceFolder}/development.ini"], "justMyCode": false, "pyramid": true, "jinja": true, "presentation": { "order": 1 } }, { "type": "debugpy", "name": "๐Ÿงช All tests", "request": "launch", "cwd": "", "justMyCode": false, "console": "integratedTerminal", "presentation": { "order": 2 }, "args": [ // "--randomly-seed", // "3d3474183655" ], "module": "pytest" }, { "name": "๐Ÿ› Debug current file", "type": "debugpy", "request": "launch", "program": "${file}", "justMyCode": false, "console": "integratedTerminal", "presentation": { "order": 3 } }, { "name": "Default python debug test config", "type": "debugpy", "request": "launch", "program": "${file}", "purpose": ["debug-test", "debug-in-terminal"], "justMyCode": false, "console": "integratedTerminal" } ], "compounds": [] }, "[python]": { "editor.formatOnSave": true, "editor.defaultFormatter": "charliermarsh.ruff", "editor.codeActionsOnSave": { "source.fixAll": "explicit", "source.organizeImports": "explicit" }, "ruff.organizeImports": false }, "[yaml]": { "editor.defaultFormatter": null, "editor.formatOnSave": false }, "prettier.resolveGlobalModules": true, "prettier.documentSelectors": ["*.jinja2"], "prettier.configPath": "/home/wim/.prettierrc", "files.associations": { "*.jinja2": "jinja-html" }, "editor.autoIndentOnPaste": true, "debug.gutterMiddleClickAction": "conditionalBreakpoint", "debug.inlineValues": "off", "debug.openExplorerOnEnd": true, "debug.showVariableTypes": true, "debug.openDebug": "openOnSessionStart", "editor.fontFamily": "'JetBrains Mono', 'Droid Sans Mono', 'monospace'", "editor.allowVariableFonts": false, "yaml.format.enable": false, // "terminal.integrated.persistentSessionScrollback": 10000, // "terminal.integrated.scrollback": 10000, "testing.resultsView.layout": "treeLeft", "debugpy.debugJustMyCode": false, "ruff.logLevel": "info", "diffEditor.renderSideBySide": false, "diffEditor.experimental.showMoves": true, "workbench.editor.enablePreview": false, "git.closeDiffOnOperation": true, // "terminal.integrated.tabs.enableAnimation": false, // "terminal.integrated.tabs.hideCondition": "never", "diffEditor.hideUnchangedRegions.enabled": true } ```

Wim-De-Clercq avatar Dec 11 '25 08:12 Wim-De-Clercq

And, lastly, to answer your information request. Before the bad state it's this:

Image

After the system suggestions:

Image

It appears it does not realise a new command has started (because I didn't press [ENTER] yet I suppose), and all of the previous 4 lines are given as input for the suggestions.

Wim-De-Clercq avatar Dec 11 '25 08:12 Wim-De-Clercq

I can actually also trigger it by clearing my terminal input with CTRL-L, however since I can't find this shortcut in vscode this may be an OS thing and not reproducable on Mac.

But it made me wonder about vscode's clear command in the right click menu of the terminal. And that has similarly weird behaviour. Let's say I have a new terminal, I type (and execute) ls. Then I right-click and choose clear. I type cd and the suggestions are not good.

This could perhaps be a different cause than the above though. The promptInputModel in this case is just plain empty.

So in general it appears there are various ways where vscode can loose track of what the actual user input truly is.

Wim-De-Clercq avatar Dec 11 '25 10:12 Wim-De-Clercq

I was able to resolve this by setting Terminal > Integrated > Suggest: Section Mode to never

Image

even better was actually to just disable integrated shell

Image

louisbuchbinder avatar Dec 13 '25 00:12 louisbuchbinder

Adding some more fail cases I'm experiencing with this feature turned on:

Case 1:

  1. Type part of the path and hit TAB (it gets autocompleted) (example: ./co -> ./components/
  2. Repeatedly hit TAB -> sometimes path is being written twice, sometimes part of it gets written multiple times like this: ./components/./components or ./co./co./com./c./components/. Sometimes it happens just when trying to normally use it, without abusing TAB)

Case 2:

  1. Folder structure is:
- components
  - __test
    - temp-diff
      - info.png
    - index.spec.ts
  1. I typed this and hit TAB:
Image
  • why the index.spec.ts is not suggested? after hitting TAB again I'd expect the ./components/__test/i to become ./components/__test/index.spec.ts but it becomes ./components/__test/temp-diff/, like.. seriosly what?! ๐Ÿคฃ

Workaround Thankfully this "feature" can be turned off using terminal.integrated.suggest.enabled config option, the terminal is unusable for me with this on ๐Ÿ˜…


My setup: Version: 1.106.3 (user setup) Commit: https://github.com/microsoft/vscode/commit/bf9252a2fb45be6893dd8870c0bf37e2e1766d61 Date: 2025-11-25T22:28:18.024Z Electron: 37.7.0 ElectronBuildId: 12781156 Chromium: 138.0.7204.251 Node.js: 22.20.0 V8: 13.8.258.32-electron.0 OS: Windows_NT x64 10.0.26100 Using git-bash as terminal

aczekajski avatar Dec 13 '25 08:12 aczekajski