Forum > Editor

[SOLVED] Highlighting of custom words

(1/2) > >>

Hi im Pascal:
Hi all,

1. Do you also consider it a bug that certain reserved words and pre-defined identifiers are not highlighted as reserved (e.g., true, false, integer, break, ...)?
--> I think I could fix that via code contribution to Lazarus IDE, is it feasible for someone good at programming, but maybe not familiar with the project?

2. Do you also consider it a bug that user defined markup is highlighted within comments as well? E.g., if I add "break" to highlight and type "break" inside a source code comment, it will still be highlighted.
--> I think I could also fix that bug via code contribution to Lazarus IDE, see question 1.

Thanks.

lucamar:

--- Quote from: Hi im Pascal on May 28, 2021, 11:55:08 pm ---1. Do you also consider it a bug that certain reserved words and pre-defined identifiers are not highlighted as reserved (e.g., true, false, integer, break, ...)?
--- End quote ---
It's not exactly a bug since those are not reserved; whether predefined or not, they are "normal" identifiers. You can even do:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  break: Integer = 123;  Integer: String = 'Wow!';  True, False: LongInt;and the compiler will happily accept it.


--- Quote ---2. Do you also consider it a bug that user defined markup is highlighted within comments as well?
--- End quote ---
Not really either: the IDE has no way to know when and where should or shouldn't highlight it, but since you did tell it to highlight ... ;)

Hi im Pascal:
But then why does

--- Code: ---// procedure

--- End code ---
not highlight "procedure", it seems inconsistent.

lucamar:

--- Quote from: Hi im Pascal on May 29, 2021, 01:32:34 am ---But then why does

--- Code: ---// procedure

--- End code ---
not highlight "procedure", it seems inconsistent.
--- End quote ---

No, because "procedure" is a special, reserved word, so the IDE knows it shouldn't be highlighted if inside a comment.

It's really a question of highlighting priorities, kind of, where the "comment" attributes supercede those of most other kind except user-defined ones and, IIRC, some other. I think there is some way to change that but I don't remember ATM how or, TBH, if it can be done.

Martin_fr:

--- Quote from: lucamar on May 29, 2021, 12:46:27 am ---
--- Quote ---2. Do you also consider it a bug that user defined markup is highlighted within comments as well?
--- End quote ---
Not really either: the IDE has no way to know when and where should or shouldn't highlight it, but since you did tell it to highlight ... ;)

--- End quote ---

And that is were highlight priorities come in. It does not solve everything but makes thinks a lot better...
I assume your user defined color for true/false is foreground color only. Otherwise below applies to any other setting too (background/frame/style)

In your normal color setting edit comments and strings.
- Make sore they have a color set (foreground will be/ but if you need others / see above)
- Edit the priority for the foreground, so it is above zero (maybe to 50)

Then go to user defined
- Edit the priority for the foreground to 1.

Now the foreground color of the comment will hide your user defined color.


-------------
If you use "frames" you must set up a frame with the background color in the normal colors. No frame has no priority....

Navigation

[0] Message Index

[#] Next page

Go to full version