Community
    • Login

    Single Quote string for Python

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 1.4k Views 3 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            Richard Haw
            last edited by

            Thanks! MINDBLOWN :O :O :O

            1 Reply Last reply Reply Quote 2

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors