Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

Editor not syntax highlighting certain unit

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I'm running Lazarus 1.5 r48959 FPC 2.6.4 x86_64-linux-gtk 2, and every day I get this issue a couple of times - not always. I open a unit, but Lazarus simply doesn't apply any syntax highlighting. No idea why. There isn't any object pascal syntax errors as the units compile just fine.

I then have to manually select the popup menu and select Object Pascal as the highlighter and it works fine again. Closing the unit and opening it again doesn't solve the problem. It always happens with specific units too - I can reproduce the Lazarus also
makes no difference.

Anybody else seen this, or have ideas why this would happen?

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Martin Frb
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
I then have to manually select the popup menu and select Object Pascal as the highlighter and it works fine again. Closing the unit and opening it again doesn't solve the problem. It always happens with specific units too - I can reproduce the Lazarus also makes no difference.

IIRC HL is chosen according to file extension .pp or .pas Do your files have those extension?

Or maybe check in the lrs (or lri ) file of the project, if there is a special HL setting for the file.

Reply by email

Graeme Geldenhuys
to Martin Frb
Martin Frb wrote
IIRC HL is chosen according to file extension .pp or .pas Do your files have those extension?

For the project I'm working on they are all .pp file extensions.

More specific, these units are pure code units (declaring unit tests), so no Forms or other GUI's involved.

Just in case (not to mess with the parser) I tried some things with one of the issue units. I made sure there is no BOM marker, also made sure the EOL style is uniform (unix in my case). That made no difference.

I then opened that unit with MSEide and highlighting was perfect.

Also, as I mentioned these units compile just fine, so no syntax issues. Forcing "Free Pascal" syntax highlighting for this unit looks perfect - so no incorrect highlighting (suggesting malformed code syntax) appears.

Also removing the unit from the Project Inspector, saving the project, and then manually using File Open to open the unit makes no difference either. So it doesn't seem like a Project Setting is affecting this file.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Martin Frb
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
On 2015-08-13 17:12, Martin Frb wrote: > IIRC HL is chosen according to file extension .pp or .pas > Do your files have those extension? Also, as I mentioned these units compile just fine, so no syntax issues. Forcing "Free Pascal" syntax highlighting for this unit looks perfect - so no incorrect highlighting (suggesting malformed code syntax) appears.

So then it is not an issue with the HL, but with the HLR selection. I am not sure what all goes into this.

It should look at the extension (the configured extensions are on the color page of the IDE options)
It might (I am not sure) store info in the session (lps, lpi).

Not sure what else goes into the process.

Also removing the unit from the Project Inspector, saving the project, and then manually using File Open to open the unit makes no difference either. So it doesn't seem like a Project Setting is affecting this file.

Removing from project would not necessarily make a difference. The session stores info fore none project files too (thought that can be disabled). It stores info for all files that where open while the project was open. Same file can have different session info in different projects.

Sorry currently no further idea.

Reply by email

Graeme Geldenhuys
to Martin Frb
Martin Frb wrote
It should look at the extension (the configured extensions are on the color page of the IDE options) It might (I am not sure) store info in the session (lps, lpi).

Ah, the problem was in the .lps file. For some reason I had loads of files with <SyntaxHighlighter ...> information defined - not all units though. Very weird, and I don't even know how you do something like that. I quickly ran through the whole .lps file and deleted all the <SyntaxHighlighter ...> lines and now the units display as expected.

<Unit25>
<Filename Value="tcdbdecorator.pp"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="2"/>
<WindowIndex Value="1"/>
<SyntaxHighlighter Value="Text"/>
<UsageCount Value="144"/>
<Loaded Value="True"/>
</Unit25>

Many thanks for your help and pointing me in the right direction.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email