Recent

Author Topic: [SOLVED] Highlight comments started with # in TSynIniSyn  (Read 3453 times)

artem101

  • Full Member
  • ***
  • Posts: 101
[SOLVED] Highlight comments started with # in TSynIniSyn
« on: January 14, 2025, 12:27:04 pm »
How to modify TSynIniSyn to recognize strings started with "#" character as comments in addition to ";"?

P.S.: I use CFG files, not INI. In CFG syntax a bit different.
« Last Edit: January 14, 2025, 06:36:19 pm by artem101 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10792
  • Debugger - SynEdit - and more
    • wiki
Re: Highlight comments started with # in TSynIniSyn
« Reply #1 on: January 14, 2025, 12:36:23 pm »
Have you tried

Code: Pascal  [Select][+][-]
  1. SynIniSyn.CommentTypes := [ictSemicolon, ictHash];

Or set it in the designer....

artem101

  • Full Member
  • ***
  • Posts: 101
Re: Highlight comments started with # in TSynIniSyn
« Reply #2 on: January 14, 2025, 01:18:55 pm »
Quote
mainform.pas(207,14) Error: identifier idents no member "CommentTypes"
mainform.pas(207,31) Error: Identifier not found "ictSemicolon"
mainform.pas(207,45) Error: Identifier not found "ictHash"

artem101

  • Full Member
  • ***
  • Posts: 101
Re: Highlight comments started with # in TSynIniSyn
« Reply #3 on: January 14, 2025, 01:27:09 pm »
Also can't find in designer.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10792
  • Debugger - SynEdit - and more
    • wiki

artem101

  • Full Member
  • ***
  • Posts: 101
Re: Highlight comments started with # in TSynIniSyn
« Reply #5 on: January 14, 2025, 01:33:03 pm »
Any alternatives for Lazarus v2.2.4? Yes, a bit old, but I use this version for my projects.

TRon

  • Hero Member
  • *****
  • Posts: 3930
Re: Highlight comments started with # in TSynIniSyn
« Reply #6 on: January 14, 2025, 01:35:47 pm »
Any alternatives for Lazarus v2.2.4? Yes, a bit old, but I use this version for my projects.
The offered solution exist for tsyninisyn since Lazarus 3.0 (and Lazarus is currently at 4.0RC)

2.2.4, really ? :rubs-eyes:
I do not have to remember anything anymore thanks to total-recall.

artem101

  • Full Member
  • ***
  • Posts: 101
Re: Highlight comments started with # in TSynIniSyn
« Reply #7 on: January 14, 2025, 01:42:09 pm »
2.2.4, really ?

just 1,5 years old

TRon

  • Hero Member
  • *****
  • Posts: 3930
Re: Highlight comments started with # in TSynIniSyn
« Reply #8 on: January 14, 2025, 01:46:41 pm »
just 1,5 years old
True and that seems like it is pretty recent but oh man, the quality of life improvements in those 1.5 years.

Just wanted to check if somehow it was a typo. Thank you for the feedback.
I do not have to remember anything anymore thanks to total-recall.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10792
  • Debugger - SynEdit - and more
    • wiki
Re: Highlight comments started with # in TSynIniSyn
« Reply #9 on: January 14, 2025, 02:06:46 pm »
Any alternatives for Lazarus v2.2.4? Yes, a bit old, but I use this version for my projects.
Follow the link I posted. It shows the changed code.

I don't know if there were other changes (on which this depends) since 2.2.4. So you have to see if you can
- apply the patch as is
- even just take a copy of the new file
- have to fiddle yourself with the code
- upgrade



And also, 2.2.4 was released about 1.5 years back. But technically it is over 2 years old, it is feature frozen based on 2.2.0 from January 2022. However the feature freeze was done when it was branched for starting release candidates and that was in June 2021 => So that makes it 2.5 years in terms of missing features.

In the same way 3.6 may have been released just over 3 month ago, but its based on the frozen feature set of 3.0 from December 2023. And branched in late 2022.

In both cases, the rest is bug fixes.

In a way you are unlucky, because the "#" comment was added in Dec 2023. So that is before 2.2.4 was released (and even after 3.0 was feature frozen). As it is a feature it never made it into those.

Mind that even though 4.0 is not yet released, it already is a few month feature frozen. That way all features in the release will have been tested for at least some time, and be a little less likely to have big bugs.

cdbc

  • Hero Member
  • *****
  • Posts: 1808
    • http://www.cdbc.dk
Re: Highlight comments started with # in TSynIniSyn
« Reply #10 on: January 14, 2025, 02:40:55 pm »
Hi
Attached you'll find my 'synhighlighterini.pp' from my laz-3.6, maybe you could try to make that work for you?!?
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

artem101

  • Full Member
  • ***
  • Posts: 101
Re: Highlight comments started with # in TSynIniSyn
« Reply #11 on: January 14, 2025, 05:19:04 pm »
Martin_fr, thank you for explanation. I'll think about upgrade.

 

TinyPortal © 2005-2018