[Geany-Users] Code folding in geany 1.26

classic Classic list List threaded Threaded
7 messages Options
H
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Geany-Users] Code folding in geany 1.26

H
I am running CentOS 6.8 and gedit 1.26. I would like to install a code-folding plugin which I believe does exist. Have people found it useful?

Ideally I would also like to be able to fold markdown text, not only programming code. Has anyone had success with that?

_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Code folding in geany 1.26

Lex Trotman
On 27 November 2016 at 01:20, H <[hidden email]> wrote:
> I am running CentOS 6.8 and gedit 1.26. I would like to install a
> code-folding plugin which I believe does exist. Have people found it useful?

Plugins cannot do code folding in Geany, so it cannot exist.

>
> Ideally I would also like to be able to fold markdown text, not only
> programming code. Has anyone had success with that?

No, for the reason given above :)

Cheers
Lex

>
> _______________________________________________
> Users mailing list
> [hidden email]
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Code folding in geany 1.26

Matthew Brush-2
In reply to this post by H
On 2016-11-26 07:20 AM, H wrote:
> I am running CentOS 6.8 and gedit 1.26. I would like to install a
> code-folding plugin which I believe does exist. Have people found it
> useful?
>

Geany does code folding by default. The only code-folding-related plugin
I've seen GeanyNumberedBookmarks which remembers the fold state. If you
could describe more precisely what you mean by code-folding plugin,
perhaps someone will know of it.

> Ideally I would also like to be able to fold markdown text, not only
> programming code. Has anyone had success with that?
>

I've never seen it implemented. If you were motivated, you could do it
in a plugin using Scintilla's folding API[0], but I've not seen any
plugins that do that.

Regards,
Matthew Brush

[0]: http://www.scintilla.org/ScintillaDoc.html#Folding

_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Code folding in geany 1.26

Lex Trotman
On 7 December 2016 at 11:01, Matthew Brush <[hidden email]> wrote:

> On 2016-11-26 07:20 AM, H wrote:
>>
>> I am running CentOS 6.8 and gedit 1.26. I would like to install a
>> code-folding plugin which I believe does exist. Have people found it
>> useful?
>>
>
> Geany does code folding by default. The only code-folding-related plugin
> I've seen GeanyNumberedBookmarks which remembers the fold state. If you
> could describe more precisely what you mean by code-folding plugin, perhaps
> someone will know of it.

Though (IIUC) it just remembers the state of folds, it doesn't define
fold points, thats the lexers job.

>
>> Ideally I would also like to be able to fold markdown text, not only
>> programming code. Has anyone had success with that?
>>
>
> I've never seen it implemented. If you were motivated, you could do it in a
> plugin using Scintilla's folding API[0], but I've not seen any plugins that
> do that.

I don't think Geany supports SCI_LEX_CONTAINER that you need to know
when/what to lex.

>
> Regards,
> Matthew Brush
>
> [0]: http://www.scintilla.org/ScintillaDoc.html#Folding
>
> _______________________________________________
> Users mailing list
> [hidden email]
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Code folding in geany 1.26

Matthew Brush-2
On 2016-12-06 05:08 PM, Lex Trotman wrote:

> On 7 December 2016 at 11:01, Matthew Brush <[hidden email]> wrote:
>> On 2016-11-26 07:20 AM, H wrote:
>>>
>>> [...]
>>> Ideally I would also like to be able to fold markdown text, not only
>>> programming code. Has anyone had success with that?
>>>
>>
>> I've never seen it implemented. If you were motivated, you could do it in a
>> plugin using Scintilla's folding API[0], but I've not seen any plugins that
>> do that.
>
> I don't think Geany supports SCI_LEX_CONTAINER that you need to know
> when/what to lex.
>

A plugin could look at the code and notifications and decide what and
when to fold. If the lexer does folding already (unlike Markdown), the
plugin would be fighting the lexer's setting of fold levels, and would
probably require disabling code folding in Geany and doing everything in
the plugin.

The proper solution would be to improve Scintilla's Markdown lexer to
support folding though[0].

Regards,
Matthew Brush

[0]: https://sourceforge.net/p/scintilla/feature-requests/971/
_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Code folding in geany 1.26

Lex Trotman
On 7 December 2016 at 11:17, Matthew Brush <[hidden email]> wrote:

> On 2016-12-06 05:08 PM, Lex Trotman wrote:
>>
>> On 7 December 2016 at 11:01, Matthew Brush <[hidden email]> wrote:
>>>
>>> On 2016-11-26 07:20 AM, H wrote:
>>>>
>>>>
>>>> [...]
>>>> Ideally I would also like to be able to fold markdown text, not only
>>>> programming code. Has anyone had success with that?
>>>>
>>>
>>> I've never seen it implemented. If you were motivated, you could do it in
>>> a
>>> plugin using Scintilla's folding API[0], but I've not seen any plugins
>>> that
>>> do that.
>>
>>
>> I don't think Geany supports SCI_LEX_CONTAINER that you need to know
>> when/what to lex.
>>
>
> A plugin could look at the code and notifications and decide what and when
> to fold. If the lexer does folding already (unlike Markdown), the plugin
> would be fighting the lexer's setting of fold levels, and would probably
> require disabling code folding in Geany and doing everything in the plugin.

Yes, setting the lexer to  SCLEX_CONTAINER is how you turn off the
scintilla lexer and get the SCN_STYLENEEDED notification to do it in
the plugin.  But ATM Geany doesn't support it.

>
> The proper solution would be to improve Scintilla's Markdown lexer to
> support folding though[0].

+1

>
> Regards,
> Matthew Brush
>
> [0]: https://sourceforge.net/p/scintilla/feature-requests/971/
>
> _______________________________________________
> Users mailing list
> [hidden email]
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Geany-Users] Code folding in geany 1.26

Matthew Brush-2
On 2016-12-06 06:41 PM, Lex Trotman wrote:

> On 7 December 2016 at 11:17, Matthew Brush <[hidden email]> wrote:
>> On 2016-12-06 05:08 PM, Lex Trotman wrote:
>>> On 7 December 2016 at 11:01, Matthew Brush <[hidden email]> wrote:
>>>> On 2016-11-26 07:20 AM, H wrote:
>>>>> [...]
>>>>> Ideally I would also like to be able to fold markdown text, not only
>>>>> programming code. Has anyone had success with that?
>>>>> [...]
>> A plugin could look at the code and notifications and decide what and when
>> to fold. If the lexer does folding already (unlike Markdown), the plugin
>> would be fighting the lexer's setting of fold levels, and would probably
>> require disabling code folding in Geany and doing everything in the plugin.
>
> Yes, setting the lexer to  SCLEX_CONTAINER is how you turn off the
> scintilla lexer and get the SCN_STYLENEEDED notification to do it in
> the plugin.  But ATM Geany doesn't support it.
>

For the Markdown lexer, which doesn't appear to support folding, you
could just write simple plugin which scans the text and set the
appropriate fold level on the desired lines.

For example this naive pseudo-code to fold on #-style headers:

        onTextChanged() {
                foreach line in allLines
                        if line.text.startsWith("###")
                                line.foldLevel = 3
        }

It's not as nice as doing it inside the lexer proper but it's probably
only a few pages of code to implement.

Regards,
Matthew Brush

_______________________________________________
Users mailing list
[hidden email]
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Loading...