Makopo / sublime-text-lsl

Syntax definitions for LSL(Linden Scripting Language) in Second Life and OSSL(OpenSimulator Scripting Language) in OpenSimulator.
31 stars 4 forks source link

`do.sublime-snippet` doesn't work as expected #33

Closed ghost closed 9 years ago

ghost commented 10 years ago

The snippet sublime-text-lsl / snippets / commons / do.sublime-snippet doesn't have the desired effect. The problem is in line 4 where it says:

<snippet>
<content><![CDATA[do$LSL_SPACE_OR_NEWLINE{
$0;
}$LSL_SPACE_OR_NEWLINEwhile (${1:condition});]]></content>
<tabTrigger>do</tabTrigger>
<scope>meta.function.body.lsl, meta.event.body.lsl, meta.function.body.ossl, meta.event.body.ossl</scope>
<description>flow control</description>
</snippet>

$LSL_SPACE_OR_NEWLINEwhile is being ignored because it's an unknown tag.

Makopo commented 10 years ago

It works on my osx environment. Please tell your environment - operation systems and versions. Thanks.

ghost commented 10 years ago

I'm on Windows 7 x64 Ultimate with Sublime 3059 stable.

Output on my editor is either:

do
{
    $0;
} (${1:condition});

or

do {
    $0;
} (${1:condition});

As you can see the first $LSL_SPACE_OR_NEWLINE is being read correctly. The second is being ignored though as well as the while, probably because it's being read as $LSL_SPACE_OR_NEWLINEwhile which isn't defined.

Makopo commented 9 years ago

I confirmed the issue in the current version. Unfortunately there seems to be no way to completely fix this issue. To avoid the non-compilable case, I added a space before the variable for now. a7e383a1781462c849f1ebd270235e1abc3ef688

FichteFoll commented 9 years ago

Does ${LSL_SPACE_OR_NEWLINE}while work?

Makopo commented 9 years ago

@FichteFoll Thanks! It works now!

ghost commented 9 years ago

Nice catch!

buildersbrewery commented 9 years ago

Hi Mako,

FYI ${LSL_SPACE_OR_NEWLINE} works in *.sublime-completions files as well. You can merge the snippet files into one completions file.

buildersbrewery commented 9 years ago

However you'll need to set a default indent style when loading the LSL package, because setting it in the __init__ of ChangeStyleCommand is too late.

Compare:

https://github.com/buildersbrewery/linden-scripting-language/tree/master/sublimetext/LSL