Loading ...
Sorry, an error occurred while loading the content.

Help with whitespace in syntax file for LessCSS

Expand Messages
  • Leonard Ehrenfried
    Dear list, I m co-developing a syntax file for LessCSS[0]. LessCSS is a language that extends CSS with features like nesting and variables. Hence, the syntax
    Message 1 of 2 , Mar 6 6:51 AM
    • 0 Attachment
      Dear list,

      I'm co-developing a syntax file for LessCSS[0]. LessCSS is a language that extends CSS with features like nesting and variables. Hence, the syntax file uses many of the definition of the stock css.vim.


      My problem is that attribute values are not matched if they are directly preceded by a colon:

      ul{
      list-style-type: none;
      list-style-type:none; 
      }

      On the first line inside the braces 'none' is correctly highlighted but on the second line it is not. This however works with the standard CSS syntax file.

      I've wrecked my brain for weeks trying to find out where the problem is but I'm at my wit's end. Could a kind soul help me out here?

      Thanks
      Leonard

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Christian Brabandt
      ... I think, this question belongs to vim-use, since vim-dev is - and this is only my personal opinion - about developing Vim itself. Anyway, after fiddling
      Message 2 of 2 , Mar 6 8:11 AM
      • 0 Attachment
        On Tue, March 6, 2012 15:51, Leonard Ehrenfried wrote:
        > Dear list,
        >
        > I'm co-developing a syntax file for LessCSS[0]. LessCSS is a language that
        > extends CSS with features like nesting and variables. Hence, the syntax
        > file uses many of the definition of the stock css.vim.
        >
        > The file is on Github:
        > https://github.com/lenniboy/vim-less/blob/master/syntax/less.vim
        >
        > My problem is that attribute values are not matched if they are directly
        > preceded by a colon:
        >
        > ul{
        > list-style-type: none;
        > list-style-type:none;
        > }
        >
        > On the first line inside the braces 'none' is correctly highlighted but on
        > the second line it is not. This however works with the standard CSS syntax
        > file.
        >
        > I've wrecked my brain for weeks trying to find out where the problem is
        > but
        > I'm at my wit's end. Could a kind soul help me out here?

        I think, this question belongs to vim-use, since vim-dev is - and this
        is only my personal opinion - about developing Vim itself.

        Anyway, after fiddling around with your syntax file, I managed to
        get the cssCommonAttr matched by adding the lessVariableAssignment to

        syn region lessDefinition transparent matchgroup=cssBraces start='{'
        end='}'
        contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessVariableAssignment,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,@cssColors

        I think what happens was that in the lessDefinition you are giving
        priority to the cssPseudoClass and that prevents the
        lessVariableAssignment to match.

        Alternatively, you can remove the cssPseudoClass from your region
        definition, dependending on whether you want the none to
        match as lessVariableAssignment or as cssCommonAttr.

        regards,
        Christian

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.