Julia Cell Highlighter
A VS Code extension that highlights the current Julia code cell in .jl files and adds optional CodeLens actions for running cells.
[!NOTE]
For Julia extension users
Since version 1.178.0, the Julia extension already provides CodeLens run buttons. If you prefer to use only Julia's built-in buttons, add this to settings.json:
"juliaCellHighlighter.codeLensMode": "never"
For JETLS Client users
This extension also provides a Run Current File action. Add this to settings.json to show the run button in the editor title area:
"juliaCellHighlighter.showRunFileButton": true
After enabling it, a small run icon (▷) appears in the top-right editor title area. Clicking it starts (or reuses) a Julia REPL in the integrated terminal and runs the current file.
Features
- Custom cell highlight styling, including top border, background fill, and bottom border
- Independent delimiter separator lines
- Configurable cell delimiters via
juliaCellHighlighter.defaultDelimiters (not limited to ##, #%%, and # %%)
- Exclude patterns to control where highlighting and CodeLens are applied
Quick Start
- Install from the VS Code Marketplace.
- Open a
.jl file and add cell delimiters, for example:
## Cell 1
x = 1
## Cell 2
x + 1
The current cell is highlighted automatically as you move the cursor.
What Counts as a Cell
Delimiter rules are aligned with the Julia extension:
- If
julia.cellDelimiters is set, that value is used.
- Otherwise, built-in defaults are used:
##, #%%, # %%.
You can enable or disable built-in delimiters with juliaCellHighlighter.defaultDelimiters.
By default, the delimiter line is included in the highlighted range. When the cursor is on a delimiter line, the next cell is highlighted (if the delimiter is the last line, nothing is highlighted).
CodeLens (Run Cell)
When enabled, CodeLens buttons appear above delimiter lines:
- Run Cell
- Run Cell and Move (runs the current cell, then moves to the next one after a short delay)
Execution backend is configurable:
auto (default): use Julia extension commands when available; otherwise fall back to a persistent terminal Julia REPL
julia: always use Julia extension commands
terminal: always use a persistent terminal Julia REPL (one session per workspace folder)
Run Current File
You can run the full active Julia file from this extension:
- Command palette:
Julia Cell Highlighter: Run Current File
- Editor title button (run icon): controlled by
juliaCellHighlighter.showRunFileButton (default: false)
Run Current File always uses the terminal backend and executes the active editor buffer, including unsaved edits.
Separator Lines (Independent)
You can show a visual separator line above delimiters even when highlighting is turned off.
- Controlled by
juliaCellHighlighter.showDelimiterSeparator
- Uses its own delimiter list via
juliaCellHighlighter.separatorDelimiters
Excluding Files or Folders
Exclude paths from cell highlighting and CodeLens (separator lines still apply):
"juliaCellHighlighter.excludePatterns": [
"**/src/**",
"**/test/**",
"**/deps/**",
"**/docs/**"
]
Settings
Full key format: juliaCellHighlighter.<setting>.
For example: "juliaCellHighlighter.showRunFileButton": true.
| Setting |
Default |
Options |
Description |
| Cell Highlighting |
enabled |
true |
- |
Enable or disable highlighting. |
includeDelimiterLine |
true |
- |
Include delimiter lines in highlighted ranges. |
defaultDelimiters |
["##", "#%%", "# %%"] |
##, #%%, # %% |
Enabled built-in delimiters for highlighting and execution. |
highlightWhenNoDelimiter |
none |
none, file |
Behavior when no delimiters are found. |
cursorOnDelimiterBehavior |
next |
next, previous, none |
Behavior when the cursor is on a delimiter line. |
multiCursorMode |
primary |
primary, union, first |
How highlighted cells are selected when multiple cursors are active. |
backgroundColor |
rgba(100, 150, 255, 0.04) |
- |
Highlight background color. |
borderColor |
rgba(100, 150, 255, 0.6) |
- |
Top and bottom border color. |
topBorderWidth |
2px |
- |
Top border width. |
bottomBorderWidth |
1px |
- |
Bottom border width. |
| Delimiter Separator Lines |
showDelimiterSeparator |
true |
- |
Show separator lines above delimiters. |
delimiterSeparatorColor |
#ffffff |
- |
Separator line color. |
delimiterSeparatorWidth |
1px |
- |
Separator line width. |
separatorDelimiters |
["^##(?!#)", "^#%%", "^#\s+%%"] |
- |
Regex list for separator lines. |
| Execution |
executionBackend |
auto |
auto, julia, terminal |
Cell execution backend.[1] |
juliaExecutablePath |
julia |
- |
Julia executable path for the terminal backend. |
replTerminalName |
Julia REPL (Cell Highlighter) |
- |
Terminal name for persistent REPL sessions. |
terminalRevealMode |
firstRun |
firstRun, always, never |
Terminal reveal behavior when running cells. |
| Scope |
showRunFileButton |
false |
- |
Show the Run Current File button in the editor title area. |
codeLensMode |
always |
always, current, never |
CodeLens display mode. |
excludePatterns |
["**/src/**", "**/test/**", "**/deps/**", "**/docs/**"] |
- |
Glob patterns excluded from highlighting and CodeLens. |
[1] Execution backend details:
julia: Uses execution commands provided by the Julia extension (language-julia.executeCell / language-julia.executeCellAndMove). This extension treats that API as a black box and delegates execution to it.
terminal: Uses this extension's built-in terminal backend. It can send either a cell or the whole active script to a persistent Julia REPL terminal session managed by this extension (reused per workspace, created automatically if needed).
Keybindings
- Toggle highlighting:
Ctrl+Shift+H (Windows/Linux) / Cmd+Shift+H (macOS)