• Login
Community
  • Login

Only syntax highlight after period

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 1.2k 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.
  • P
    pieterjanvc
    last edited by Jun 9, 2018, 6:51 PM

    Hi,

    I was wondering how I can setup my user defined language to have some keywords only highlighting when they are prefixed by a period (like when you’re calling an attribute of something).

    Example:

    MyObject.length --> ‘length’ should be highlighted

    length = 5 --> ‘length’ should NOT be highlighted

    Thanks for any input!

    1 Reply Last reply Reply Quote 0
    • J
      Jim Dailey
      last edited by Jun 11, 2018, 4:33 PM

      @pieterjanvc
      Under Language->Define your language … click on the Keywords Lists tab. In the 1st group, click on Prefix mode and then enter a period in the text box. Use the Styler button to choose the way you want the text to look.

      1 Reply Last reply Reply Quote 1
      • P
        pieterjanvc
        last edited by Jun 11, 2018, 9:43 PM

        Hi,

        Thank you for the reply, but unfortunately, what you suggest does’t work for the following reasons:

        • Using the period as a prefix for highlighting only works if it’s preceded by a space (which is useless in the code). ‘MyObject .length’ will highlight, but ‘MyObject.length’ won’t
        • If you use it as a prefix, you can’t set it as a deliminator anymore so anything after a period will highlight, not just the words you want

        Any other ideas?

        PJ

        1 Reply Last reply Reply Quote 0
        • J
          Jim Dailey
          last edited by Jun 12, 2018, 3:49 PM

          @pieterjanvc
          Last thing I can think of that may (but probably will not) work for you is to define a Delimiter style having:

          Open: .
          Escape:
          Close: ((EOL))
          

          This will highlight every period to the end of the line.

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