Delphi 12.3 IDE Platform Defines

In my FMX project I’m using the platform defines for code that is required for Android or Windows like so:

{$IFDEF MSWINDOWS}
  DoSomeWindowsStuff;
{$ENDIF}
{$IFDEF ANDROID}
  DoTheAndroidVersion;
{$ENDIF}

In general this works apart from sometimes the “dimming” of the editor text sticks on a previously selected platform. This makes it hard to read code I’m actually working on and causes confusion about what code is in play.

I usually double click the platform in the Projects windows, but the same issue happens when using the platform drop down box in the toolbar. I can’t see any definite pattern to it so far. Sometimes the editor does update correctly. Closing and reopening the project brings it right, so the defines are correct. Has anyone else seen this?

Yes - it’s an LSP issue. You can avoid closing/reopening a project by using Tools|Reload LSP Server

2 Likes

In recent versions of Delphi, there is a “Reload LSP” menu item on the tools menu I think it is. If the active text hasn’t updated, click on this menu item. The project will get reparsed by the ide and the text will be updated to correct the problem.

2 Likes