Recent

Author Topic: Can Synedit do something like attached picture?  (Read 3622 times)

pik33

  • Jr. Member
  • **
  • Posts: 76
Can Synedit do something like attached picture?
« on: September 09, 2021, 10:21:18 am »
The attached picture shows a Propeller Tool code editor for Spin language.

What I want are these indentation lines I highlighted in the red ellipse. Spin is a indentation driven language and these lines help programming in it a lot.

These background colors are also convenient

Is it possible to recreate something similar in Synedit? If yes, where to search (tutorials, etc?)

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Can Synedit do something like attached picture?
« Reply #1 on: September 09, 2021, 10:33:35 am »
Right-click on Code-Editor > "Options" > "Editor" > "Display" > "Markup and Matches": Check the box "Outline (global)" under "Matching Keywords"

pik33

  • Jr. Member
  • **
  • Posts: 76
Re: Can Synedit do something like attached picture?
« Reply #2 on: September 09, 2021, 10:59:33 am »
Wow! This is of course is an instruction for Lazarus IDE

Setting this option in Lazarus IDE had a side effect:  highlight colors change (to much more fancy :)  )

So, it's possible. What I need is to write a Spin editor so I have to make a highlighter for this language with this option active by default.

The problem is: there are 2 tools for Propeller2 microcontroler.
One is Propeller Tool (the screen attached)
Second one is Flexprop.

The Propeller Tool is an integrated tool with all this fancy editing stuff, but it can only use its internal compiler.
The Flexprop is modular so its compiler can be called from CLI. It is much more flexible, allowing extended Spin syntax, C and Basic languages. But its editor is not the best. Its syntax highlighter don't work properly and lack of indentation highlighting causes bug tracking very hard.

So, as I am also a Lazarus user, my goal is to write a Spin editor with good syntax highlighting. Then it can call the standalone compiler to do the rest.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Can Synedit do something like attached picture?
« Reply #3 on: September 09, 2021, 11:31:07 am »
1) The colors are fully configurable. In the IDE this is under Tools > Options > Editor > color. Then all the way down are the "outline" colors.

2) Outside the IDE...
The outline is provided by the Markup.... (search ide/SourceSynEditor.pp or SynSource... for markup and outline)

To write your own highlighter: https://wiki.lazarus.freepascal.org/SynEdit_Highlighter
You need to implement the full code-folding. This provides the info for the outline.
Then search for FoldConfig, there you can enable what will be outlined.

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Can Synedit do something like attached picture?
« Reply #4 on: September 09, 2021, 11:41:49 am »
Setting this option in Lazarus IDE had a side effect:  highlight colors change (to much more fancy :)  )
I agree that the re-colored key words can look distracting, but most of the power of this tool comes from the colors. For example, when the final "end;" of a procedure is not red then I know that I forgot another "end" somewhere in between.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Can Synedit do something like attached picture?
« Reply #5 on: September 09, 2021, 12:07:55 pm »
Setting this option in Lazarus IDE had a side effect:  highlight colors change (to much more fancy :)  )
I agree that the re-colored key words can look distracting, but most of the power of this tool comes from the colors. For example, when the final "end;" of a procedure is not red then I know that I forgot another "end" somewhere in between.
As I said, the keyword color can be disabled, or just a border or underline.....

pik33

  • Jr. Member
  • **
  • Posts: 76
Re: Can Synedit do something like attached picture?
« Reply #6 on: September 09, 2021, 12:13:43 pm »
In Lazarus IDE I will left these colors as they are.

Quote
when the final "end;" of a procedure is not red then I know that I forgot another "end" somewhere in between.

This is useful.

 

TinyPortal © 2005-2018