Skip to content
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

edit mode code highlighting fixed to not override cursor selection #4517

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

panyamkeerthana
Copy link

@panyamkeerthana panyamkeerthana commented Mar 6, 2025

Description

When switching to the edit mode and we make a selection of code, it needs to appear above the highlighting not be obscured by it. In this fix, instead of using an opaque background colour for the highlighting decoration, we use a highlighting with opacity so that the selected code is visible below it

Screenshots

Screenshot 2025-03-05 at 3 46 25 PM Screenshot 2025-03-05 at 3 31 22 PM Screenshot 2025-03-05 at 3 48 26 PM Screenshot 2025-03-05 at 3 50 01 PM

Link: Granite-Code/granite-code#47

Copy link

netlify bot commented Mar 6, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit dc33d50
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/67ca04457abba400083dbb4d

Copy link
Contributor

@owtaylor owtaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a workable fix to me, as long as the change in appearance is considered OK. (IMO, it's an improvement.)

@@ -6,7 +6,7 @@ class EditDecorationManager {
constructor(context: vscode.ExtensionContext) {
this.decorationType = vscode.window.createTextEditorDecorationType({
backgroundColor: new vscode.ThemeColor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd include a comment here explaining why the new color is a good choice, something like:

// editor.selectionHighlightBackground is documented as always needing to be
// partially transparent. This property is useful when we repurpose it here,
// because it means it won't entirely obscure the selection

When switching to the edit mode and we make a selection of code, it
needs to appear above the highlighting not be obscured by it. In this
fix, instead of using an opaque background colour for the highlighting
decoration, we use a highlighting with opacity so that the selected
code is visible below it
@panyamkeerthana panyamkeerthana force-pushed the panyamkeerthana/edit-highlight-fix branch from 22a6454 to dc33d50 Compare March 6, 2025 20:23
@owtaylor
Copy link
Contributor

owtaylor commented Mar 7, 2025

Looks good to me now.

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.

2 participants