Community
    • Login

    C++11 raw string literal syntax hightlighting

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 112 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Lionel LagardeL
      Lionel Lagarde
      last edited by

      I just started using C++11 raw string literals and I was surprised notepad++ does not highlight them as strings.
      Example: R"(my string, no need to double the backslash)"
      I know it works fine for python.
      Is it true or something went wrong the last time I updated notepad++ (it already happen, my global styles are modified and the update process failed to merge the two styles)?

      PeterJonesP 1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @Lionel Lagarde
        last edited by

        @Lionel-Lagarde said in C++11 raw string literal syntax hightlighting:

        Is it true or something went wrong the last time I updated notepad++ (it already happen, my global styles are modified and the update process failed to merge the two styles)?

        Nothing went wrong. Just nobody has pointed out to the developer that the entry for name="STRINGRAW" styleID="20" should be added to the stylers/themes.

        If you want to add it yourself,

        1. Exit Notepad++ app completely
        2. If you are using a theme other than stylers.xml, check if you have a copy in %AppData%\Notepad++\themes\ – if not, copy from C:\Program Files\Notepad++\themes\ to the AppData path (create the themes folder if needed)
          • you don’t want to edit the copy in the installation directory, because your next update will just lose that
        3. Open Notepad++, and edit either %AppData%\Notepad++\stylers.xml or %AppData%\Notepad++\themes\<YourThemeHere>.xml
        4. Search for name="cpp"
        5. Add in the following line, picking whatever color you want (maybe something similar to the STRING or CHARACTER color, but it’s up to you; my example was based on the same as the default stylers.xml STRING color, but added slightly more red to the grey tint):
          <WordsStyle name="STRINGRAW" styleID="20" fgColor="A08080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize=""></WordsStyle>
          

        With that, I can get Notepad++ to highlight the raw string literal:
        ac9d31fb-d5e5-459a-82ad-34b57b240c3b-image.png

        If someone (like you) were to put in an official feature request (checking if one exists first; if it already does, upvote it, and put a link here), it wouldn’t be hard for a interested contributor to work up a quick PR to add that missing style to the stylers/themes for a future version of Notepad++. (And with N++ now automatically adding missing styles to your local themes the next time you update, it would be made available to everyone.)

        1 Reply Last reply Reply Quote 0
        • Lionel LagardeL
          Lionel Lagarde
          last edited by

          thank you

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors