How to add background highlighting for comments.
-
In one of my custom syntax highlighter files for a specific language, I saw that it is highlighting the background of comments as gray.
So, I thought maybe this can be done by some way by interacting with the Scintilla API through external code for comments in any language.
So basically, if n++ thinks its a comment, not only is its text highlighted but also its background is highlighted as well.
Does anyone know if this can be done and how?
-
I get, that you do not want to change the comment style using the style configuration dialog, right?
Via external code, it isn’t easy as well as the comment style isn’t the same always.
For example, in python the comment style id is 1, in perl 2 and in php 124.
In addition, there might be more than one style id defined for comments.
And last but not least, if have read the stylers/themes.xml and you know all comment style ids,
you start fighting with the internal lexer about who sets the background color.All in all, this doesn’t sound practical.
-
what you MAYBE could do is
- get the bufferactivated notification
- check which lexer is set
- read from xml which comment styleid(s) are used
- reset the background color for this styleid
but I ASSUME that this needs to be done always, meaning on each
bufferactivated notification. -
This post is deleted! -
Hello, @SalviaSage
Follow these steps to add background highlighting for comments.
step 1:- Select the comment line/word to highlight.
step 2:- Go to Search Menu
step 3:- Select Mark All.
step 4:- you will find 5 sub-menu as 1st to 5th style.Note :-
- Using first style : cyan color.
- Using second style : light brown.
- Using third style: yellow.
- Using fourth style: purple.
- Using fifth style: green.
I hope above information will be useful for you.
Thank you. -
I get, that you do not want to change the comment style using the style configuration dialog, right?
Actually, I would change it from there but I don’t see anything that has to do with the comments in that list.There is a bunch of other stuff but no comments, so maybe I am missing something?
-
Actually, I just found where this can be set in the style configurator.
It is not in global styles, so you have to change the background color for each language that is on that list.
Solved.