#1521 Discrepancies in Sub Styles API

Bug
closed-fixed
scintilla (297)
5
2013-09-09
2013-09-04
No

There are a couple of discrepancies between keywords handling in Sub Styles API and in regular API:

SCI_SETIDENTIFIERS only accepts space separated list of keywords, while SCI_SETKEYWORDS accepts keywords separated by spaces, tabs and new line characters ('\n', '\r').

SCI_SETIDENTIFIERS does not support specifying prefix keywords (i.e. '^SCI_'), while SCI_SETKEYWORDS supports them.

These issues are actually a limitation of underlying support classes from SubStyles.h file, which should be fixed so that they provide the same level of features like the WordList class.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2013-09-05

    Fix to allow other whitespace separators committed as [870221] (edit: fixed commit reference).

    I think prefix keywords were a mistake and would prefer to just document this difference from SCI_SETKEYWORDS. Its better to collect all the possible SCI_* identifiers so that you'll see a lack of colour change when misspelling one.

     

    Related

    Commit: [870221]


    Last edit: Neil Hodgson 2013-09-05
  • Marko Njezic

    Marko Njezic - 2013-09-06

    Although I don't have any particular opinion regarding prefix keywords, writing them off simply as implementation difference seems like taking the easy way out. Not to mention that it is different than your usual stance regarding interface consistency and backwards compatibility.

    Anyway, I wrote '^SCI_' just as an example since sub styles are currently only implemented in CPP lexer. Much better example for prefix keywords would be CSS vendor prefixes, which are volatile by nature. I doubt that anyone would spend time trying to list all CSS directives that also have vendor specific versions with prefixes in order to have them highlighted. Not to mention that CSS lexer is another perfect candidate for sub styles as it would be very nice to be able to have those vendor prefixes highlighted differently from each other.

     
  • Neil Hodgson

    Neil Hodgson - 2013-09-07

    Updated the documentation. The documentation for SCI_SETKEYWORDS doesn't mention prefix keywords. If there is real demand for prefix keywords then this can be added in WordClassifier without altering SCI_SETIDENTIFIERS or ILexerWithSubStyles::SetIdentifiers.

     
  • Marko Njezic

    Marko Njezic - 2013-09-07

    The documentation for SCI_SETKEYWORDS doesn't also mention that you can use abbreviated keywords in SQL lexer, but you can use them there.

    As far as demand for prefix keywords is concerned, SciTE has prefix keywords defined for CSS lexer for exactly the same purpose like I mentioned in my previous message (vendor prefixes).

    Another real world usage of prefix keywords are HTML 5 custom data attributes ( http://www.w3.org/html/wg/drafts/html/master/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes ). There's no list of such attributes, as you can basically prefix anything. Using sub styles API to highlight them differently would therefore be impossible. Oh, and SciTE does support them as they are defined in properties file for HTML lexer.

     
  • Neil Hodgson

    Neil Hodgson - 2013-09-09

    Closing as implementation matches documentation. If prefix keywords are wanted then there should be a feature request.

     
  • Neil Hodgson

    Neil Hodgson - 2013-09-09
    • labels: --> scintilla
    • status: open --> closed-fixed
    • assigned_to: Neil Hodgson
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks