Forum > Editor

"Active $IFDEF code" is rendered as "Inactive $IFDEF code"

(1/1)

flowCRANE:
See the attachment — the condition in the directive should be met, so the content should be rendered in a colored (red) form. Meanwhile, the content is rendered using the style intended for inactive code (darkened text, just 135 opacity). So, in short, the code highlighter suggests that the condition is not met, but the compiler correctly detects this condition as met and aborts compilation.


--- 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";}};} ---const  BUFFER_WIDTH  = 128;  BUFFER_HEIGHT = 128;  const  WORLD_WIDTH  = 96;  WORLD_HEIGHT = 128;    {$IF WORLD_WIDTH < BUFFER_WIDTH}    {$FATAL message to print}  {$ENDIF}    {$IF TRUE}    {$FATAL message to print}  {$ENDIF}
I added the second condition (this $IF TRUE) just to illustrate what the style of the active code should look like.

This is how it looks in Lazarus 3.6 (official stable release). Can someone check how it looks in Lazarus 4.0 RC1 (or in the latest trunk) and confirm the existence of the problem? If so, I will report it to GitLab.

Fibonacci:
Lazarus built ~1 month ago

Martin_fr:
Codetools doesn't handle some kind of $IF (afaik limited to mostly simple $IFDEF).

You may notice, that if you navigate code, it will also (wrongly) behave as if that code was active.

Similar issue https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41211
There probably are more, likely including the example from this post. But I don't know / haven't done a deep enough search.

flowCRANE:
Ok, I understand. So I think reporting a new issue is not needed, since this problem is known. Thank you for the answers.

MarkMLl:
Xref to https://forum.lazarus.freepascal.org/index.php/topic,69445.msg539940.html#msg539940 which has been running a few days.

I sympathise, but the fact is that the IDE doesn't embed a Pascal compiler to handle markup decisions since that would be prohibitively expensive (i.e. slow, relative to the speed with which the IDE responds to most user actions).

MarkMLl

Navigation

[0] Message Index

Go to full version