Skip to content

Ctrl+Click a URI in the Response plugin to DESCRIBE and append the result - #176

Merged
MathiasVDA merged 10 commits into
mainfrom
copilot/control-click-uri-response-plugin
Sep 12, 2026
Merged

MathiasVDA merged 10 commits into
mainfrom
copilot/control-click-uri-response-plugin

Conversation

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown

The raw Response view lets you read URIs but not explore them. This adds the Graph plugin's node-expansion ergonomics to the Response plugin: Ctrl/Cmd+Click a URI to run DESCRIBE <uri> and append the returned triples inline.

Changes

  • URI helpers (response/uriUtils.ts, new)extractUriAtOffset(text, offset) resolves the URI under a click across serializations (angle-bracket IRIs in Turtle/N-Triples and bare/quoted URIs in JSON/XML, with trailing-punctuation trimming); buildDescribeQuery(uri) builds the query. Kept DOM-free so they're unit-testable in isolation.
  • Response plugin (response/index.ts)mousedown handler resolves the URI via posAtCoordsextractUriAtOffset, then executes the DESCRIBE through the existing yasr.executeQuery hook (same path the Graph plugin uses). Results are appended to the view via showMore; appended content survives "Show all", resets on a new query, and failures/empty responses are surfaced as inline # comment notes. The request Accept header reuses the current RDF content type when applicable, else text/turtle.
  • Docs — Response Plugin section updated with the shortcut.

Notes for reviewers

  • Enabled only when the host wires up config.executeQuery; otherwise the click is a no-op (no preventDefault).
  • The "triple"/"quad" content-type matching in getDescribeAcceptHeader intentionally mirrors the existing detection in parsers/index.ts rather than switching to "n-triples".

Copilot AI changed the title [WIP] Add Control+Click functionality for URIs in response plugin Ctrl+Click a URI in the Response plugin to DESCRIBE and append the result Sep 12, 2026
Copilot AI requested a review from MathiasVDA September 12, 2026 14:59
@MathiasVDA
MathiasVDA marked this pull request as ready for review September 12, 2026 15:33
MathiasVDA and others added 3 commits September 12, 2026 17:46
…shes (#175)

* Initial plan

* fix: persist horizontal/vertical orientation across page refreshes

* fix: add JSDoc comments to getOrientation/setOrientation

* Improve getOrientation method implementation

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mathias Vanden Auweele <mathias@matdata.eu>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are correctness issues in the new helper/query behavior (DESCRIBE vs CONSTRUCT mismatch) and an async race where DESCRIBE results can append to a new response after the editor is recreated.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds “Ctrl/Cmd+Click a URI to DESCRIBE and append triples” ergonomics to the YASR Response plugin, enabling inline exploration of resources directly from the raw response view (similar to the Graph plugin’s node expansion behavior).

Changes:

  • Introduces DOM-free URI parsing/query helpers for the Response plugin (uriUtils.ts) plus unit tests.
  • Adds a Ctrl/Cmd+Click (mousedown) handler in the Response plugin to detect a URI under the cursor, execute the background query via yasr.executeQuery, and append results inline.
  • Updates user documentation to describe the new shortcut.
File summaries
File Description
test/unit/response-uri-utils-test.ts Adds unit tests for URI extraction and query building helpers.
packages/yasr/src/plugins/response/uriUtils.ts Adds URI-at-offset extraction and “describe query” builder utilities for the Response plugin.
packages/yasr/src/plugins/response/index.ts Implements Ctrl/Cmd+Click handling and async DESCRIBE execution + append behavior in the Response plugin.
docs/user-guide.md Documents the new Ctrl/Cmd+Click DESCRIBE-and-append shortcut for the Response plugin.
Review details

Suppressed comments (2)

packages/yasr/src/plugins/response/uriUtils.ts:52

  • The match range check uses offset <= end, but end is exclusive (start + match length). Using inclusive end can incorrectly treat clicks immediately after the URI as being inside it.
    const start = match.index;
    const end = start + match[0].length;
    if (offset >= start && offset <= end) {
      const uri = sanitizeUri(match[0]);
      return uri.length > 0 ? uri : undefined;

packages/yasr/src/plugins/response/uriUtils.ts:41

  • The match range check uses offset <= end, but end is exclusive (start + match length). Using inclusive end can incorrectly treat clicks immediately after the closing > as being inside the IRI.
    const start = match.index;
    const end = start + match[0].length;
    if (offset >= start && offset <= end) {
      const uri = sanitizeUri(match[1]);
  • Files reviewed: 10/10 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/yasr/src/plugins/response/index.ts
Comment thread packages/yasr/src/plugins/response/uriUtils.ts
Comment thread packages/yasr/src/plugins/response/uriUtils.ts
MathiasVDA and others added 2 commits September 12, 2026 17:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@MathiasVDA
MathiasVDA merged commit d6ab5d5 into main Sep 12, 2026
2 checks passed
@MathiasVDA
MathiasVDA deleted the copilot/control-click-uri-response-plugin branch September 12, 2026 15:57
MathiasVDA added a commit that referenced this pull request Sep 12, 2026
…end the result (fixes #176)

* Initial plan

* feat: Ctrl+Click URI in response plugin runs DESCRIBE and appends result

* refactor: surface DESCRIBE failures in response view and tighten typing

* refactor: reuse showMore for revealing appended DESCRIBE content

* feat: don't describe but retrieve all triples where uri is subject of

* docs: also the docker image has been renamed

* chore: update prefixes

* fix: persist horizontal/vertical layout orientation across page refreshes (#175)

* Initial plan

* fix: persist horizontal/vertical orientation across page refreshes

* fix: add JSDoc comments to getOrientation/setOrientation

* Improve getOrientation method implementation

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mathias Vanden Auweele <mathias@matdata.eu>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix offset condition in extractUriAtOffset function

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Modify loading behavior in describeUri method

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mathias Vanden Auweele <mathias@matdata.eu>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

Control+Click on a URI in the response plugin

3 participants