Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

Fixes #issue_number

Description

Current line highlight disappears when text is selected. This adds editor.cursorSurroundingLinesHighlightOnSelection (default: false) to control this behavior.

Changes:

  • Added boolean option to IEditorOptions with default false for backward compatibility
  • Modified AbstractLineHighlightOverlay._shouldRenderInContent() to render when selection exists if option enabled
  • Updated enum values in EditorOption, monaco.d.ts, and standaloneEnums.ts
  • Added test coverage for option toggle behavior

Implementation:

protected _shouldRenderInContent(): boolean {
    return (
        (this._renderLineHighlight === 'line' || this._renderLineHighlight === 'all')
        && (this._selectionIsEmpty || this._cursorSurroundingLinesHighlightOnSelection)
        && (!this._renderLineHighlightOnlyWhenFocus || this._focused)
    );
}

Users can enable via Settings UI or:

{
  "editor.cursorSurroundingLinesHighlightOnSelection": true
}
Original prompt

This section details on the original issue you should resolve

<issue_title>BUG: No highlight of current line if selected any word in this line</issue_title>
<issue_description>

Does this issue occur when all extensions are disabled?: Yes

Version: 1.101.1 (user setup)
Commit: 18e3a1e

Type: Bug

STR with screenshots:

  1. We can see current line highlight

зображення

  1. Select word test and highlight of current line disappears (only words are highlighted):

зображення

Comments on the Issue (you are @copilot in this section)

@alexdima The current implementation hides the current line highlight when there is a selection (this behavior is consistent to other editors). PR welcome if you would like to add a setting to tweak that. @alexdima Sure, here is for example Sublime Text:

https://github.com/user-attachments/assets/c99c3a8b-f715-44cd-996c-2f9880d149bb</comment_new>
<comment_new>@alexdima
@psnet Would you like to contribute a PR? I am open to having an option to control this.</comment_new>
<comment_new>@alexdima
Let's see if Copilot can do it :) </comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix highlight of current line when selecting words Add setting to preserve current line highlight during text selection Nov 21, 2025
Copilot AI requested a review from alexdima November 21, 2025 23:41
Copilot finished work on behalf of alexdima November 21, 2025 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: No highlight of current line if selected any word in this line

2 participants