capncook
capncook

Reputation: 1

How is syntaxhighlighters.py called by Spyder IDE?

For Spyder IDE, is syntaxhighlighters.py compiled into spyder.exe, or is it called directly from spyderlib?

I see on GitHub (https://github.com/spyder-ide/spyder/blob/master/spyderlib/utils/syntaxhighlighters.py) and several other sites that syntaxhighlighters.py is included in the Spyder package. What's not clear is how it is used by Spyder. Is it just part of the source code that is compiled into spyder.exe?

The desired end state is to be able to update syntaxhighlighters.py with Kivy syntax highlighting.

Kivy has a Pygments lexer for kv language, available through GitHub, https://github.com/kivy/kivy/blob/master/kivy/extras/highlight.py

I'm trying to figure out if I can just try to modify Spyder's syntaxhighlighters.py, using Kivy's highlight.py, or if I need to somehow re-compile Spyder to incorporate the changes to syntaxhighlighters.py.

Thank you.

Upvotes: 0

Views: 446

Answers (1)

goanpeca
goanpeca

Reputation: 546

Pygments does not natively support kivy highlighting (yet), (Look a 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.

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

Upvotes: 1

Related Questions