-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Implement separate colors for primary and secondary cursors when multiple cursors are present #181991
Conversation
…re present - Does not change the existing behavior when there's a single cursor. editorCursor.foreground and background are still used. - Add editorCursor.multiple.primary.foreground and background theme colors for the primary cursor. Only used when multiple cursors exist. Fallback to editorCursor.foreground/background when theme colors aren't set. - Add editorCursor.multiple.secondary.foreground and `background theme colors for non-primary cursors. Only used when multiple cursors exist. Fallback to editorCursor.foreground/background when theme colors aren't set. Add cursor-primary and cursor-secondary html classes to target with cursor color styles. No new class is introduced in the single-cursor case. - Currently does not affect overview ruler colors. editorCursor.foreground is still used, even when multiple cursors are present.
- This maintains the existing handling for colors being undefined. However, each of these colors have defaults do I'm not sure if it's actually possible for them to be undefined
@microsoft-github-policy-service agree |
If you have personal typescript settings those will get used. The expected settings for this repo aren't set in the workspace settings. I have to either temporarily disable my settings when working on vscode or locally modify the workspace settings to set them back to defaults.
Yup, went away the second time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Closes #85630
I took a stab at implementing a separate color for the primary cursor when multiple cursors exist. First time touching CSS so if there's a more appropriate way to theme secondary cursors let me know.
I chose to add new colors for "primary" and "secondary" cursors. These are only used when there is more than one cursor. They use the same defaults as the existing cursor color. Currently these colors do not fall back to the existing color in the case that they are undefined. There are default values in the call to
registerColor
so I'm unsure if this is a case that actually needs to be handled. I haven't been able to find a way to cause the colors to be undefined, even by creating a completely empty theme.The reason I chose to add 2 new colors instead of just a single "secondary" color is for flexibility. This way it's possible to highlight the primary cursor in a bright color but only when there are multiple cursors.
The overview ruler has been updated to use these colors as well. Confirmed this updates when using
editor.action.focusNextCursor
.I tried to keep everything backwards compatible. This shouldn't affect existing themes. However, this changes the HTML class when there are multiple cursors from
cursor
to eithercursor-primary
orcursor-secondary
. This will break any monkey patching that targets the cursor class, but I assume that's acceptable.