Skip to content

The "smart" value for editor.AcceptSuggestionOnEnter should invoke auto-import actions always #257335

@macintacos

Description

@macintacos

Type: Bug

Hitting "enter" on an auto-import suggestion when you have editor.AcceptSuggestionOnEnter set to "smart" should accept the suggestion even when the literal value you've provided matches the text in the selection list. Let me explain a bit more.

Take the following scenario: I'm writing some Python, and I want to use the os package. This package is not imported yet. I type os, and the os import suggestion pops up at the top. Great!

Image

However, if I hit "Enter", it doesn't actually add the import line, but instead enters a newline. I'm just guessing here, but I'm assuming that this is happening because the conditions for the "smart" value of editor.AcceptSuggestionOnEnter have been met (I typed "os", the selection item is "os", and thus there would be no change to the text the user has entered), and thus it should enter a newline.

This "feels" wrong to me in practice, especially when you become reliant on using intellisense to auto-import packages for you. This probably dominantly happens on packages with short names that are easy to type (like os in Python, or fmt in Go for example), but in practice it means that I find myself having to go and manually add the import lines myself, which is the opposite of what I want most of the time.

Notably (and the reason why I'm filing this is a Bug and not a Feature Request), I discovered that this is not what happens when you type out a snippet and accept it even when the text in the selection list matches what you've entered. For example, if I type out ifmain and select the snippet and hit "Enter", it works:

CleanShot.2025-07-22.at.18.59.57.mp4

I'm assuming that's because it's making a "textual change", as suggested in the documentation for the option:

Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change

I would argue that the act of accepting the auto-import suggestion does make a textual change (it does add an import line, after all), and thus should be actually "accepted" on pressing "enter", just like snippets.

VS Code version: Code 1.102.1 (7adae6a, 2025-07-15T16:41:17.147Z)
OS version: Darwin arm64 24.5.0
Modes:

System Info
Item Value
CPUs Apple M4 Pro (14 x 2400)
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: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 7, 7, 7
Memory (System) 48.00GB (0.17GB free)
Process Argv --crash-reporter-id 72853ff1-037c-43d9-8e4b-573b76acac83
Screen Reader no
VM 0%
Extensions (229)
Extension Author (truncated) Version
better-comments aar 3.0.2
scss-lint ada 0.1.11
spaces-inside-braces Air 0.4.0
vscode-javascript-snippet-pack aka 0.1.6
TabOut alb 0.2.2
Bookmarks ale 13.5.0
project-manager ale 12.8.0
tsl-problem-matcher amo 0.6.2
file-nesting ant 2.0.0
smart-clicks ant 0.2.1
smarty-template-support asw 2.1.1
better-folding-plus Atr 0.6.1
tailwind-docs aus 2.1.0
expect bda 1.0.1
vscode-custom-css be5 7.4.6
search-crates-io bel 1.2.1
color-info bie 0.7.2
github-markdown-preview bie 0.3.0
markdown-checkbox bie 0.4.0
markdown-emoji bie 0.3.1
markdown-footnotes bie 0.1.1
markdown-mermaid bie 1.28.0
markdown-preview-github-styles bie 2.2.0
markdown-yaml-preamble bie 0.1.0
yamlfmt blu 0.1.6
vscode-fish bma 1.0.39
file-browser bod 0.2.11
htmltagwrap bra 1.0.0
insert-unicode bru 0.15.1
language-hugo-vscode bud 1.3.1
vscode-buf buf 0.7.2
multi-cursor-case-preserve Car 1.0.5
gotemplate cas 0.6.1
lazygit Cha 1.0.7
ruff cha 2025.24.0
vscode-better-align cho 1.4.2
npm-intellisense chr 1.4.5
path-intellisense chr 2.10.0
keymapceditor-vsc Cia 0.7.7
gitignore cod 0.10.0
disableligatures Coe 0.0.10
esbuild-problem-matchers con 0.0.3
jsdoc-generator cry 2.3.3
postcss css 1.0.9
python-snippets cst 0.1.2
flash-vscode cun 0.0.9
jsonnet-lsp cve 0.2.10
transformer dak 1.12.1
vscode-markdownlint Dav 0.60.0
vscode-eslint dba 3.0.10
vscode-dash dee 2.4.0
vscode-faker dee 2.0.0
ginkgo-tools dli 0.1.0
binary-plist dni 0.11.4
docker doc 0.13.0
xml Dot 2.5.1
apc-extension drc 0.4.1
gitlens eam 17.3.2
vscode-html-css ecm 2.0.13
EditorConfig Edi 0.17.4
LogFileHighlighter emi 3.4.3
json-tools eri 1.0.2
prettier-vscode esb 11.0.0
indent-rainbow-palettes evo 0.0.20
buffers exc 1.0.0
hadolint exi 1.1.2
copy-relative-path-and-line-numbers ezf 0.3.1
vscode-diff fab 2.1.2
vscode-git-history fab 3.1.0
vscode-open-in-github fab 2.3.1
vscode-firefox-debug fir 2.15.0
code-runner for 0.12.2
sort-json-array fvc 4.1.0
lintlens ghm 7.5.0
vscode-sublime-merge gio 1.4.1
copilot Git 1.346.0
copilot-chat Git 0.29.1
vscode-pull-request-github Git 0.114.3
go gol 0.48.0
vscode-jsonnet Gra 0.7.2
gc-excelviewer Gra 4.2.63
vscode-graphql-syntax Gra 1.3.8
terraform has 2.34.5
vscode-test-explorer hbe 2.22.1
npm-dependency-links her 1.3.0
headwind hey 1.7.0
golang-snippets hon 1.2.0
vscode-settings-cycler hoo 1.0.1
output-colorizer IBM 0.1.2
path-autocomplete ion 1.25.0
vscode-env Iro 0.1.0
fuzzy-search jac 0.0.3
RelativePath jak 1.5.0
vscode-edit-csv jan 0.11.5
batch-rename-extension Jan 0.0.6
vscode-codeowners jas 1.1.1
better-dockerfile-syntax jef 1.0.2
vscode-todo-highlight jgc 2.0.8
stylua Joh 1.7.1
chezmoi-tools jor 0.1.1
ginkgotestexplorer jos 1.0.2
periscope Jos 1.12.0
nvim-ui-modifier Jul 0.1.5
vscode-json-editor jy- 0.2.4
kdl kdl 2.1.3
auto-comment-blocks kev 1.0.1
TypeScriptImport kev 1.17.0
vsc-python-indent Kev 1.21.0
json2csv kha 1.0.0
vscode-gutter-preview kis 0.32.2
vscode-format-context-menu lac 1.0.4
node-module-intellisense lei 1.5.0
expand-region let 0.1.4
vscode-python-test-adapter lit 0.8.2
lldb-dap llv 0.2.15
bash-ide-vscode mad 1.43.0
Lisp mat 0.1.12
markdown-shortcuts mdi 0.12.0
rainbow-csv mec 3.20.0
shfmt mkh 1.3.1
vscode-mojo mod 25.4.0
mongodb-vscode mon 1.13.3
compare-folders mos 0.25.1
vscode-less mrm 0.6.3
vscode-scss mrm 0.10.0
vscode-containers ms- 2.1.0
vscode-kubernetes-tools ms- 1.3.25
debugpy ms- 2025.11.2025072201
mypy-type-checker ms- 2025.3.11821011
python ms- 2025.10.1
vscode-pylance ms- 2025.6.106
vscode-python-envs ms- 1.1.12031009
jupyter ms- 2025.6.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
remote-containers ms- 0.422.1
cpptools-extension-pack ms- 1.3.1
extension-test-runner ms- 0.0.12
hexeditor ms- 1.11.1
live-server ms- 0.4.15
makefile-tools ms- 0.12.17
test-adapter-converter ms- 0.2.1
vscode-paste-image mus 1.0.4
color-highlight nau 2.8.0
vscode-just-syntax nef 0.8.0
pytest-fixtures nic 0.3.3
vscode-groovy-lint Nic 3.3.1
nimvscode nim 0.1.26
autodocstring njp 0.6.1
indent-rainbow ode 8.3.1
vscode-nunjucks-formatter oki 0.1.3
fix-json oli 0.1.2
leaper Onl 0.10.5
vscode-yaml-sort Pas 6.6.2
explorer-exclude Pet 1.3.2
markdown-checkbox PKi 1.10.0
material-icon-theme PKi 5.24.0
material-product-icons PKi 1.7.1
vscode-css-peek pra 4.4.3
fold-on-open pra 1.1.0
vscode-css-navigation puc 2.3.10
text-power-tools qcz 1.51.0
vscode-commons red 0.0.6
vscode-xml red 0.29.0
vscode-yaml red 1.18.0
shellman Rem 5.7.0
vscode-sort-json ric 1.20.0
vscode-fix-checksums-next Rim 1.4.0
python-docstring-highlighter rod 0.2.4
bash-debug rog 0.3.9
nunjucks ron 0.3.1
rust-analyzer rus 0.3.2547
codeui rya 1.1.0
partial-diff ryu 1.4.3
multi-command ryu 1.6.0
jinjahtml sam 0.20.0
vscode-open san 0.3.0
vscode-javascript-booster sbu 14.0.1
vscode-brewfile sha 1.0.0
trailing-spaces sha 0.4.1
markdown-preview-enhanced shd 0.8.18
ruby-lsp Sho 0.9.30
vscode-fileutils sle 3.10.3
zmk-tools spa 1.5.0
rewrap stk 1.16.3
code-spell-checker str 4.0.47
vscode-stylelint sty 1.5.3
markdowntable Tak 0.13.0
even-better-toml tam 0.21.2
hide-error-cases taq 1.0.8
vscode-markdown-paste-image tel 1.4.3
tfsec tfs 1.11.0
tiltfile til 0.0.4
shellcheck tim 0.38.1
graphviz-interactive-preview tin 0.3.5
lazygit-vscode Tom 0.1.17
vscode-pets ton 1.32.0
go-to-method tri 0.2.0
simple-rst tro 1.5.4
pypi-assistant twi 2.3.0
cmake twx 0.0.17
sort-lines Tyr 1.12.0
vscode-mdx uni 1.8.15
commands use 1.16.0
errorlens use 3.26.0
vscode-lldb vad 1.11.5
vscode-ltex val 13.1.0
intellicode-api-usage-examples Vis 0.2.9
vscodeintellicode Vis 1.3.2
vscode-conventional-commits viv 1.26.0
vscode-icons vsc 12.13.0
vim vsc 1.30.1
gistfs vsl 0.9.5
vspacecode VSp 0.10.20
whichkey VSp 0.11.4
change-case wma 1.0.0
bracket-lens wra 1.5.3
viml Xad 2.2.0
txt-syntax xsh 0.2.4
automatic-comment-blocks yco 1.1.10
pretty-ts-errors Yoa 0.6.1
emmet-live yse 1.0.0
markdown-all-in-one yzh 3.6.3
grove Zac 0.0.7
vscode-open-in-github ziy 1.3.6
explicit-folding zok 0.24.2
vscode-proto3 zxh 0.5.5

(9 theme extensions excluded)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions