Re: [textadept] Simple Pattern-Based Folding in Lexers

From: Robert <>
Date: Mon, 16 May 2011 12:17:13 +0200

Hi Mitchell,

On Sun, May 15, 2011 at 7:49 PM, mitchell <> wrote:
> On Sun, 15 May 2011, mitchell wrote:
>> Hi everyone,
>> I have commited code to Scintillua ( that
>> allows for simple pattern-based code folding to be defined in lexers instead
>> of full _fold() functions. I have implemented this folding for the lua and
>> cpp lexers for reference. Lexer authors, please see the appropriate
>> documentation in lexer.lua (search for "Simple Code Folding"). Here is a
>> snippet for folding Lua:
> I forgot to mention that LexLPeg.cxx was also changed so in order to test,
> you will have to recompile ta.
> mitchell
> [...]
>> Note that this is an experimental feature subject to change. Comments are
>> welcome.
>> mitchell

I found an issue here:
line 104 in lexer.lua
-- `:` to `@`, `[` to `'`, `{` to `~`).
starts a marker.

I tried the example code for folding by indentation with the Python
lexer (this seems to be exactly what I meant with "generic
translation" - couldn't something like this be a fallback?)
With Python I get:
textadept/lexers/python.lua:134: attempt to index global 'text' (a nil value).
Lua Error: Table of folds expected from lexer.fold.
I just copied over the example from the docs. Dmd and the earlier Lua
version with folding seem to work fine.

Another issue:
when I switch the lexer and back to the Lua lexer, the lines aren't drawn.

Received on Mon 16 May 2011 - 06:17:13 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:07:17 EST