Repository navigation
feat(yasgui): show IRI info when hovering an IRI in the editor - #234
Merged
Merged
Conversation
Hovering an IRI or prefixed name in the query editor shows a tooltip with its label, description, type and (for properties) domain and range, fetched with a small background query on the tab's endpoint, cached per endpoint and IRI, with a LOV lookup when the endpoint doesn't describe it. Can be switched off in Settings > Editor or with the iriHover option. Yasqe gets the iriHover / iriHoverDelay options and getIriAt(), which the Ctrl+click URI explorer now uses too. Closes #196
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.
Requested by Mathias · project thread
Before: to find out what
era:solNatureor an opaque instance IRI in a query means, you had to Ctrl+click it, which replaces the results view.After: resting the mouse on an IRI or prefixed name in the editor shows a tooltip with its label, full IRI, description, type and (for properties) domain and range. It reminds you of Ctrl+click / Ctrl+Shift+click, and can be switched off in Settings → Editor.
Closes #196
How
iriHover/iriHoverDelayoptions, using CodeMirror 6'shoverTooltip, and agetIriAt(pos)method that finds the IRI or expanded prefixed name at a position (ignoring variables, literals and blank nodes). The Ctrl+click URI explorer inTab.tsnow usesgetIriAtinstead of its own token parsing.IriHoverInfo.ts): aSELECT ?p ?oonrdfs:label,skos:prefLabel,rdfs:comment,skos:definition,rdf:type,rdfs:domain,rdfs:rangeviatab.runBackgroundQuery(tab auth and request settings), 10 s timeout, cached per endpoint + IRI (failures are retried on the next hover). Label and comment prefer the browser languages, then English, then untagged. Types are shortened with the query prefixes plus a few common ones.GRAPH ?g). Not verified against the live LOV endpoint, because the cloud environment can't reach it; it fails silently. It can be turned off withiriHoverLovFallback: false.iriHover(default true) andiriHoverLovFallback(default true), user setting in Settings → Editor, documented in the user and developer guides, plus a changeset.Tests:
test/iri-hover-browser.ts(7 Puppeteer tests against a mocked endpoint: tooltip content, caching, LOV fallback, variables, setting off,getIriAtedge cases, Ctrl+click still works). The full Puppeteer suite and unit tests pass locally. Light and dark screenshots are in the project thread.Generated by Claude Code