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

Add an editor context menu to apply style to a word/selection #45

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elazarcoh
Copy link
Collaborator

@elazarcoh elazarcoh commented Jan 12, 2022

This PR adds an editor context menu entry for this extension.
It gave you the ability to quickly add/clear style to the selected word(s).
There're up to 10 different styles to choose from. To not make the menu too cluttered, the styles needs to be enabled from the settings. By default, only 3 styles will be enabled.

Due to VSCode limitations, there are some stuff that I would like to have, but they're impossible as far as I know.

  • Since the menus are static, users can't give custom name the styles in the menu. So, currently I called them: Style 3, etc.
    • I can "hack" my way to get this behavior, but it requires VSCode to be restarted after the rename of a style.
  • VSCode menu does not allow any kind of stylization, not even adding an icon. So, the user can't tell how the style looks like without applying it.
    • We might be able to add a TreeView, which will present all available styles, but it might be an overkill.

It's mostly implemented. I need help setting up the default styles. See comment below.

fixes #44

image

Comment on lines +396 to +447
"default": [
{
"id": 1,
"enabled": true,
"backgroundColor": "#ffeb3b"
},
{
"id": 2,
"enabled": true,
"backgroundColor": "#2196f3"
},
{
"id": 3,
"enabled": true,
"backgroundColor": "#ff9800"
},
{
"id": 4,
"enabled": false,
"backgroundColor": "#9c27b0"
},
{
"id": 5,
"enabled": false,
"backgroundColor": "#2e7d32"
},
{
"id": 6,
"enabled": false,
"backgroundColor": "#ff5722"
},
{
"id": 7,
"enabled": false,
"backgroundColor": "#607d8b"
},
{
"id": 8,
"enabled": false,
"backgroundColor": "#795548"
},
{
"id": 9,
"enabled": false,
"backgroundColor": "#ffeb3b"
},
{
"id": 10,
"enabled": false,
"backgroundColor": "#2196f3"
}
]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need to edit the default styles.
(I didn't write those, I let copilot generate them for me)

@elazarcoh elazarcoh mentioned this pull request Jan 16, 2022
3 tasks
@jgclark jgclark added the enhancement New feature or request label Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quick way to create highlights from editor selection
2 participants