feat(dialog-sdk): add Python syntax highlighter and runtime language swapping#56
Merged
Merged
Conversation
…swapping Add Python syntax highlighting for code editor widgets and support runtime language swapping when the plugin changes codeLanguage mid-session. Contents: - PythonSyntaxHighlighter: keywords, builtins, # comments, triple-quoted multiline strings (same pattern as LuaSyntaxHighlighter) - widget_binding: detect when codeLanguage changes, delete the old QSyntaxHighlighter, install the new one matching the requested language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The Lua Editor toolbox is being extended to support Python as an alternative scripting language. The dialog engine needs to know how to highlight Python code and how to swap highlighters when the user changes language mid-session (e.g. switching a "Language" combo box from Lua to Python).
Summary
PythonSyntaxHighlighterfollowing the same pattern asLuaSyntaxHighlighter: keywords, builtins,#comments, triple-quoted multiline stringswidget_binding.cpp: detect whencodeLanguagechanges between ticks, delete the oldQSyntaxHighlighter, install the one matching the requested languageTest plan
pj_plugins— no compile errorssetCodeLanguage("editor", "python")— Python keywords highlighted"lua"to"python"at runtime — highlighter swaps correctly"lua"— Lua highlighting still works as before