Editor with syntax highlighting awareness

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Editor with syntax highlighting awareness

philippeback
I want to do such an editor.

Preferrably something fast.
And in the current Pharo.

There have been several text models, Rubric etc.

What is the quickest way to get such a thing?

Features:

Load/Save content
Highlight keywords based on syntax parsing
Act on the element under the cursor
Act on the element when (modifier)clicking on it (or hovering).
Fast (or at least, not sluggish on a "normal" (ie Core i5 1.8Ghz) laptop)

This is really something I miss being able to do in Pharo.

Lots of code is using "STHStyler" things but there seems to be no easy
way to extend that (as it seems to be using the AST or something like
that).

I am okay with a first easy approach to highlighting, like in Vim
where one puts a syntax file with not that many things.

Phil

Reply | Threaded
Open this post in threaded view
|

Re: Editor with syntax highlighting awareness

Tim Mackinnon
Dolphin Smalltalk has such an editor - so it might provide inspiration for you. It uses the scintilla library which I notice does support windows/osx/linux ( http://www.scintilla.org/ScintillaDownload.html ) but it might be more than what you need given Pharo has over the years added many things that get it close (just not the colour coding)


Tim

On 7 May 2017, at 17:57, [hidden email] wrote:

I want to do such an editor.

Preferrably something fast.
And in the current Pharo.

There have been several text models, Rubric etc.

What is the quickest way to get such a thing?

Features:

Load/Save content
Highlight keywords based on syntax parsing
Act on the element under the cursor
Act on the element when (modifier)clicking on it (or hovering).
Fast (or at least, not sluggish on a "normal" (ie Core i5 1.8Ghz) laptop)

This is really something I miss being able to do in Pharo.

Lots of code is using "STHStyler" things but there seems to be no easy
way to extend that (as it seems to be using the AST or something like
that).

I am okay with a first easy approach to highlighting, like in Vim
where one puts a syntax file with not that many things.

Phil


Reply | Threaded
Open this post in threaded view
|

Re: Editor with syntax highlighting awareness

nacho
In reply to this post by philippeback
Phil,
It is something that I want too in Pharo. Especially for rendering Markdown / Pillar.
I'm willing to help if you need a hand. Don't expect a pro developer but I will do my best.
Let me know.
Best
Nacho

Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: Editor with syntax highlighting awareness

Offray Vladimir Luna Cárdenas-2
In reply to this post by philippeback
Hi,

I would like something along the lines of the recent code syntax thread.
Maybe something like:

===============

TextModel new
     isForCode: 'markdown';
     text: (Collection>>#anyOne) sourceCode;
     aboutToStyle: true;
     openWithSpec

===============

This would do a great adding for Grafoscopio.

Cheers,

Offray

On 07/05/17 11:57, [hidden email] wrote:

> I want to do such an editor.
>
> Preferrably something fast.
> And in the current Pharo.
>
> There have been several text models, Rubric etc.
>
> What is the quickest way to get such a thing?
>
> Features:
>
> Load/Save content
> Highlight keywords based on syntax parsing
> Act on the element under the cursor
> Act on the element when (modifier)clicking on it (or hovering).
> Fast (or at least, not sluggish on a "normal" (ie Core i5 1.8Ghz) laptop)
>
> This is really something I miss being able to do in Pharo.
>
> Lots of code is using "STHStyler" things but there seems to be no easy
> way to extend that (as it seems to be using the AST or something like
> that).
>
> I am okay with a first easy approach to highlighting, like in Vim
> where one puts a syntax file with not that many things.
>
> Phil
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Editor with syntax highlighting awareness

Ronie Salgado
Hi All,

Here is a basic example for doing a very simple syntax highlighted text editor:

=====
styler := MyTextStyler new.

browser := GLMTabulator new.
browser row: #row.

browser transmit to: #row; andShow: [ :composite |
    composite custom: (GLMRubricHighlightedTextPresentation new
        editingMode: [GLMHighlighterTextRubEditingMode
            withStylerDecorator: (GLMHighlighterTextStylerDecorator new styler: styler)]) ].
  
browser openOn: 'Some text with highlighting $@'.
=====

Best regards,
Ronie

2017-05-08 11:42 GMT-03:00 Offray Vladimir Luna Cárdenas <[hidden email]>:
Hi,

I would like something along the lines of the recent code syntax thread. Maybe something like:

===============

TextModel new
    isForCode: 'markdown';
    text: (Collection>>#anyOne) sourceCode;
    aboutToStyle: true;
    openWithSpec

===============

This would do a great adding for Grafoscopio.

Cheers,

Offray


On 07/05/17 11:57, [hidden email] wrote:
I want to do such an editor.

Preferrably something fast.
And in the current Pharo.

There have been several text models, Rubric etc.

What is the quickest way to get such a thing?

Features:

Load/Save content
Highlight keywords based on syntax parsing
Act on the element under the cursor
Act on the element when (modifier)clicking on it (or hovering).
Fast (or at least, not sluggish on a "normal" (ie Core i5 1.8Ghz) laptop)

This is really something I miss being able to do in Pharo.

Lots of code is using "STHStyler" things but there seems to be no easy
way to extend that (as it seems to be using the AST or something like
that).

I am okay with a first easy approach to highlighting, like in Vim
where one puts a syntax file with not that many things.

Phil






MyTextStyler.st (960 bytes) Download Attachment