[CLOSED] Lazarus IDE colouring bug lazarus / 9-Editor ---------------------------------------------------------------------- lagprogramming · 2023-08-02 09:01 Is there a bug regarding the colouring of the texts? 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 program Project1;{$if declared(xisntthisabugx)}const  xisthisabugx = 'xx'; //black line, should have been grey{$endif} {$if declared(isntthisabug)}const  isthisabug = 'yes'; //black line, should have been grey{$else}const  isthisabug = 'no'; //grey line, should have been black{$endif}beginwriteln(isthisabug); //writes no//Obviously, the following line fails to compile//writeln(xisthisabugx);end. ---------------------------------------------------------------------- Martin_fr · 2023-08-02 09:25 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/16061 ---------------------------------------------------------------------- WooBean · 2023-08-02 13:05 Maybe this will explain how the things work: 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 program Project1;//{$if declared(xisntthisabugx)}{$ifdef xisntthisabugx}const  xisthisabugx = 'xx'; //black line, should have been grey - NOW IT IS GREY{$endif} //{$if declared(isntthisabug)}{$ifdef isntthisabug}const  isthisabug = 'yes'; //black line, should have been grey - NOW IT IS GREY{$else}const  isthisabug = 'no'; //grey line, should have been black - NOW IT IS BLACK{$endif}beginwriteln(isthisabug); //writes no,  AND IT IS OKreadln;//Obviously, the following line fails to compile//writeln(xisthisabugx);end.   Added: Good thing is that if Lazarus can properly parse {$IFDEF XXX} clauses - there is a very short way to do the same with {$IF DECLARED(XXX)}. Note, code explorer displays at "Directives"  tab all compiler directives as they are. A keyword "declared" is known for identifier completion (but not for code creation tool). Yet one observation - adding {$MODE DELPHI} changes nothing. ---------------------------------------------------------------------- WooBean · 2023-08-04 14:50 You know probably all, but the thread is not closed ... This works too: 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 program Project1;//{$if declared(xisntthisabugx)}{$if defined(xisntthisabugx)}const  xisthisabugx = 'xx'; //black line, should have been grey - NOW IT IS GREY{$endif} //{$if declared(isntthisabug)}{$if defined(isntthisabug)}const  isthisabug = 'yes'; //black line, should have been grey - NOW IT IS GREY{$else}const  isthisabug = 'no'; //grey line, should have been black - NOW IT IS BLACK{$endif}begin  writeln(isthisabug); //writes no,  AND IT IS OK  readln;  //Obviously, the following line fails to compile  //writeln(xisthisabugx);end. ---------------------------------------------------------------------- lagprogramming · 2023-08-04 17:12 Quote from: Martin_fr on August 02, 2023, 11:25:38 amhttps://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/16061 I was surprised to notice this Lazarus behavior because by changing the colour of the text in the editor it misleads the developers.