Only syntax highlight after period
-
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!
-
@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. -
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
-
@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.
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