Code Editor

Edit code with syntax highlighting, inline diffs, grammar check, AI selection actions, and LaTeX autocomplete.

Omnilib's Code Editor provides a powerful environment for writing and editing code. With automatic language detection, syntax highlighting, inline AI edits, grammar checking, and a selection action toolbar, it's designed for both code and writing-heavy files.

Overview

The Code Editor offers:

  • Syntax highlighting — Automatic language detection from file extension
  • Theme support — Light, Dark, and Omni color schemes
  • Inline diff — Accept or reject AI-proposed edits line by line
  • Grammar check — Wavy underlines for prose errors with explanations
  • Selection action toolbar — AI actions on any selection
  • LaTeX autocomplete — Commands, environments, citations, and references
  • Voice input — Dictate code comments and prose (desktop only)
  • Edit/View mode — Toggle between editing and read-only
  • Undo/Redo — Full history support

Getting Started

Opening a Code File

Click any code file in the sidebar:

  • .js, .ts, .jsx, .tsx — JavaScript/TypeScript
  • .py — Python
  • .go, .rs — Go, Rust
  • .html, .css, .scss — Web
  • And 50+ more languages

Edit vs View Mode

Files open in view mode by default. Click the pencil icon in the toolbar to enter edit mode.

Inline Diff

When the AI proposes edits to your code, they appear as an inline diff directly in the editor:

  • Added lines — Shown in green
  • Removed lines — Shown in red
  • Unchanged lines — Normal display

Each changed region has Accept and Reject buttons in the gutter. Click Accept to apply the change or Reject to dismiss it. Use Accept All and Reject All in the toolbar to handle all pending changes at once.

The inline diff is non-destructive — your original code is preserved until you accept a change.

Grammar Check

The grammar check extension analyzes prose content in comments, strings, and Markdown-adjacent files. Issues are marked with wavy underlines:

ColorSeverity
Red wavyGrammar errors
Amber wavyStyle suggestions
Blue wavyConvention notes

Hover over any underlined text to see an explanation of the issue and the suggested correction. Click Accept in the hover tooltip to apply the fix, or Dismiss to ignore it.

Navigate between issues with the Previous and Next buttons in the toolbar (or the grammar check panel if open).

Selection Action Toolbar

Select any text in the editor to reveal the selection action toolbar above your selection:

ActionWhat it does
Add as ContextSends the selection to the AI as context
ExplainAI explains the selected code or text
ImproveAI rewrites the selection as an inline edit
CommentAdds a review comment anchored to the selection

The Improve action uses the inline diff system — the suggestion appears in the editor as a diff for you to accept or reject.

LaTeX Autocomplete

When editing .tex files, the code editor provides rich autocomplete for LaTeX:

  • Type \ to trigger command completions
  • Type \begin{ to see available environment names
  • Type \cite{ to see all entries from .bib files in your project
  • Type \ref{ to see all labels defined in your project
  • Type \include{ or \input{ to see available .tex files
  • Type \usepackage{ to see known package names

Select a completion and press Tab or Enter to insert it.

Voice Input

Desktop only.

Press and hold Cmd+R to dictate. Speech is transcribed and inserted at the cursor position when you release the key. Voice input works well for writing code comments and docstrings.

.gitignore Quick Actions

Right-click any file or folder in the project sidebar while the code editor is active to see .gitignore quick actions:

  • Add to .gitignore — Appends the selected file or pattern to .gitignore
  • Show ignored files — Toggles display of ignored files in the sidebar

If no .gitignore exists in the project root, the action creates one automatically.

Language Support

Automatic Detection

ExtensionsLanguage
.js, .jsx, .mjs, .cjsJavaScript
.ts, .tsxTypeScript
.py, .pywPython
.rsRust
.goGo
.htmlHTML
.css, .scss, .lessCSS
.json, .yaml, .ymlData
.md, .mdxMarkdown
.sqlSQL
.texLaTeX

And many more.

Themes

The editor adapts to your chosen Omnilib theme:

  • Light — Clean white background, GitHub-inspired colors
  • Dark — Dark background, GitHub Dark-inspired colors
  • Omni — Warm sepia tones with a unique palette

Theme changes apply instantly across all open editors.

Toolbar

ButtonAction
UndoRevert last change
RedoRestore undone change
SaveSave current file
Edit ToggleSwitch edit/view mode
Accept AllAccept all pending inline diffs
Reject AllReject all pending inline diffs

Keyboard Shortcuts

Editing

ActionMacWindows
UndoCmd+ZCtrl+Z
RedoCmd+Shift+ZCtrl+Shift+Z
SaveCmd+SCtrl+S
Voice inputCmd+R (hold)
ActionMacWindows
Start of lineCmd+LeftHome
End of lineCmd+RightEnd
Start of fileCmd+UpCtrl+Home
End of fileCmd+DownCtrl+End

Troubleshooting

Syntax Not Highlighted

  • Check that the file extension is correct.
  • Rename to a standard extension if needed.

Can't Edit File

  • Ensure you're in edit mode (pencil icon in toolbar).
  • Check file permissions.

Inline Diff Not Appearing

  • Inline diffs require an active AI session with the current file open.
  • Ask the AI to make a specific change to trigger the diff.

LaTeX Autocomplete Not Showing

  • Ensure the file has a .tex extension.
  • Check that your .bib files are in the same project for citation completions.