Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to the Nextflow VS Code extension will be documented here.

See [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Add `nextflow.formatting.maxLineLength` setting to control automatic line wrapping when formatting
- Document the new formatter behavior and `// fmt:` directives in the README
- Highlight `fmt:` formatter directives in comments

_Note: the new formatter behavior requires a language server release built against the reworked nf-lang formatter -- comment preservation ([nextflow-io/nextflow#7346](https://github.com/nextflow-io/nextflow/pull/7346), merged) plus the pending line wrapping ([#7520](https://github.com/nextflow-io/nextflow/pull/7520)) and `fmt:` directives ([#7522](https://github.com/nextflow-io/nextflow/pull/7522)) follow-ups. Older language server versions ignore the new setting._

## [1.7.1] - 2026-06-08

- Add syntax highlighting and filtering for Nextflow log files (#197)
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Related blog posts:
- [Modernizing the Nextflow Developer Experience (Part 1): The IDE](https://seqera.io/blog/modernizing-nextflow-developer-experience/)
- [Modernizing the Nextflow Developer Experience (Part 2): The Language Server](https://seqera.io/blog/modernizing-nextflow-developer-experience-part-2/)

### Formatting

The extension can format your scripts and config files based on a standard set of formatting rules. Rules can be customized using the **Nextflow > Formatting** extension settings.

The formatter always preserves comments -- formatting never loses or alters a comment -- and re-indents multi-line strings to match the surrounding code.

Long lines are automatically wrapped at the configured maximum line length (see the `nextflow.formatting.maxLineLength` setting). To exclude code from formatting, use `// fmt: skip` on the last line of a statement or declaration, or enclose a region with `// fmt: off` and `// fmt: on`.

_Note: line wrapping and the `fmt:` directives require a newer language server version and are ignored by older versions._

### Project view

The extension provides a custom view for Nextflow projects. The Project view uses the language server to provide an overview of your pipeline project.
Expand Down Expand Up @@ -97,6 +107,10 @@ The following settings are available:

- `nextflow.formatting.maheshForm`: Place process outputs at the end of the process body when formatting Nextflow scripts.

- `nextflow.formatting.maxLineLength`: Maximum line length for formatting. Use `0` to disable line wrapping.

_Note: requires a language server version with formatter line wrapping; older versions ignore this setting._

- `nextflow.formatting.sortDeclarations`: Sort script declarations when formatting Nextflow scripts.

- `nextflow.java.home`: Specify the folder path to the desired Java runtime. Equivalent to the `JAVA_HOME` environment variable, i.e. the Java binary should be located at `$JAVA_HOME/bin/java`. Use this setting if the extension cannot find Java automatically.
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@
"default": false,
"markdownDescription": "Place process outputs at the end of the process body when formatting Nextflow scripts."
},
"nextflow.formatting.maxLineLength": {
"type": "integer",
"default": 120,
"minimum": 0,
"markdownDescription": "Maximum line length for formatting. Use `0` to disable line wrapping.\n\n*Note: requires a language server version with formatter line wrapping; older versions ignore this setting.*"
},
"nextflow.formatting.sortDeclarations": {
"type": "boolean",
"default": false,
Expand Down
4 changes: 3 additions & 1 deletion src/languageServer/utils/fetchLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ export async function fetchLanguageServerJar(
return fileUri.fsPath;
}

export function fetchLanguageServerNative(versionPrefix: string): string | null {
export function fetchLanguageServerNative(
versionPrefix: string
): string | null {
const nativePath = path.join(
cacheDir(versionPrefix),
process.platform === "win32" ? "nextflow-lsp.exe" : "nextflow-lsp"
Expand Down
5 changes: 4 additions & 1 deletion syntaxes/groovy.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@
"captures": {
"1": {
"name": "punctuation.definition.comment.groovy"
},
"2": {
"name": "keyword.codetag.notation.groovy"
}
},
"match": "(//).*$\\n?",
"match": "(//)(?:\\s*(fmt:\\s*(?:skip|off|on))\\s*$)?.*$\\n?",
"name": "comment.line.double-slash.groovy"
}
]
Expand Down
12 changes: 12 additions & 0 deletions syntaxes/highlight.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ const CASES = [
["x = 1 /**/", "comment.block.empty", "/**/"],
["/* one\ntwo */", "comment.block", "two"],

// --- fmt directives (must mirror the language server's parser:
// //\s*fmt:\s*(skip|off|on)\s* matched against the whole comment) --------
["x = 1 // fmt: skip", "keyword.codetag.notation", "fmt: skip"],
["x = 1 // fmt: skip", "comment.line.double-slash", "// fmt: skip"],
["// fmt: off", "keyword.codetag.notation", "fmt: off"],
["// fmt: on", "keyword.codetag.notation", "fmt: on"],
["//fmt:skip", "keyword.codetag.notation", "fmt:skip"],
["// fmt: skip extra text", "keyword.codetag.notation", false],
["// fmt: offside", "keyword.codetag.notation", false],
["// fmt: offside", "comment.line.double-slash", "// fmt: offside"],
["// plain comment", "keyword.codetag.notation", false],

// --- constants ----------------------------------------------------------
["x = MAX_SIZE", "constant.other", "MAX_SIZE"],
["x = true", "constant.language", "true"],
Expand Down
Loading