Cell Highlighter
A VS Code extension for cell visualization and code sectioning, with Julia-specific CodeLens and execution integration.
[!NOTE]
As of version 1.0.0, this extension has been renamed from Julia Cell Highlighter to Cell Highlighter and requires VS Code 1.92.0 or later.
Existing juliaCellHighlighter.* settings are migrated automatically to cellHighlighter.* when the extension activates. Explicit values are moved at their original VS Code configuration scope, including language-specific overrides, and the old values are removed after migration.
The default focusCell.excludePatterns list is now empty. To restore the previous default exclusions for src, test, deps, and docs, add this line to settings.json:
"cellHighlighter.focusCell.excludePatterns": ["**/src/**", "**/test/**", "**/deps/**", "**/docs/**"]
Cell
The visual system has two independent cell layers:
focusCell: follows the cursor and highlights the currently focused cell. Julia CodeLens and Run Cell use this layer's delimiters.
guideCell: stays visible independently of the cursor. By default it draws only a top border, which replaces the former separator-line feature.
Each layer can use its own delimiter regexes, or follow the other layer's effective delimiters. By default, guideCell follows focusCell:
"cellHighlighter.focusCell.delimiters": ["^##(?!#)", "^#%%", "^#\\s+%%"],
"cellHighlighter.guideCell.delimiters": "followFocusCell"
The relationship can be reversed when the guide layer is the delimiter source:
"cellHighlighter.focusCell.delimiters": "followGuideCell",
"cellHighlighter.guideCell.delimiters": ["^##(?!#)"]
Or the two layers can remain fully independent, for example executable Julia cells using #%% while ## is only a persistent visual chapter boundary:
"cellHighlighter.focusCell.delimiters": ["^#%%"],
"cellHighlighter.guideCell.delimiters": ["^##(?!#)"]
Only one layer may follow the other. Configuring focusCell.delimiters as "followGuideCell" and guideCell.delimiters as "followFocusCell" at the same time is invalid and temporarily falls back to the built-in delimiter regexes until the cycle is fixed. The layers may overlap; when both style the same boundary, focusCell has visual priority while non-conflicting guide borders remain visible.
Language Scope
Both visual layers are language-independent internally. The focus layer remains Julia-only by default for backward compatibility, and the guide layer follows it:
"cellHighlighter.focusCell.languages": ["julia"],
"cellHighlighter.guideCell.languages": "followFocusCell"
Either layer may follow the other, but they cannot follow each other at the same time:
"cellHighlighter.focusCell.languages": "followGuideCell",
"cellHighlighter.guideCell.languages": ["julia", "latex"]
Use "*" to enable a layer for every language:
"cellHighlighter.focusCell.languages": ["*"],
"cellHighlighter.guideCell.languages": "followFocusCell"
Delimiter and visual settings are language-overridable, so VS Code language-specific settings can define different rules without plugin-specific language maps:
"cellHighlighter.focusCell.languages": ["*"],
"cellHighlighter.guideCell.languages": "followFocusCell",
"[julia]": {
"cellHighlighter.focusCell.delimiters": ["^#%%"],
"cellHighlighter.guideCell.delimiters": ["^##(?!#)"]
},
"[markdown]": {
"cellHighlighter.focusCell.delimiters": ["^<!--\\s*%%.*-->\\s*$"],
"cellHighlighter.guideCell.delimiters": ["^#{1,6}\\s+"]
}
CodeLens, Run Cell, Run Cell and Move, and Run Current File remain Julia-only integration features.
Julia Execution
Cell Highlighter provides CodeLens actions for individual cells and a separate command for running the entire active buffer.
Run Cell (CodeLens)
CodeLens actions can appear above non-empty focusCell delimiter lines:
always (default): show Run Cell and Run Cell and Move for every executable cell
current: show the actions only for the cell containing the cursor
never: hide all Cell Highlighter CodeLens actions
Configure this behavior with cellHighlighter.codeLensMode.
The execution backend is controlled by cellHighlighter.juliaExecutionBackend:
auto (default): use the Julia extension when its execution command is available; otherwise fall back to a persistent terminal Julia REPL
julia: execute through the Julia extension
terminal: execute through a persistent terminal Julia REPL, with one session per workspace folder or standalone-file directory
Cell boundaries always come from focusCell.delimiters, and the exact resulting range is sent to the selected backend. The Julia extension acts only as an execution transport and does not reinterpret the cell boundary. Empty cells receive no CodeLens actions and are never replaced by a neighboring cell.
Run Current File
Run the full active Julia buffer from either location:
- Command palette:
Cell Highlighter: Run Current File
- Editor title: enable the optional
▷ button with cellHighlighter.showRunFileButton
Run Current File uses the terminal backend to execute the active buffer, including unsaved changes, while preserving the document path as Julia source context. It starts or reuses the appropriate integrated Julia REPL automatically.
Settings
Full key format: cellHighlighter.<setting>.
| Setting |
Default |
Description |
focusCell.enabled |
true |
Enable the cursor-following focus cell visual layer. |
focusCell.languages |
["julia"] |
Languages where focus cells are enabled, or followGuideCell; use ["*"] for all languages. |
focusCell.delimiters |
Julia defaults |
Regexes that define focus cell and Julia Run Cell boundaries, or followGuideCell. |
focusCell.backgroundColor |
rgba(100, 150, 255, 0.04) |
Focus cell background. Empty or transparent disables it. |
focusCell.borderColor |
rgba(100, 150, 255, 0.6) |
Focus cell border color. |
focusCell.topBorderWidth |
2px |
Focus cell top border width. |
focusCell.bottomBorderWidth |
1px |
Focus cell bottom border width. |
focusCell.excludePatterns |
[] |
Paths excluded from focus visualization and Julia CodeLens. |
focusCell.includeDelimiterLine |
true |
Include the delimiter line in the focus range. A cursor on a delimiter follows this setting: true focuses the following cell, false the preceding cell. |
focusCell.multiCursorMode |
primary |
primary or union. |
guideCell.enabled |
true |
Enable the persistent guide cell visual layer. |
guideCell.languages |
followFocusCell |
Languages where guide cells are enabled, or follow the resolved focus languages; use ["*"] for all languages. |
guideCell.delimiters |
followFocusCell |
Regexes that define persistent guide cell boundaries, or follow the resolved focus delimiters. |
guideCell.backgroundColor |
empty |
Guide cell background. Empty or transparent disables it. |
guideCell.borderColor |
#ffffff |
Guide cell border color. |
guideCell.topBorderWidth |
1px |
Top border width at explicit guide delimiters. |
guideCell.bottomBorderWidth |
0 |
Guide cell bottom border width. |
guideCell.excludePatterns |
[] |
Paths excluded from guide visualization. |
codeLensMode |
always |
always, current, or never. |
juliaExecutionBackend |
auto |
auto, julia, or terminal. |
juliaExecutablePath |
julia |
Julia executable for the terminal backend. |
showRunFileButton |
false |
Show Run Current File in the editor title area. |
Exclusion patterns use glob syntax, including *, ?, **, character classes such as [0-9], and brace alternatives such as {src,test}.
Commands
- Toggle focus cell:
Ctrl+Shift+H (Windows/Linux) / Cmd+Shift+H (macOS)
- Run Current File: command palette, or optional editor-title button
License
MIT