We’re using the PythonNETParser alongside PythonNET to provide a editor (DebugCodeEdit) in our application.
Are we able to pass in specific keywords that we want highlighted? Similar to how Python keywords are highlighted blue.
Also I’ve noticed the PythonParserEmbedded has a lot more syntax highlighting based on the parsed token’s datatype. I haven’t been able to get the PythonParserEmbedded to work well with the PythonNET bindings to our .NET code with CodeCompletion. Do you know if this is possible at all?
Could you please specify which keywords you need to highlight? We wrote PythonNetParser ourselves, so it should be possible to extend it to highlight extra keywords (but they still need to be treated as identifiers, right)?
PythonParserEmbedded - this one is based on LSP parser technology where code completion is provided by an LSP provider (Python itself, in this case). For it to provide code completion for your .NET objects, it needs to know about them (and for that, we need to generate Python interface files containing all properties/methods of your .NET objects). We’ve done it for TypeScript, so it might be possible to do the same for Python; however this has not been implemented yet.
We use TextMate-based syntax highlighting for LSP parsers, which works similarly to Visual Studio code.
We have added two GlobalItems to our script which access our .NET objects named “plates” and “liquids”.
Ideally it would be nice if we could get these highlighting blue e.g. ‘pass’ keyword or ‘def’. So maybe a function or property to add specific keywords with specific colours?
Thanks for that info! The PythonNETParser does most of what we need but it would also be nice if it was capable of highlighting variables inside of f-strings. At the moment it’s all the same colour for anything inside the quote characters. This is how VSCode (I assume the TextMate highlighting you mentioned) handles these.