Skip to content

feat(yasr): pick the result view with a #defaultView query comment - #233

Merged
MathiasVDA merged 1 commit into
mainfrom
claude/issue-134-1z7bpz
Oct 19, 2026
Merged

MathiasVDA merged 1 commit into
mainfrom
claude/issue-134-1z7bpz

Conversation

@MathiasVDA

Copy link
Copy Markdown
Collaborator

Requested by Mathias · project thread

Before: the result view was chosen by plugin priority or by hand, so a CONSTRUCT always opened in Graph and a query could not ask for the map. Added prefixes were inserted on line 1, above any comment the query started with.

After: a #defaultView:<name> comment line in the query picks the view its results open in, like the Wikidata Query Service. #defaultView:Geo, #defaultView:chart etc. match plugin names or labels case-insensitively, and the Wikidata names work too (Map → Geo, LineChart/BarChart/ScatterChart/AreaChart/BubbleChart → Chart). If the plugin can't render the results, yasr falls back as usual. Autocompleted prefixes and the Prefixes button now add prefixes below the leading comment lines.

How: new packages/yasr/src/defaultView.ts parses the comment and resolves it to a registered plugin; Yasr.selectPluginFromQuery() selects it without drawing, and Tab.handleQueryResponse calls it right before setResponse. addPrefixAsString (yasqe) and insertPrefixes (yasgui) skip leading # lines. Documented under Plugin Selection and Prefix Management in the user guide.

Tests: new unit tests for the parser/resolver, a browser test for selectPluginFromQuery, and the autoadd-prefix browser test now checks the prefix lands below the leading comment. Full browser suite (48) and unit suite (1707) pass locally.

Closes #134


Generated by Claude Code

A '#defaultView:<plugin>' comment line in the query selects the plugin the
results open in, like the Wikidata Query Service. Plugin names and labels
match case-insensitively, and Wikidata view names (Map, BarChart, ...) map
onto the Geo and Chart plugins.

Added prefixes now go below the comment lines a query starts with, both for
autocompleted prefixes and for the Prefixes button, so the comment stays on
the first line.

Closes #134
@MathiasVDA MathiasVDA self-assigned this Oct 19, 2026
@MathiasVDA
MathiasVDA merged commit 01c8871 into main Oct 19, 2026
2 checks passed
@MathiasVDA
MathiasVDA deleted the claude/issue-134-1z7bpz branch October 19, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pick YASR plugin using query comment

1 participant