Skip to content

Typing over a highlighted word causes the new text to stay highlighted #236611

Closed
@johnmbarrett

Description

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Apologies if this has been reported before, but I searched Google, this GitHub, and the main VS Code GitHub, and couldn't find this exact issue. In every text editor I have ever used, selecting text and then deleting or typing over it removes the highlighting, so that the new text is not highlighted. In the VS Code Jupyter notebook editor, the highlight persists on the new text for as long as you keep typing, until you get rid of it by selecting something else with the mouse or arrow keys.

Steps to reproduce

  1. Create a new Jupyter notebook
  2. Add a Python cell
  3. In the cell, type print('hello')
  4. Select the text hello using the mouse or keyboard
    4a. (Optional) Press any of Delete, Backspace, or Ctrl+X
  5. Type goodbye

Expected behaviour

The new text goodbye is not highlighted

Actual behaviour

The new text goodbye is highlighted

Additional info

This appears to be a relatively recent bug, as it only started happening a few days ago when I updated VS Code. It also appears to be specific to notebooks, as the editor for regular text files (e.g. .py files) does not suffer from the same issue.

As the various options in step 4 imply, this issue is not specific to any one way of highlighting or replacing the highlighted text. As far as I can tell, any time you replace highlighted text with completely new text it stays highlighted (I just tried pasting over the highlighted text and it happened then as well).

So far I have not found any workarounds, and it persists until you change the selection manually (i.e. press an arrow key, Esc out of the cell, or click on some other text).

VS Code Version

Version: 1.96.0 (user setup) Commit: 138f619 Date: 2024-12-11T02:29:09.626Z Electron: 32.2.6 ElectronBuildId: 10629634 Chromium: 128.0.6613.186 Node.js: 20.18.1 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.19045

Jupyter Extension Version

2024.11.0

Jupyter logs

Coding Language and Runtime Version

Python v3.10.0

Language Extension Version (if applicable)

2024.22.0

Anaconda Version (if applicable)

conda 24.5.0

Running Jupyter locally or remotely?

None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugeditor-highlightEditor selection/word highlight issuesinsiders-releasedPatch has been released in VS Code Insidersnotebook-cell-editorBugs related to code editors in Notebooks (not intellisense / LS's)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions