Repository navigation
Completion widget - #119
Open
IoannisNezis wants to merge 34 commits into
Open
IoannisNezis wants to merge 34 commits into
IoannisNezis wants to merge 34 commits into
Conversation
IoannisNezis
force-pushed
the
completion-widget
branch
from
September 4, 2026 12:24
9ea6c54 to
9cad1f7
Compare
- Escape the term before parsing it into keywords. It is source text, not a search query, so "?abas" compiled to an invalid regex, got dropped, and an empty keyword list matched everything. - Filter incomplete lists too, on filterText against the term the server saw. Entity items carry that term as their filterText and all survive; the variable items merged into the same list carry their own name, so a "?label" suggestion drops once the term is "Mathe". - Extend an accepted item's replace range to the cursor. A complete list is filtered locally rather than re-requested, so the server's range can be several keystrokes old. - Track termStart separately from the widget anchor. The anchor falls back to the cursor at request time, which sits after whatever was already typed, so it must not be used to compute the term.
Filtering is now a case insensitive prefix match on `filterText`, the same
rule the server applies, for complete and incomplete lists alike. The term
differs per kind: a complete list is matched against the live term, an
incomplete one against the term the server actually searched for, measured
at the request position so it does not drift ahead during a round trip.
Dismiss a session once the cursor moves before the position its list was
requested at. Those lists are complete, so nothing re-requests them, and an
empty term is a prefix of everything -- without this the built in calls
offered inside a "FILTER ()" survived that "FILTER (" being backspaced away.
Also stop replacing a visible list with "Nothing matches" while a request is
queued or in flight, which read as a flicker when typing fast, and clear the
debounce handle when it fires so it marks a queued request and nothing else.
Adds testing/tests/completion.spec.ts, one test per bug fixed here and in
qlue-ls 3.4.4, plus setEditorContent/placeCursor helpers so each test starts
from an exact query instead of building one through completions.
- Handle Ctrl/Cmd+Enter before the widget-visibility guard, so a request queued by the previous keystroke cannot open the popup over the query that just started running. - Raise the completion debounce from 100ms to 200ms. - Add a wikidata subject_completion query template. - Add a regression test for the Ctrl+Enter dismissal.
Typing "?abc" in an otherwise variable free query left the "Nothing matches" panel up. The list is truthfully empty -- the only candidates are the other variables in the query, and the server drops the one being typed -- but reporting no match for a name the user just finished writing reads as an error. The check sits in `render`, since both the server's own empty response and an empty local re-filter land there. `hide` now also clears the rendered rows, so a dismissed list leaves nothing in the DOM.
`SnippetController2.apply` was called with `adjustWhitespace: false`, so a multi line snippet kept its own literal indentation instead of being re-indented onto the line it lands on. The sub select snippet came out flat against the left margin, several levels short of where it belongs.
Re-indenting every snippet onto the line it lands on was too broad: the object suffix already carries the absolute indentation the server worked out from the brace nesting depth, and says so with `insertTextMode: AsIs`. Adding the current line's indentation on top of that put the next triple 2 columns too far in. The mode is now read off the item, with the list defaults folded in the way `insertTextFormat` already is.
`SnippetController2.apply` cancels a running session before it inserts, so accepting YEAR in the first stop of "BIND ($1 AS ?$0)" threw away the variable stop -- there was no way back to it. `insert` merges into the session instead and nests the new stops inside the old ones. It takes no range, so the term is overwritten from the cursor with `overwriteBefore`. Only a single line range can be expressed that way, which is every term range a completion produces.
An entity completion goes to the endpoint, so an open list can sit on stale suggestions for a noticeable moment with nothing to say a fresh answer is on its way. The header now carries a spinner for as long as a request is queued or in flight. The popup itself still waits for the first answer before it opens, so nothing new appears on a keystroke that turns out to have no suggestions.
The header spinner only helps once the popup is up. On a fresh position the first entity completion goes to the endpoint with nothing on screen, so a slow endpoint left seconds of silence. The popup now opens on a "Searching…" panel once a request has been out for 250ms with nothing displayed. The grace period keeps it away from the answers that come back promptly, and anything that reaches the screen first -- a keyword list, a stale list being re-filtered -- keeps it away too. A fully typed variable never raises it either, since its answer is dismissed rather than shown.
An entity list is isIncomplete, so a keystroke re-requests rather than re-renders. The header term is written only by a render, so it named the term the last response was for and caught up a round trip late -- next to a spinner that had updated on the keystroke itself. The term now rides along with the spinner on syncHeader, the one hook that runs between renders, so both follow what is on screen. The test pins the header inside the delay of a stalled request, since a generous timeout would outlast the round trip and watch the stale header catch up on the answer -- passing on the very bug it is meant to catch.
qlue-ls 3.6.0 sends the label, aliases, score, and — for a literal — the lexical form, language and datatype under `CompletionItem.data`, so the widget no longer splits `labelDetails.detail` on a `/` or regexes the score out of `documentation`. Each shape now gets the row it needs. A literal takes one line: the value in the editor's colour for its type, quoted the way SPARQL quotes it, with the language tag or datatype trailing it — the value is all there is, and the old two-line layout printed it twice. An entity keeps two: its name, and its curie underneath in mono. Keywords, snippets and built-in calls are unchanged. The curie line also says why the row is there. When the term matched an alias rather than the name, that one alias follows the curie in a chip and the rest collapse into a count, so a row never grows a line however many aliases an entity has; when the name itself matched there is no chip, which makes the chip's presence the signal. The header names the term in the same amber the rows highlight it in.
The `uni` and `eval` object queries were finding nothing: the label filter demanded `LANG() = "de"` on a binding that is the literal itself for a literal object, and `?qls_label_1` was a typo for `?qls_label1`. Both now tolerate an empty language tag and filter on `STR()`. Gives the `wikidata` endpoint predicate queries that take labels and aliases from `mul` first and fall back to `en`.
An entity list is `isIncomplete`, so a keystroke re-requests rather than re-renders and the rows on screen keep answering the term the last response was for. Typing "Inf" and then the rest of "Informatik" left the "Inf" results looking exactly as current as a fresh list for as long as the round trip took. They now dim and pulse while their replacement is out, and the footer says which term they answer. The rows stay in place and stay selectable — a list the user is already reading must not be blanked, and the one being typed is often already in it. `setStale` sits beside `setPending` and `setTerm`: those are the three things that update between renders, since a keystroke never reaches `render`. The controller derives it from the live term against the term the session was fetched for, and re-derives it after each render, because fast typing can outrun the round trip and land a list that is already stale.
A code action's edit reached the completion controller's content-change handler exactly like a keystroke, and the trigger heuristic looked only at the last character of the inserted text. "Add to result" writing "?o" over the "*" of "SELECT *" ended in a word character, so it opened the popup on whatever the cursor happened to sit on, lines away from the edit. Gate the trigger on the change landing on the cursor. The span covers both the inserted and the replaced text, so it holds whether the cursor is read before or after the edit moved it.
Two-line rows made the popup heavier than the editor it hangs off. Split the panel in two columns: the list keeps one line per candidate — the name, the alias the term matched, and what will be inserted — and everything consulted after finding the row moves into a panel beside it for the selected row only. The detail panel carries the entity's curie as a link to its IRI, the usage score, the type, the server's one line gloss and its documentation. Every field is omitted when the server did not send it, so nothing is a placeholder. The header now carries the round trip time of the request that produced the list, next to the candidate count; the footer and its key hints are gone. The spinner and the stale mark stay, the stale mark taking the timing's place while a list answers an older term than the one being typed.
The alias between name and curie never shrank, so a long one pushed the label out of the row. It now caps at 44% of the row and ellipses, the name keeps an 82px floor, and the curie still never shrinks. In the detail panel the alias wraps instead of truncating a second time.
qlue-ls now sends one `alias` string in a completion item's `qlueLs` data payload instead of an `aliases` list, and returns each entity once, binding at most the alias that matched the search term. So there is nothing left to pick client-side: the widget shows what the server sent, and only drops it when the name itself matched the term and the row would say the same thing twice. An alias matched by CONTAINS rather than by prefix now shows, where the old prefix check silently hid it. The completion queries follow: SAMPLE(?alias) in place of GROUP_CONCAT, and the subject completions grew the search term filter their alias OPTIONAL was missing — without it SAMPLE picks an arbitrary alias, not the matching one.
A row used to carry the name and, beside it, the alias the term matched, each truncated to fit the other. It now shows one string: the label, or the alias where the label is not what the term highlights in. `matchesAllKeywords` decides that, the same predicate `highlightMatches` renders from, so a row can never lead with a string the highlight then fails to appear in — and how the completion query matched, prefix or substring or something else, is not guessed at here. An alias is tinted warm, the only cue that the text is not the entity's own name. The panel leads with that name and states the alias as a field beside the score and the type, whenever the server sent one. The cost is that the list no longer tells you an entity's canonical name, and two entities can sit in it under near-identical text, told apart by their curies until one is selected.
The server completes inside comments too, so typing prose that happens to end in a keyword -- "# blabla select" -- opened the keyword list.
Monaco binds its built-in suggest trigger to the physical Ctrl key on macOS, so unbinding only the CtrlCmd chord left the built-in widget answering Ctrl + Space there -- and in Playwright's WebKit, whose user agent claims to be a Macintosh. The tests pick their modifier to match.
IoannisNezis
force-pushed
the
completion-widget
branch
from
September 5, 2026 15:55
9cad1f7 to
eb88a4b
Compare
* main: chore(deps): update docker/setup-buildx-action action to v4 chore(deps): update docker/metadata-action action to v6 MAINT: clarify log on URL base path chore(deps): update actions/checkout action to v7 chore(deps): update docker/login-action action to v4 chore(deps): update docker/build-push-action action to v7 fix(deps): update dependency uvicorn to v0.52.4
* main: FIX: update completion query presets to new tera version CHORE: bumb qlue-ls 3.9.0 FIX: update depricated template syntax in completion preset
* main: ENH: reload the page when the backend restarts CHORE: add process-compose dev setup
* main: DEP: bumb qlue-ls to 3.11.1 ENH: show errors of qlue-ls backend-service configuration
* main: ENH: persist exec and parseTree url parameters
* main: MAINT: add prefix default for wikidata statement DEP: migrate to monaco-languageclient v11 chore(deps): update dependency vite to v8.3.2 chore(deps): update dependency typescript to v7 chore(deps): update node.js to v24.21.0 chore(deps): update astral-sh/setup-uv action to v10.2.0 chore(deps): update dependency @types/node to v25.9.8 chore(deps): update dependency @biomejs/biome to v2.5.15 chore(deps): update ghcr.io/astral-sh/uv docker tag to v0.12.21 fix(deps): update dependency uvicorn to v0.54.0
IoannisNezis
force-pushed
the
completion-widget
branch
from
October 1, 2026 20:54
ab31c4c to
e56ce75
Compare
Create the template editor through an EditorApp so its model is held by a model reference. A bare monaco.editor.create model was destroyed by monaco-vscode-api on the first mouse click, blanking the editor.
* main: (61 commits) FIX: show dataset URL even if the endpoint is unreachable Add a pin to `Clear Cache` that clears the cache before every query (#165) DEP: update qlue-ls to 3.13.1 chore(deps): update dependency vite to v8.3.4 chore(deps): update ghcr.io/astral-sh/uv docker tag to v0.13.0 chore(deps): update astral-sh/setup-uv action to v10.3.0 fix(deps): update dependency fastapi to v0.143.0 chore(deps): update dependency @playwright/test to v1.64.0 chore(deps): update python to v3.14.8 chore(deps): update ghcr.io/astral-sh/uv docker tag to v0.12.22 chore(deps): update dependency @types/node to v25.9.9 FIX: keep the template editor's model alive on click FIX: keep the template editor's model alive on click MAINT: add prefix default for wikidata statement fix(deps): update dependency fastapi to v0.142.2 ENH: make numbers in profile more readable FIX: only show the grab cursor on the query execution tree canvas ENH: show the name of the analysed query in the analysis modal ENH: fill in the total time as planning plus execution time ENH: show the query planning info in a fold-out of the planning time stat ...
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.
No description provided.