Prepare extension for reworked nf-lang formatter - #215
Open
ewels wants to merge 4 commits into
Open
Conversation
Add the nextflow.formatting.maxLineLength setting (integer, default 120, 0 disables line wrapping), matching the option added to the language server for the formatter overhaul (nextflow-io/nextflow#7346). The setting reaches the language server through the existing "nextflow" configuration synchronization, so no client-side wiring is needed. Document the new formatter behavior in the README: comments are always preserved, K&R style if/else and try/catch, blank line normalization, multi-line string re-indentation, automatic line wrapping, and the fmt: skip / fmt: off / fmt: on directives. Highlight fmt: directives distinctly in line comments via a new TextMate rule in the shared groovy grammar (covers both scripts and config files). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137gokuJdJCZDRJMsF6GbFH
Merge the fmt-directive pattern into the single line-comment rule with an optional capture group, removing the duplicated rule and its pattern-ordering dependency. Anchor the directive match so only whitespace may follow it, mirroring the language server's full-match directive parser exactly (no highlight for directives the formatter would ignore). Shorten the changelog entries to point at the README instead of restating the formatter feature list, and note the required language version (26.08) in the setting description and README. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137gokuJdJCZDRJMsF6GbFH
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137gokuJdJCZDRJMsF6GbFH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the formatter overhaul in nextflow-io/nextflow#7346: adds the
nextflow.formatting.maxLineLengthsetting, documents the new formatter behavior and// fmt:directives, and highlights those directives in comments.New setting
nextflow.formatting.maxLineLength(integer, default120, minimum0;0disables line wrapping), matching the option added to the language server. The name is a fixed contract with the language-server change.nextflowconfiguration section with the language server (synchronize: { configurationSection: "nextflow" }), the same wayharshilAlignment,maheshForm, andsortDeclarationswork. Changes take effect without a server restart.Documentation
docs/vscode.mdxanddocs/reference/cli.mdxfrom the upstream PR:} else {) for if/else and try/catch// fmt: skipon the last line of a statement/declaration, and// fmt: off/// fmt: onaround a region[Unreleased]changelog section.AddedInVersiontag — worth re-checking at release time in case the PR lands in a later release), since users can pinnextflow.languageVersionto older releases where the setting is a no-op.Directive highlighting
// fmt: skip|off|oncomments are highlighted distinctly (scopekeyword.codetag.notation.groovy, the standard codetag convention themes pick up). Implemented as a single line-comment rule with an optional capture group in the sharedsource.nextflow-groovygrammar, which both the script and config grammars include — so one rule covers both languages.//\s*fmt:\s*(skip|off|on)\s*, full-match): whitespace is flexible, but a directive followed by trailing text is not highlighted, because the formatter would ignore it. Verified against the parser source in the upstream PR branch.Checked, no changes needed
tsc --noEmitpass.Release ordering
This PR can merge, but a release must wait for, in order:
nextflow.formatting.maxLineLengthsupport)Until then, existing language server releases silently ignore the new setting.
🤖 Generated with Claude Code
https://claude.ai/code/session_0137gokuJdJCZDRJMsF6GbFH
Generated by Claude Code