-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pythonREPLSmartSend does not fully close a code block with a dict or set at the end #22469
Comments
Update, this is a little more universal to code blocks with some object ending with
Also works with a set:
|
Seems like the same thing happens when a code block ends with a For example:
or
|
can you try trying this again? With the latest version of Python extension |
Seems to be working fine now. |
I am on a different machine these days, but latest version is acting a bit different even from this. File contents: class Something:
def method(self):
return {"something": "abc"}
print("hi") I place my cursor on $ .../.venv/bin/python
Python 3.13.0 (main, Oct 11 2024, 15:01:10) [Clang 16.0.0 (clang-1600.0.26.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>> class Something:
... def method(self):
... return {"something": "abc"}
... # Cursor is here This may be due to the changes in the Python 3.13 REPL, which will automatically indent on new lines in a block. If I re-send it, there are more spaces in the indent each time it is sent. If I >>>
KeyboardInterrupt
>>> class Something:
... def method(self):
... return {"something": "abc"}
... # Cursor is here Regenerating my new diagnostic data here: Output for
|
Extension Name | Extension Id | Version |
---|---|---|
:emojisense: | bierner.emojisense | 0.10.0 |
Angular Language Service | Angular.ng-template | 19.0.2 |
angular2-switcher | infinity1207.angular2-switcher | 0.4.0 |
Azure Repos | ms-vscode.azure-repos | 0.40.0 |
Black Formatter | ms-python.black-formatter | 2024.4.0 |
Debugger for Java | vscjava.vscode-java-debug | 0.58.1 |
Dependi | fill-labs.dependi | 0.7.13 |
Dev Containers | ms-vscode-remote.remote-containers | 0.388.0 |
Django | batisteo.vscode-django | 1.15.0 |
Docker | ms-azuretools.vscode-docker | 1.29.3 |
Dracula Theme Official | dracula-theme.theme-dracula | 2.25.1 |
EditorConfig for VS Code | EditorConfig.EditorConfig | 0.16.4 |
ESLint | dbaeumer.vscode-eslint | 3.0.10 |
Even Better TOML | tamasfe.even-better-toml | 0.19.2 |
Excel Viewer | GrapeCity.gc-excelviewer | 4.2.62 |
Extension Pack for Java | vscjava.vscode-java-pack | 0.29.0 |
Git Graph | mhutchie.git-graph | 1.30.0 |
GitHub Actions | github.vscode-github-actions | 0.27.0 |
GitHub Codespaces | GitHub.codespaces | 1.17.3 |
GitHub Copilot | GitHub.copilot | 1.245.0 |
GitHub Copilot Chat | GitHub.copilot-chat | 0.22.4 |
GitHub Issue Notebooks | ms-vscode.vscode-github-issue-notebooks | 0.0.130 |
GitHub Pull Requests | GitHub.vscode-pull-request-github | 0.100.3 |
GitHub Repositories | GitHub.remotehub | 0.64.0 |
GitHub Sharp Theme | joaomoreno.github-sharp-theme | 1.10.0 |
GitHub Theme | GitHub.github-vscode-theme | 6.3.5 |
GitLens — Git supercharged | eamodio.gitlens | 16.0.4 |
Google Java Format for VS Code | josevseb.google-java-format-for-vs-code | 1.1.2 |
Gradle for Java | vscjava.vscode-gradle | 3.16.4 |
HashiCorp Terraform | hashicorp.terraform | 2.34.0 |
IntelliCode | VisualStudioExptTeam.vscodeintellicode | 1.3.2 |
IntelliCode API Usage Examples | VisualStudioExptTeam.intellicode-api-usage-examples | 0.2.9 |
isort | ms-python.isort | 2023.10.1 |
Java | Oracle.oracle-java | 23.0.0 |
JavaScript Debugger | ms-vscode.js-debug | 1.95.3 |
JavaScript Debugger Companion Extension | ms-vscode.js-debug-companion | 1.1.3 |
Jekyll Problem Matchers | osteele.jekyll | 0.1.1 |
Jest Runner | firsttris.vscode-jest-runner | 0.4.74 |
Jupyter | ms-toolsai.jupyter | 2024.10.0 |
Jupyter Cell Tags | ms-toolsai.vscode-jupyter-cell-tags | 0.1.9 |
Jupyter Keymap | ms-toolsai.jupyter-keymap | 1.1.2 |
Jupyter Notebook Renderers | ms-toolsai.jupyter-renderers | 1.0.21 |
Jupyter Slide Show | ms-toolsai.vscode-jupyter-slideshow | 0.1.6 |
Kubernetes | ms-kubernetes-tools.vscode-kubernetes-tools | 1.3.18 |
Language Support for Java(TM) by Red Hat | redhat.java | 1.36.0 |
Live Server | ritwickdey.LiveServer | 5.7.9 |
Live Share | ms-vsliveshare.vsliveshare | 1.0.5941 |
Markdown All in One | yzhang.markdown-all-in-one | 3.6.2 |
Markdown Preview Github Styling | bierner.markdown-preview-github-styles | 2.1.0 |
Markdown Preview Mermaid Support | bierner.markdown-mermaid | 1.27.0 |
Material Theme — Free | Equinusocio.vsc-material-theme | 34.7.9 |
Material Theme Icons — Free | equinusocio.vsc-material-theme-icons | 3.8.10 |
Maven for Java | vscjava.vscode-maven | 0.44.0 |
Mypy Type Checker | ms-python.mypy-type-checker | 2024.0.0 |
npm Intellisense | christian-kohler.npm-intellisense | 1.4.5 |
Nx Console | nrwl.angular-console | 18.31.1 |
Postman | Postman.postman-for-vscode | 1.5.0 |
Prettier - Code formatter | esbenp.prettier-vscode | 11.0.0 |
Prettier SQL VSCode | inferrinizzard.prettier-sql-vscode | 1.6.0 |
Prettier TOML | bodil.prettier-toml | 0.1.0 |
Project Manager for Java | vscjava.vscode-java-dependency | 0.24.1 |
Protobuf support | peterj.proto | 0.0.4 |
Pylance | ms-python.vscode-pylance | 2024.11.3 |
Python | ms-python.python | 2024.20.0 |
Python Debugger | ms-python.debugpy | 2024.12.0 |
Rainglow | daylerees.rainglow | 1.5.2 |
Red Hat Commons | redhat.vscode-commons | 0.0.6 |
Remote Repositories | ms-vscode.remote-repositories | 0.42.0 |
Ruff | charliermarsh.ruff | 2024.56.0 |
rust | 1YiB.rust-bundle | 1.0.0 |
Rust Syntax | dustypomerleau.rust-syntax | 0.6.1 |
rust-analyzer | rust-lang.rust-analyzer | 0.3.2196 |
Spring Initializr Java Support | vscjava.vscode-spring-initializr | 0.11.2 |
SQLite | alexcvzz.vscode-sqlite | 0.14.1 |
Svelte for VS Code | svelte.svelte-vscode | 109.3.2 |
Table Visualizer for JavaScript Profiles | ms-vscode.vscode-js-profile-table | 1.0.10 |
Tailwind CSS IntelliSense | bradlc.vscode-tailwindcss | 0.12.15 |
Test Runner for Java | vscjava.vscode-java-test | 0.43.0 |
Tiltfile | tilt-dev.tiltfile | 0.0.4 |
vscode-just | nefrob.vscode-just-syntax | 0.6.0 |
vscode-reveal | evilz.vscode-reveal | 4.3.3 |
WSL | ms-vscode-remote.remote-wsl | 0.88.5 |
XML | redhat.vscode-xml | 0.27.2 |
YAML | redhat.vscode-yaml | 1.15.0 |
System Info
Item | Value |
---|---|
CPUs | Apple M3 Pro (12 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: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
Load (avg) | 2, 2, 2 |
Memory (System) | 18.00GB (0.09GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |
@martj42 Glad the issue is resolved! @GriceTurrble Thats a different issue - dup of #24422 |
It should be noted that the original issue here is still happening on my end, regardless of the KeyboardInterrupt exception. |
Good point @GriceTurrble |
Type: Bug
Opt into the Python experiment
pythonREPLSmartSend
.Define a small class with one method that returns a dict:
Place the cursor at the end of the first line,
class Something:
Press
Shift-Enter
The result sent to the REPL is the full definition, but it is missing the last trailing newline:
This means chaining the next line of code can result in an indentation error, because the REPL has not fully closed this multiline entry:
Notably, I've reproduced this when the
return
statement returns a dict. The issue is not reproduced in the case ofreturn "abc"
orreturn 123
.Multiline dicts also cause the issue:
Parentheses used for multiine strings do not:
VS Code version: Code 1.84.0 (Universal) (d037ac076cee195194f93ce6fe2bdfe2969cc82d, 2023-11-01T11:30:19.406Z)
OS version: Darwin arm64 22.1.0
Modes:
System Info
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Extensions (53)
(5 theme extensions excluded)
The text was updated successfully, but these errors were encountered: