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

[Feature Request] Support for semantic highlighting.

Expand Messages
  • Tianjiao Yin
    Hello all, Have plans to do a semantic highlighting support? For example, look at this cpp source code: #define SQR(i) ((i)*(i)) int sqr(int i) { return i * i;
    Message 1 of 2 , Mar 17, 2013
    View Source
    • 0 Attachment
      Hello all,

      Have plans to do a semantic highlighting support? For example, look at this cpp source code:

      #define SQR(i) ((i)*(i))
      int sqr(int i) { return i * i; }
      int main() {
      {
      class sqr{};
      sqr foo = sqr();
      }
      int (*bar)(int) = sqr;
      return bar(SQR(2));
      }

      SQR, sqr, sqr in scope and bar, are highlighted with different colors in KDevelop. However, in VIM, all these identifiers have same color. CMIIW, there is no way (include plugin) to do this in VIM. Would vim provide a API to color each identifier in the source code? So someone (maybe me) will write a vim plugin to parser the C++ code and help vim to highlight it.

      Regards,
      Tianjiao

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • ZyX
      ... There is a way, but it is too slow (define a big bunch of syntax rules that have %l/ %c and update them on newly added TextChanged/TextChangedI). You can
      Message 2 of 2 , Mar 26, 2013
      View Source
      • 0 Attachment
        воскресенье, 17 марта 2013 г., 16:48:13 UTC+4 пользователь Tianjiao Yin написал:
        > Hello all,
        >
        > Have plans to do a semantic highlighting support? For example, look at this cpp source code:
        >
        > #define SQR(i) ((i)*(i))
        > int sqr(int i) { return i * i; }
        > int main() {
        > {
        > class sqr{};
        > sqr foo = sqr();
        > }
        > int (*bar)(int) = sqr;
        > return bar(SQR(2));
        > }
        >
        > SQR, sqr, sqr in scope and bar, are highlighted with different colors in KDevelop. However, in VIM, all these identifiers have same color. CMIIW, there is no way (include plugin) to do this in VIM. Would vim provide a API to color each identifier in the source code? So someone (maybe me) will write a vim plugin to parser the C++ code and help vim to highlight it.
        >
        > Regards,
        > Tianjiao

        There is a way, but it is too slow (define a big bunch of syntax rules that have \%l/\%c and update them on newly added TextChanged/TextChangedI). You can write a plugin, but it will likely be too slow even if you use python bindings to speed things up. What you really request here is a different API for defining syntax elements, current one that allows only regular expressions for syntax definitions is not suitable for the job.

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.