[quote=“quodlibet”]
If you still haven’t worked this out, you need to escape the “less than” sign. E.g., (?<=\W) should read (?<=\W)
Alex[/quote]
Thanks Alex. I caught that
[quote=“quodlibet”]
If you still haven’t worked this out, you need to escape the “less than” sign. E.g., (?<=\W) should read (?<=\W)
Alex[/quote]
Thanks Alex. I caught that
(Just an update). I believe I’ve finally got this sussed with the code below, placed before ‘meta.function-call.python’
What I wanted to do was scope specific method-names, but only if they are preceded by a dot. ‘meta.function-call’ kept interfering, grabbing any remaining text on the line and, therefore, applying one colour. My previous attempt was working, but the brackets and arguments (following my named-methods) remained as ‘source.python’.
My code captures general methods, but only if preceded by a dot. It colours the method-name, ignoring any preceding text. It also works with nested function/method calls. [Part of the solution is to name the method’s arguments ‘meta.method.call.arguments.python’, but do nothing with them - but perhaps I can colour these as well.]
I copied this code and substituted all the ST-API method calls, and also gave a different name to the brackets ( ) - so now I can colour-code all bracket pairs, whe’hay
I believe I should be able to modify ‘meta.function-call’ with code similar to this, so that it won’t misbehave at all.
<dict>
<key>begin</key>
<string>(?:[a-zA-Z_][a-zA-Z0-9_]*\.)*(?<=\.)([a-zA-z_][a-zA-Z0-9_]*)\s*(\()</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.method.call.python</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.arguments.begin.python</string>
</dict>
</dict>
<key>end</key>
<string>(\))</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.arguments.end.python</string>
</dict>
</dict>
<key>contentName</key>
<string>meta.method.call.arguments.python</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#keyword_arguments</string>
</dict>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>