Skip to content

Commit 69bf578

Browse files
authored
fix(UI-1775): refactor code editor to solve syntax highlight bug (#1299)
## Description ## Summary **Fix:** Correct Python syntax highlighting (incl. f-strings) in Monaco. **Approach:** Integrate TextMate grammar using monaco-editor-textmate + onigasm. **Context** Python strings/f-strings were tokenized incorrectly, producing broken highlighting. Addresses UI-1775 by wiring a proper Python TextMate grammar. **Changes** **Editor integration:** Loads TextMate grammar only for Python files; editor stays read-only until grammar init completes and shows a short loader. Binary asset: Adds a WASM file; Performance: One-time load on first Python editor mount; then browser-cached. ## Linear Ticket https://linear.app/autokitteh/issue/UI-1775/syntax-coloring-with-comments-in-the-editor ## What type of PR is this? (check all applicable) - [ ] 💡 (feat) - A new feature (non-breaking change which adds functionality) - [ ] 🔄 (refactor) - Code Refactoring - A code change that neither fixes a bug nor adds a feature - [x] 🐞 (fix) - Bug Fix (non-breaking change which fixes an issue) - [ ] 🏎 (perf) - Optimization - [ ] 📄 (docs) - Documentation - Documentation only changes - [ ] 📄 (test) - Tests - Adding missing tests or correcting existing tests - [ ] 🎨 (style) - Styles - Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) - [ ] ⚙️ (ci) - Continuous Integrations - Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) - [ ] ☑️ (chore) - Chores - Other changes that don't modify src or test files - [ ] ↩️ (revert) - Reverts - Reverts a previous commit(s). <!-- For a timely review/response, please avoid force-pushing additional commits if your PR already received reviews or comments. Before submitting a Pull Request, please ensure you've done the following: - 👷‍♀️ Create small PRs. In most cases this will be possible. - ✅ Provide tests for your changes. - 📝 Use descriptive commit messages (as described below). - 📗 Update any related documentation and include any relevant screenshots. Commit Message Structure (all lower-case): <type>(optional ticket number): <description> [optional body] -->
1 parent 8cd13d2 commit 69bf578

File tree

7 files changed

+4335
-26
lines changed

7 files changed

+4335
-26
lines changed

package-lock.json

Lines changed: 40 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@
6060
"jszip": "^3.10.1",
6161
"lodash": "^4.17.21",
6262
"mermaid": "^11.8.1",
63+
"monaco-editor-textmate": "^4.0.0",
64+
"monaco-textmate": "^3.0.1",
6365
"motion": "^12.4.2",
66+
"onigasm": "^2.2.5",
6467
"pako": "^2.1.0",
6568
"psl": "^1.15.0",
6669
"randomatic": "^3.1.1",

0 commit comments

Comments
 (0)