Tumblr Theme sugar, Auto-complete : OK, Stuck with syntaxes
Posted: 14 March 2010 09:11 AM   [ Ignore ]
Newbie
Rank
Total Posts:  3
Joined  2010-03-14

Hi,

I’m currently working on a Tumblr Theme sugar. Created a bunch of CodeSenseLibraries and a simple provider, auto completion works fine.
But I now want to narrow it to a more context view, so I added some syntaxes and providers. As the wiki is lacking some more examples, I inspired myself with the CSS and HTML sugars. (See below)

Unfortunately, either the syntaxes or the providers are not working. Any help on this would be greatly appreciated.

Here is my syntax file, that should match {TAG} or {block:BLOCK}{/block:BLOCK}

<?xml version="1.0"?>
<syntax name="com.tumblr.themes.syntax">
    <
zones>
        <
zone name="com.tumblr.themes.syntax.tag">
            <
starts-with>
                <
expression>(\{)([a-zA-Z][a-zA-Z0-9:_]*)</expression>
                <
capture number="1" name="com.tumblr.themes.syntax.tag.punctuation.begin"/>
                <
capture number="2" name="com.tumblr.themes.syntax.tag.name"/>
            </
starts-with>
            <
ends-with>
                <
expression>(\})</expression>
                <
capture number="1" name="com.tumblr.themes.syntax.tag.punctuation.end"/>
            </
ends-with>
            <!--<
subzones>
                <include 
collection="com.tumblr.themes.syntax.attribute"/>
            </
subzones>-->
        </
zone>
        <
zone name="com.tumblr.themes.syntax.block.open">
            <
starts-with>
                <
expression>(\{)block:([a-zA-Z0-9_]*)</expression>
                <
capture number="1" name="com.tumblr.themes.syntax.block.punctuation.begin"/>
                <
capture number="2" name="com.tumblr.themes.syntax.block.name"/>
            </
starts-with>
            <
ends-with>
                <
expression>(\})</expression>
                <
capture number="1" name="com.tumblr.themes.syntax.block.punctuation.definition.end"/>
            </
ends-with>
        </
zone>
        <
zone name="com.tumblr.themes.syntax.block.close">
            <
starts-with>
                <
expression>(\{/)block:([a-zA-Z0-9_]*)</expression>
                <
capture number="1" name="com.tumblr.themes.syntax.block.punctuation.begin"/>
                <
capture number="2" name="com.tumblr.themes.syntax.block.name"/>
            </
starts-with>
            <
ends-with>
                <
expression>(\})</expression>
                <
capture number="1" name="com.tumblr.themes.syntax.block.punctuation.definition.end"/>
            </
ends-with>
        </
zone>
    </
zones>
</
syntax

And the provider file. As you can expect, the first one works great but the second doesn’t.

<?xml version="1.0" encoding="UTF-8"?>

<codesense>
    <
provider>
        <
selector>*</selector>
        <
completions>com.tumblr.themes.set.blocks</completions>
        <
complete-match capture="0">[A-Za-z_{][A-Za-z0-9_:]*</complete-match>
    </
provider>
    
    <
provider>
        <--<
selector>tumblr.block:capture(name)</selector>
        <
completions>com.tumblr.themes.set.${name}</completions>-->
        <
selector>tumblr.block</selector>
        <
completions>com.tumblr.themes.set.likes</completions>
        <
complete-match capture="0">[A-Za-z_{][A-Za-z0-9_]*</complete-match>
    </
provider>
</
codesense


Thanks

Profile
 
 
Posted: 14 March 2010 05:57 PM   [ Ignore ]   [ # 1 ]
Moderator
RankRankRankRank
Total Posts:  1249
Joined  2008-10-28

Just a quick note: I don’t have time to try and debug this myself right now, but the best place to find helpful Sugar-smart people is in IRC:

http://wiki.macrabbit.com/index/IRC/

Additionally, you might want to take a peek at the ExpressionEngine.sugar, which uses a very similar syntax to Tumblr it looks like (although the EE sugar has a bunch of extraneous junk in its codesense):

http://github.com/anthonyshort/expressionengine.sugar

 Signature 

Ian Beck
MacRabbit Support

Follow us on Twitter, or try my custom themes: Quiet Light & Earthworm

Profile
 
 
Posted: 14 March 2010 06:31 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  3
Joined  2010-03-14

Thanks for your reply.

Tried IRC, but maybe due to timezomes I didn’t manage to connect when there was someone live.

I’m digging into EE and will try to understand a bit dipper how sugar works. Thanks

Profile
 
 
Posted: 20 April 2010 12:47 PM   [ Ignore ]   [ # 3 ]
Member
RankRankRank
Total Posts:  76
Joined  2008-11-04

Erm, I didn’t know you were building this one, I’ve got a tumblr sugar almost 100% finished. http://anthonyshort.com.au/post/532948712/tumblr-sugar. It’s got a fudge-load of snippets and the code complete for every tag.

It’s up on github as well http://github.com/anthonyshort/tumblr.sugar. Have you got your sugar anywhere? Maybe we could merge efforts on this one.

Profile
 
 
Posted: 06 June 2010 10:07 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  3
Joined  2010-03-14

Sorry for the late answer.
My plugin is neither source controlled nor available online. Honnestly digging into your files, you went way further than I did.

I downloaded your plugin, and I can easily see the new actions items. But they are all disabled. Can’t use any of them.
Reading your languages.xml file, I saw that my file should be .tumblr, but that didn’t change anything.

How am I supposed to use it?

Profile