Repository navigation
Conversation
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/language-detect.test.ts (1)
23-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the
.latexmapping.
language-detect.tsadds.latexsupport, but this test block does not verify it. Add an assertion such asdetectLanguage('paper/main.latex')→latex.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6d826717-9b84-4e15-be5d-62fcba6ab989
📒 Files selected for processing (9)
src/renderer/src/lib/language-detect.test.tssrc/renderer/src/lib/language-detect.tssrc/renderer/src/lib/monaco-languages/register-latex.test.tssrc/renderer/src/lib/monaco-languages/register-latex.tssrc/renderer/src/lib/monaco-languages/register-matlab.test.tssrc/renderer/src/lib/monaco-languages/register-matlab.tssrc/renderer/src/lib/monaco-languages/textmate-grammars/matlab-LICENSE.txtsrc/renderer/src/lib/monaco-languages/textmate-grammars/matlab.tmLanguage.jsonsrc/renderer/src/lib/monaco-setup.ts
Wire .m files to a TextMate-backed matlab language (MathWorks grammar) and .tex/.ltx/.sty/.cls to a Monarch latex tokenizer for comments, commands, environments, and math. Update detectLanguage so the Monaco viewer picks these up instead of plaintext.
a3beca8 to
8d81891
Compare
[Low impact] The changes affect syntax coloring for a limited set of editor file types. The PR appears safe to merge, with two non-blocking highlighting issues worth fixing. FindingsSummaryAdds MATLAB highlighting through a vendored TextMate grammar and LaTeX highlighting through Monarch.
Acknowledgment: Tests and visual checks were not run; this checkout has no installed dependencies. Reviews (1) · Last reviewed commit: "feat(editor): syntax highlighting for MA..." · Reviewed by Greptile |
| configuration: matlabLanguageConfiguration, | ||
| loadGrammar: loadMatlabTextMateGrammar |
There was a problem hiding this comment.
MATLAB tokens remain uncolored
The registration passes TextMate names directly to Monaco. The grammar marks function as storage.type.function.matlab and numbers as constant.numeric.matlab, which the default editor themes do not color. These remain plain despite the new highlighting support.
Map these names to Monaco’s keyword and number tokens, as the other TextMate registrations do, and test the resulting colors.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| // \begin{env} / \end{env} | ||
| [ | ||
| /\\(begin|end)\s*\{[a-zA-Z*]+\}/, | ||
| { | ||
| cases: { | ||
| '@default': 'keyword' | ||
| } | ||
| } | ||
| ], | ||
| // Commands: \command, \command*, \\, and special single-char commands | ||
| [/\\(?:[a-zA-Z]+|[^a-zA-Z\s])/, 'keyword'], |
There was a problem hiding this comment.
Literal dollars change later colors
The rules read text inside \verb and verbatim as LaTeX syntax. For example, \verb|$HOME| starts inlineMathDollar, and a verbatim block containing $HOME does the same. Neither closing construct leaves that state, so ordinary text afterward stays colored as math until another dollar sign appears.
Add literal-text rules before the general command and environment rules. Test that text after each closing construct returns to normal colors.
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
bd50012c-1b0c-4039-878e-60448b8cb8d2
Files selected for processing: 7-
src/renderer/src/lib/monaco-languages/register-latex.test.tssrc/renderer/src/lib/monaco-languages/register-latex.tssrc/renderer/src/lib/monaco-languages/register-matlab.test.tssrc/renderer/src/lib/monaco-languages/register-matlab.tssrc/renderer/src/lib/monaco-setup.tssrc/shared/editor-language/editor-language-detect.test.tssrc/shared/editor-language/editor-language-detect.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
-
| { open: '{', close: '}' }, | ||
| { open: '[', close: ']' }, | ||
| { open: '(', close: ')' }, | ||
| { open: "'", close: "'" }, |
There was a problem hiding this comment.
Do not auto-close the MATLAB transpose operator.
When a user types A' at the end of a line, this pair can insert another ' and leave A''. In MATLAB, ' is an operator, so the inserted character changes the expression. Remove the single-quote auto-closing pair; keep string highlighting in the grammar. (code.visualstudio.com)
|
Thank you @innocarpe for this! We've shipped both languages as official plugins instead of building them into Orca, so they can be updated on their own: MATLAB Syntax and LaTeX Syntax. Your work is credited: you're a co-author of the MATLAB plugin commit. To install: Settings → Plugins → turn on plugins → search for it and install. It needs Orca 1.4.246 or newer (older versions show "Needs Orca 1.4.246"), because that's the first release where an enabled plugin syntax takes precedence over Orca's own mapping for these files. Closing this PR as superseded. If it falls short for you, please reopen and tell us what is missing. |
Highlights .m files with MathWorks' MATLAB TextMate grammar (BSD-2-Clause). Needs Orca 1.4.246, the first release where an enabled plugin syntax beats Orca's Objective-C mapping for .m. Covers the MATLAB half of stablyai/orca#10363 and replaces stablyai/orca#10371. Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
Summary
.mand.tex(plus common LaTeX family extensions) no longer open as flat plaintext.%), commands,\begin/\endenvironments, and math delimiters. Full VS Code LaTeX TextMate pulls many embedded language scopes; Monarch keeps the graph small while covering the reported need.detectLanguagemaps extensions so Monaco picks the new language ids.Notes
.mis also used by Objective-C; Orca never mapped it before (plaintext). This change maps.m→ MATLAB per the issue. We can add content-based sniffing later if Obj-C users need it.Test plan
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/monaco-languages/register-matlab.test.ts src/renderer/src/lib/monaco-languages/register-latex.test.ts src/renderer/src/lib/language-detect.test.ts(17 passed).mfile → keywords/comments/strings colored.texfile →%comments and\commandscoloredELI5
MATLAB (.m) and LaTeX (.tex) files opened as plain text with no coloring. They now get syntax highlighting so code and markup are easier to read in the editor.