Open sirpercival opened 9 years ago
Sure it can, want to give it a try ?
You can take a look at: https://github.com/spyder-ide/spyder/blob/master/spyderlib/widgets/sourcecode/syntaxhighlighters.py
@ccordoba12 Was not this supposed to guess automatically with the work of PR #97 in bitbucket?
I guess that the pygment definitions are not in pygments itself but provided by kivy, so spyder doesn't know abut them.
The link to the spyder syntaxhighlighters.py is broken
They moved it from sourcecode to utils
https://github.com/spyder-ide/spyder/blob/master/spyderlib/utils/syntaxhighlighters.py
I posted a question to StackOverflow: http://stackoverflow.com/questions/33462949/how-is-syntaxhighlighters-py-called-by-spyder-ide
Hi @cooknl, as @Nodd pointed out, pygments does not natively support kivy highlighting (Look a t the available lexers here)
You could very easily add this ability by modifying the Generic Pygments Highlighter located here
Now you would need to add the kivy somewhere in spyder codebase, for now it could be in syntaxhighlighters.py
, unless @nodd or @ccordoba12 have a better place for it, some file that stores pygments specific lexers?
And then you could update this so that the if has an extra condition where it fins if it is a .kv file and based on that assigns the correct custom lexer.
Cheers
Instead of including the file in spyder, could we simply try to import it and use it if it is found ?
Sure, thats an option as well, not sure if kivy isinstalled the usual way (as a python package though...)
Or we could just submit it to pygments in bitbucket as a request?
kivy is used as import kivy
, so import kivy.extras.highlight
in a try/except block should do the trick.
Kivy has a pygments-based lexer: https://github.com/kivy/kivy/blob/master/kivy/extras/highlight.py
Can this be included in syntaxhighlighters.py?