Re: [code] Python folding pretty broken

From: Carlos Pita <carlosjosepita.att.gmail.com>
Date: Mon, 23 Feb 2015 14:31:26 -0300

The implementation of fold.by.indentation seems to be a case on its
own, see lines 1187 and below here:

http://foicica.com/hg/scintillua/file/d6c8c9c81cc7/lexers/lexer.lua

I can't further debug this just right now, but the gmatch pattern
could be the problem.

Cheers

--
Carlos
On Mon, Feb 23, 2015 at 2:25 PM, Parke <parke.nexus.att.gmail.com> wrote:
> On Mon, Feb 23, 2015 at 9:10 AM, Carlos Pita <carlosjosepita.att.gmail.com> wrote:
>>> Attached is my "text outline" folder (which is actually a Lexer).  It
>>> folds based purely on whitespace indentation.
>>
>> Thank you very much. Anyway, I feel the fold.by.indentation approach
>> is good to have at the scintillua level, many languages would benefit
>> from this general strategy out of the box. Other editors, notoriously
>> vim, do have it in their toolboxes. It's just that blank lines
>> shouldn't be taken to start new top level folds. I'm not even sure
>> whether there should be an option for this or not, I can't figure out
>> a sensible use case for the current behavior.
>
> Based on what I remember from December...
>
> The Scintilla folding API provides the current line to the folder.
> Scintilla assumes the folder will not need to look backwards at
> previous lines to do folding.
>
> This may be why blank lines are assumed to be top level folds.
>
> My outline folder scans backwards to see lines that Scintilla does not
> provide.  I think Mitchell recommended against this, but I saw no
> other solution.
>
> It would be interesting to look at the SciTE Python lexer/folder (if
> there is one) and see how it works.
>
> Back on December 10, off list, Parke wrote:
>> Not that I care about Python and CoffeeScript (at least at present),
>> but I believe Python allows blank lines between Header and Body.  And
>> also within Body.
>
> And Mitchell responded:
>> True, but I don't think this is very common.
>
> I did not press the point at that time, as I already knew I needed
> more than fold.by.indentation was providing.
>
> -Parke
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 23 Feb 2015 - 12:31:26 EST

This archive was generated by hypermail 2.2.0 : Tue 24 Feb 2015 - 06:43:40 EST