[SOLVED] Highlighting of custom words lazarus / 9-Editor ---------------------------------------------------------------------- Hi im Pascal · 2021-05-28 21:55 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 · 2021-05-28 22:46 Quote from: Hi im Pascal on May 28, 2021, 11:55:08 pm1. 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, ...)?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  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  break: Integer = 123;  Integer: String = 'Wow!';  True, False: LongInt;and the compiler will happily accept it. Quote2. Do you also consider it a bug that user defined markup is highlighted within comments as well?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 · 2021-05-28 23:32 But then why does Code: [Select]// procedure not highlight "procedure", it seems inconsistent. ---------------------------------------------------------------------- lucamar · 2021-05-29 01:07 Quote from: Hi im Pascal on May 29, 2021, 01:32:34 amBut then why does Code: [Select]// procedure not highlight "procedure", it seems inconsistent. 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 · 2021-05-29 10:17 Quote from: lucamar on May 29, 2021, 12:46:27 amQuote2. Do you also consider it a bug that user defined markup is highlighted within comments as well?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 ... 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.... ---------------------------------------------------------------------- Martin_fr · 2021-05-29 10:21 Quote from: Hi im Pascal on May 29, 2021, 01:32:34 amBut then why does Code: [Select]// procedure not highlight "procedure", it seems inconsistent. procedure is a keyword. The highlighter knows that. The highlighter also knows what a comment is. User defined colors, are not keywords. They can be anything. I could add my name into user defined colors, so I will spot if it appears anywhere in the source (comment, string, anywhere)... I have user defined colors with a key to toggle them to any word. I use that to highlight variable names (when I refactor, so I can spot them). If those appear in comment, I want to see them there too. ---------------------------------------------------------------------- Hi im Pascal · 2021-05-29 12:28 O.k. thanks all for explaining it, I understand the philosophy behind it, and that it's not a bug but intended behavior. ---------------------------------------------------------------------- Martin_fr · 2021-05-29 12:50 Quote from: Hi im Pascal on May 29, 2021, 02:28:34 pmO.k. thanks all for explaining it, I understand the philosophy behind it, and that it's not a bug but intended behavior. You can still get what you want, by using priorities. You did see that? ---------------------------------------------------------------------- Hi im Pascal · 2021-06-03 18:54 Quote from: Martin_fr on May 29, 2021, 02:50:26 pmQuote from: Hi im Pascal on May 29, 2021, 02:28:34 pmO.k. thanks all for explaining it, I understand the philosophy behind it, and that it's not a bug but intended behavior. You can still get what you want, by using priorities. You did see that? To be frank I wasn't quite adept enough to specifically figure out how to set the Foreground priority for "ObjectPascal::Comment" item (even though it probably was said somewhere in this thread, I couldn't decode the explicit steps to perform)^^ ---------------------------------------------------------------------- Martin_fr · 2021-06-03 19:07 Quote from: Hi im Pascal on June 03, 2021, 08:54:28 pmTo be frank I wasn't quite adept enough to specifically figure out how to set the Foreground priority for "ObjectPascal::Comment" item (even though it probably was said somewhere in this thread, I couldn't decode the explicit steps to perform)^^ Ok. Menu > Tools > Options Page > Editor > Display > Colors At the bottom of the page  (below the section "element attributes" is a toolbar. It has 3 buttons: "Colors", "Priorities", "reset" Click "Priorities". In the treeview (left to the preview) where all colors are listed, select "comment" => that will also select "comment" in the "priority" listings. Now for the foreground priority, you can change the value to:  2 ----- There is no entry in "background priority". This only appears if you set a background color. But if your user-defined color does not have background, then you do not need that here either. ------------ Don't forget to go to your user defined color, and set its prior down to   1 ---- repeat for: string color ---------------------------------------------------------------------- Hi im Pascal · 2024-03-30 22:39 Sorry for no / late response, but I'm able to reproduce this, thank you!