Recent

Author Topic: "Active $IFDEF code" is rendered as "Inactive $IFDEF code"  (Read 990 times)

flowCRANE

  • Hero Member
  • *****
  • Posts: 901
"Active $IFDEF code" is rendered as "Inactive $IFDEF code"
« on: December 04, 2024, 06:19:29 pm »
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  [Select][+][-]
  1. const
  2.   BUFFER_WIDTH  = 128;
  3.   BUFFER_HEIGHT = 128;
  4.  
  5. const
  6.   WORLD_WIDTH  = 96;
  7.   WORLD_HEIGHT = 128;
  8.  
  9.   {$IF WORLD_WIDTH < BUFFER_WIDTH}
  10.     {$FATAL message to print}
  11.   {$ENDIF}
  12.  
  13.   {$IF TRUE}
  14.     {$FATAL message to print}
  15.   {$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.
« Last Edit: December 04, 2024, 06:27:15 pm by flowCRANE »
Lazarus 3.6 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Fibonacci

  • Hero Member
  • *****
  • Posts: 647
  • Internal Error Hunter
Re: "Active $IFDEF code" is rendered as "Inactive $IFDEF code"
« Reply #1 on: December 04, 2024, 07:18:13 pm »
Lazarus built ~1 month ago

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10670
  • Debugger - SynEdit - and more
    • wiki
Re: "Active $IFDEF code" is rendered as "Inactive $IFDEF code"
« Reply #2 on: December 04, 2024, 07:42:04 pm »
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

  • Hero Member
  • *****
  • Posts: 901
Re: "Active $IFDEF code" is rendered as "Inactive $IFDEF code"
« Reply #3 on: December 04, 2024, 08:32:57 pm »
Ok, I understand. So I think reporting a new issue is not needed, since this problem is known. Thank you for the answers.
Lazarus 3.6 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8112
Re: "Active $IFDEF code" is rendered as "Inactive $IFDEF code"
« Reply #4 on: December 04, 2024, 09:49:15 pm »
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018