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.