Repository navigation
api-links: Nextflow adapter links much more of the language, from the language server's API index - #30
Draft
ewels wants to merge 3 commits into
Draft
api-links: Nextflow adapter links much more of the language, from the language server's API index#30ewels wants to merge 3 commits into
ewels wants to merge 3 commits into
Conversation
- Read `${…}` in double-quoted strings as code, also over several lines, so a
multi-line interpolation no longer ends a process body early. Names in
`$name` and `${…}` link as they do in code.
- Link keywords, section labels, qualifiers and output options, typed stage
directives and output functions, `task.*`, feature flags, every config
setting and the members of the standard library types. All from the
generated reference data, with each link checked against the live pages.
- Follow the types of values in a block, so members of typed values and
operators on process and workflow outputs link.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ewels
marked this pull request as draft
November 9, 2026 21:33
Owner
Author
|
Instead of vendoring all of this Nextflow stuff into every codeblocks install, I'd prefer to get it published by the Nextflow language server repo instead (or Nextflow) and load it dynamically, keeping this library as lightweight and generic as possible. |
…d apiIndex() links any index - The Nextflow adapter reads its names from api-index.json of the latest Nextflow language server release, fetched once and kept on disk like Sphinx inventories. `version` pins a release, and `index` takes another index. The bundled reference data, the hand-written operators and the generator script are gone. - apiIndex() links the names of any language or library with an API index: global and dotted names, and members through the `type` and `extends` of each name. The tokenizer is shared, with settings for comments, quotes and interpolation. - Card texts and signatures now come from nf-lang, as in the VS Code hover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ture The tests check the adapter's rules, and the language server checks the index itself, so the fixture needs 140 of its 948 names. Biome leaves it at one symbol per line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
The Nextflow adapter now links most of what the VS Code language server gives hover help for, and reads its names from the API index that each Nextflow language server release publishes (nextflow-io/language-server#201), instead of a reference bundled in this package. A new
apiIndex()adapter links the names of any language or library that publishes an index in the same format. It also fixesextlinking in one nf-core blog code block and not in another.extbug${…}in acontainerstring read as unbalanced code. The process body closed early, and nothing after it linked.${…}in double-quoted strings is now read as code, over any number of lines. Single quotes,'''and\$do not interpolate.$nameand${…}link as they do in code, so${task.cpus},$projectDirand${workflow.runName}link.process,workflow,include,params {,output {,enum,record) and the section labels of processes and workflows.stageAs,file(),eval()).task.*properties and directive values, feature flags, every config setting (dotted, in scope blocks, nested, and unscoped), and the members of the standard library types.name: Typedeclarations, legacypathinputs, and assignments from typed values. A variable that gets two different types has none.fasta.name.toUpperCase()links both members, and the members of a type's parents link too (Listhas the members ofIterable).x = PROC(...),PROC.out.zip.collect()and typedChannel<…>inputs.api-index.jsonof the latest language server release. The build fetches it once and keeps it innode_modules/.cache/starlight-codeblocks/, as it does Sphinx inventories.versionpins a release, such as26.10.1, for the docs of an older Nextflow version.indextakes another index: a URL, a file path, or the object itself.modulesoption.nextflow-reference-data.ts(3,500 lines), the hand-written factories and operators, andscripts/nextflow-reference.mjs. The package no longer needs a release when Nextflow adds a directive or a setting.apiIndex({ languages, index, syntax? })fromstarlight-codeblocks/adapters/api-index. The format is a JSON file of names, each with a kind, a docs link and, optionally, a signature, summary, type, the types it extends, and a context.typeandextends, also on variables with aname: Typedeclaration or one type in every assignment.contextneed an adapter that knows the language's grammar, as the Nextflow adapter does. The docs page describes the format, and the "Write an API link adapter" page points to it.tokens.ts, with settings for line comments, quotes and interpolated quotes.cpusreads "Thecpusdirective allows you to define the number of (logical) CPUs required by each task." Some nf-lang descriptions are imperative ("Get a file…"); that is for nf-lang to change.docker.enabledlinks to the setting (reference/config/docker#dockerenabled), not thedockerscope.docker {still links the scope.eachlinks as a legacy input qualifier, and a bracketedfile(…)in anoutput:section reads as the typed function, because the legacyfilequalifier is deprecated.{ bam -> bam.name }), operators after|, and names in config values other thantask.*.api-index.json, the default fetch fails: the build warns, the Nextflow examples on the docs site link only modules, and the API links e2e spec fails on them. Unit tests have no network and usetest/fixtures/nextflow-api-index.json: the 140 names that the tests use, from the index that Add an API index of the language as a release asset nextflow-io/language-server#201 builds. They check the adapter's rules, since the language server checks the index itself.pnpm lint,pnpm test(508 tests),pnpm lint:docs,pnpm docs:buildwith no warnings and theapi-linksPlaywright spec (30 tests) pass with the docs site reading the snapshot.🤖 Generated with Claude Code