Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Single Quote string for Python

    Help wanted · · · – – – · · ·
    3
    4
    806
    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 Haw
      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 Sumner 1 Reply Last reply Reply Quote 0
      • Scott Sumner
        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
        • PeterJones
          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 Haw
            Richard Haw last edited by

            Thanks! MINDBLOWN :O :O :O

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors