Prepare extension for reworked nf-lang formatter - #215
Open
ewels wants to merge 7 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
The formatter overhaul (nextflow-io/nextflow#7346) merged scoped down to comment preservation and multi-line string re-indentation; line wrapping, fmt directives, include sorting, and blank-line normalization moved to stacked follow-up PRs (#7519, #7520, #7522, #7523), and K&R style was dropped. Trim the README formatter description to the merged and in-flight features the extension depends on, align the maxLineLength wording with the -line-length docs in #7520, and replace the speculative 26.08 version notes with version-agnostic ones. The fmt directive parser in #7522 is unchanged from what the grammar rule mirrors, so the highlighting needs no change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137gokuJdJCZDRJMsF6GbFH
…er-updates-qwoncr
Run prettier on fetchLanguageServer.ts, which arrived from main unformatted and failed the CI check. Pin the fmt directive grammar rule in the new syntax highlighting test suite, covering the match semantics shared with the language server parser: flexible whitespace, no trailing text, and directive lines still scoped as comments. 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.
Prepares the extension for the reworked nf-lang formatter. The formatter overhaul (nextflow-io/nextflow#7346) merged scoped down to comment preservation; the extension-facing features now live in stacked follow-ups — line wrapping in nextflow-io/nextflow#7520 and
fmt:directives in nextflow-io/nextflow#7522. This PR adds thenextflow.formatting.maxLineLengthsetting, documents the new formatter behavior, and highlightsfmt:directives in comments.Upstream status
The original formatter overhaul PR (nextflow-io/nextflow#7346) merged containing comment preservation and multi-line string re-indentation only. The remaining features were split into stacked PRs: include sorting (#7519) ← line wrapping (#7520) ←
fmt:directives (#7522), plus blank-line normalization (#7523). K&R-style else/catch was dropped. This PR's docs and features have been aligned to that split.New setting
nextflow.formatting.maxLineLength(integer, default120, minimum0;0disables line wrapping), matching the-line-lengthoption from Wrap long lines in the formatter nextflow#7520 and the corresponding language-server setting. 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
// fmt: skipon the last line of a statement/declaration, and// fmt: off/// fmt: onaround a region (#7522)[Unreleased]changelog section linking the upstream PRs.nextflow.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.FmtDirectives.FMT_DIRECTIVE = //\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. Re-verified against theformatter-fmt-directivesbranch after the split — the regex is unchanged.Checked, no changes needed
tsc --noEmitpass.Release ordering
This PR can merge, but a release must wait for, in order:
fmt:directives) to merge — #7520 is stacked on #7519, and #7522 on #7520nextflow.formatting.maxLineLengthsupport)At release time, update the version notes in the README and setting description with the actual required language server version. Until then, existing language server releases silently ignore the new setting.
🤖 Generated with Claude Code
https://claude.ai/code/session_0137gokuJdJCZDRJMsF6GbFH