Add syntax highlighting and filtering for Nextflow log files#197
Conversation
Adds a nextflow-log language for .nextflow.log* files with a TextMate grammar that highlights timestamps, threads, levels, loggers, work-dir hashes, process names, paths, key=value pairs, exception lines, and stack traces. DEBUG/TRACE entries are dimmed via an opacity decoration and the level token is forced to a neutral gray; ERROR/WARN entries get whole-line backgrounds plus overview-ruler marks. Adds a per-level filter that swaps the editor to a read-only virtual document (registered FileSystemProvider on the nextflow-log-filtered scheme) containing only the visible lines — hidden lines are genuinely removed from view rather than folded or blanked. The filter UI surfaces through a CodeLens at the top of the file, a status-bar item with a QuickPick, and per-level editor-title icons. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Replaces the prior fold-based level filter with a read-only virtual document (nextflow-log-filtered: FileSystemProvider) that .nextflow.log files swap into on open. Hidden levels are genuinely removed from the view; ANSI escape codes are stripped by default; the file on disk is never modified. Filter state is now per-file and lives in memory only — toggling levels, ANSI stripping, or the raw-view mode is ephemeral and resets when the file's last tab is closed. Two explicit Save items in the picker write the current state to workspace or global settings (and omit any value that matches the package.json default, keeping settings.json clean). Also: dedupe isNextflowLogEditor into constants.ts, parallelize the visible-editor sync with Promise.all, hoist the TextEncoder allocation, short-circuit the state-cleanup pass when no log files are tracked, and replace the withActiveState callback wrapper with a direct accessor for consistency across toggle handlers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
.nextflow.log files
|
Slightly hasty video of it in action: vscode_nextflow_log_v0.mp4 |
Uses the Nextflow arc shapes (top and bottom pairs) as the frame with "LOG" set in JetBrains Mono between them, all in Nextflow green. Wired through the nextflow-log language entry in package.json. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…rnings Adds a FileDecorationProvider that scans .nextflow.log* files for ERROR and WARN header lines and surfaces a small badge in the file explorer: red "E" for any errors, yellow "W" for warnings-only. The tooltip carries the full count. Scans are cached by URI + mtime and invalidated by a FileSystemWatcher on the same glob, so live-tailed logs update as they grow. Failed reads are not cached so a transient permission error doesn't pin a stale "no badge" state. The file pattern (glob + path regex) is centralized in constants.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
bentsherman
left a comment
There was a problem hiding this comment.
I removed the log icon -- it feels a bit overkill, and the default log icon seems fine
I also removed some commands from the command palette that were already covered by the code lens
One issue -- the "Show raw file view" doesn't seem to work. When I try to disable the filtered view, nothing changes
Can you elaborate? They are one and the same thing, no? |
If you're showing all the log lines, that's expected. You'll see a visual change if you were previously hiding lines. You should also see the file tab change. By default it loads with a little lock icon and you can't edit the file. After selecting that option it goes to normal and you can (but the command menu can't filter lines etc in that mode). |
|
I see, so the "raw file" view only disables the filtering and lock but not the opacity In that case, I think we should restructure some of the settings to make this relationship clear:
|
Just re-read this - I misunderstood on the first pass. Totally fine to remove from the command palette. I confess that I had totally forgotten that this PR added any commands there 👀 |
|
@bentsherman I updated the setting name as suggested. For now the codelens menu reads the same (Open as editable file), are you happy with that?
|
Signed-off-by: Ben Sherman <[email protected]>
.nextflow.log files


Something I've been wanting to do for ages: nicer rendering of
.nextflow.logfiles. Context and previous efforts:.nextflow.logfiles #50Looks like this:
DEBUGandTRACElines are at 30% opacityINFOand above are 100% opacityWarning and error blocks have background colour:
Buttons at top and bottom toolbar open a menu:
Allows you to hide log messages of various levels, turn on / off the ANSI code removal, and save to settings. Also to open in "regular mode" (editable, but disables ansi stripping and hiding log lines).
Need to run now, will try to do a video walkthrough ASAP.
Details
nextflow-loglanguage for.nextflow.log*files with a TextMate grammar (timestamps, threads, levels, loggers, work-dir hashes, process names, paths, key=value, exception lines, stack traces) and decorations that dim DEBUG/TRACE entries and paint whole-line backgrounds + overview-ruler marks on WARN/ERROR.nextflow-log-filtered:FileSystemProvider): the hidden lines are genuinely removed from view — no folds, no empty lines, no gutter remnants. ANSI escape codes are stripped from this view by default.hidden levels,ANSI strip,raw view) is per-file and ephemeral — lives in memory, cleared when the file's last tab closes. Two explicitSave to workspace settings/Save to global settingsitems in the picker write the current state as the new default for future opens (and omit any key whose value matches thepackage.jsondefault, keepingsettings.jsonclean).