I'm trying to tweak the Python.tmLanguage file so that I can at least show the API methods in a different colour. I tried modifying
- Code: Select all
<string>\b(global|window|etc)\b</string> <<-- add API terms here.
It doesn't colour-code following a dot - any idea how I can modify the expression to accept a preceding dot?
But, more importantly, it must pick up words before mine. That is, a word like 'get' will be found before 'get_clipboard', so my colour never appears.
Perhaps if I create a new scope/category entirely, then it will pick up my words. Can someone offer a few pointers in the right direction for me? I realise that I would also need to modify my chosen theme file as well.
I can't really create a new syntax file, because it's still a standard '.py' file.
An alternative approach I would like advice on: I could use 'on_modified', check it's a Python file, check it contains 'import sublime', find the API methods, use add-regions to re-insert these words with a specified scope. This would give me more control over the scope, and I wouldn't have to modify the language and theme files.
I welcome suggestions and advice