Not signed in (Sign In)

Categories

Vanilla 1.1.1 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthordaryl
    • CommentTimeAug 15th 2007 edited
     permalink

    The “once” snippet for C++ appears to be broken. But upon inspection, it appears to be the way that intype deals with this particular case. The snippet is:
    { title: '#ifndef (Guard)' tab_trigger: 'once' scope: 'source.c, source.c++' content: '#ifndef __${1:FILENAME_HPP}__ #define __$1 __ $0 #endif' }
    The problem here is that where it’s supposed to mirror it you just get:
    #define __
    and nothing else. If you add spaces in the snippet around the second $1 then it works as expected, but with the spaces obviously.

    OK, as I was writing that I had an idea – “is there a particular space which makes it work, or both?”. I tried it with adding a space just before $1 and just after, and the results are:
    #define __ $1__ // Doesn't work #define __$1 __ // Does work
    So I guess the problem is that the snippet mirror code doesn’t realise that _ isn’t a number. (It doesn’t like letters directly after also.)

    Edit: as a temporary fix, I can have the second instance as
    #define __${1}__

  1.  permalink

    daryl: Yeah, you’re right. I’ve just added `number` token to the snippet parser, that fixed this bug. Thanx for the report.

    • CommentAuthorJack Legs
    • CommentTimeAug 16th 2007
     permalink

    On the other side, using a double underscore is not recommended.
    Here a modified version of this snippet:

    { title: '#ifndef (Guard)' tab_trigger: 'once' scope: 'source.c, source.c++' content: '#ifndef ${1:__}${2:FILENAME_HPP}$1 #define $1$2$1 $0 #endif' }

    • CommentAuthorJack Legs
    • CommentTimeAug 16th 2007
     permalink

    by convention, it’s reserved for system header files