Community
    • Login

    Single Quote string for Python

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 1.1k 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.
    • Richard HawR
      Richard Haw
      last edited by

      Hello, is there a way I can hack functionList so that I can have single-quoted string literals highlight in my editor? I tried (?s:\x27.*?\x27) but it doesnt seem to work. thanks!

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS
        Scott Sumner @Richard Haw
        last edited by

        @Richard-Haw

        I’m not sure what kind of highlighting you are looking for. The Python lexer (not the Function List) will highlight a single-quoted Python string when you type the closing single-quote, example:

        Imgur

        1 Reply Last reply Reply Quote 2
        • PeterJonesP
          PeterJones
          last edited by PeterJones

          @Richard-Haw,

          Further to what @Scott-Sumner said: When the Python Lexer is selected (either by automatic filename-extension detection when you load a .py file, or by manually selecting Language > Python or Language > P > Python), if you want single-quoted literals to be highlighted differently than double-quoted, you can change the Settings > Style Configurator > Python settings: the Style: STRING will define what highlighting gets applied to "double-quoted" strings, and Style: CHARACTER will define what highlighting gets applied to 'single-quoted' literals. By default, both those have the same color (in the “Default (stylers.xml)” theme), so if you want to distinguish those, you will have to make a change.

          For example, here I show what happens when you change CHARACTER foreground to RED instead of GREY:

          Imgur

          1 Reply Last reply Reply Quote 3
          • Richard HawR
            Richard Haw
            last edited by

            Thanks! MINDBLOWN :O :O :O

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