Re: [textadept] Snippets with Tabs

From: Robert <ro....at.web.de>
Date: Fri, 29 Apr 2011 13:21:46 +0200

On Thu, Apr 28, 2011 at 2:59 PM, mitchell <c....at.caladbolg.net> wrote:
> Robert,
>
> On Thu, 28 Apr 2011, Robert wrote:
>
>> On Wed, Apr 27, 2011 at 5:48 PM, mitchell <c....at.caladbolg.net> wrote:
>>>
>>> Robert,
>>>
>> [...]
>>>
>>> What you are seeing happens when you use a snippet tab_width of 2
>>> [spaces]
>>> while your document has a tab_width of 4. The indent sizes need to match
>>> in
>>> order to insert the proper indentation. This is why it is recommended to
>>> use
>>> tab characters in snippets. (By the way, your patch does not handle
>>> multiple
>>> levels of indentation properly.)
>>
>> I was afraid I had overlooked something. Could you give an example of
>> a multiple levels snippet?
>
> snippets.foo = [[
> foo
>  bar
>    baz
> ]]
>
> mitchell
>
Ahh, thanks! I had re-renamed the wrong version of snippets.lua and
couldn't reproduce at first :-)

How about having something like the following in the "important note"
section of the snippets docs:
Snippets with indented blocks can be defined using \t. The tab
character is replaced with spaces or tabs according to the current
buffer's settings. In multi-line strings that define a snippet an
actual tab character must be used.

Possibly, even with examples?

snippets.while = 'while %1(true)\n\t'
snippets.forin = [[
for %1(item) in %2(list)
→%0]]

Robert
Received on Fri 29 Apr 2011 - 07:21:46 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:05:32 EST