Web: @ and [[ offer notes again, from search (#165) #220

Closed
kayg wants to merge 1 commit from issue/165-link-picker-fix into dev
Owner

The fast fix for #165: @ and [[ showed nothing on calternal.cloud.

Why: the editor's link shortcuts (packages/editor/src/transforms/links.ts) only offer notes when the app passes them a search function. Editor.svelte passed links: { notePath } and nothing else, so the completion source returned null on every keystroke. Nothing was broken in the editor; the app never connected it.

What this does:

  • apps/web/src/lib/search.ts: one search client on search.query (and search.visit), used by ⌘K and the picker, so ranking, typo fixes and "used lately" are the same in both.
  • apps/web/src/lib/link-targets.ts: turns hits into link targets. Offline or on an error, it falls back to notes whose title matches. It never offers the note you're in. A hand-typed [[Title]] links to the note with that title.
  • The picker list sits on <body> (outside the page's glass, which would otherwise swallow its blur), with the palette's glass, the app font, a set width and 12px from the screen's sides. It doesn't clip or overflow at 320.
  • Also fixed on the way: ⌘K's search.visit call (added on dev today) was sent without an idempotency key, so the server turned it away every time. It now goes through visited() with a key.
  • e2e/picker.spec.ts: [[ and @ find a note through search, and Enter writes [Title](<Title.md>). Runs in Chromium and WebKit at 390 and 1440.

The full picker (embeds, Create note, Tab, a list that shows on the first keystroke) and the cards come in follow-up PRs on #165.

Verified locally: picker spec 8/8 (Chromium and WebKit, 390 and 1440); editor, shortcuts and links specs pass. Screenshots at 320, 390 and 1440, light and dark, are on #165.

🤖 Generated with Claude Code

The fast fix for #165: `@` and `[[` showed nothing on calternal.cloud. **Why:** the editor's link shortcuts (`packages/editor/src/transforms/links.ts`) only offer notes when the app passes them a `search` function. `Editor.svelte` passed `links: { notePath }` and nothing else, so the completion source returned `null` on every keystroke. Nothing was broken in the editor; the app never connected it. **What this does:** - `apps/web/src/lib/search.ts`: one search client on `search.query` (and `search.visit`), used by ⌘K and the picker, so ranking, typo fixes and "used lately" are the same in both. - `apps/web/src/lib/link-targets.ts`: turns hits into link targets. Offline or on an error, it falls back to notes whose title matches. It never offers the note you're in. A hand-typed `[[Title]]` links to the note with that title. - The picker list sits on `<body>` (outside the page's glass, which would otherwise swallow its blur), with the palette's glass, the app font, a set width and 12px from the screen's sides. It doesn't clip or overflow at 320. - Also fixed on the way: ⌘K's `search.visit` call (added on dev today) was sent without an idempotency key, so the server turned it away every time. It now goes through `visited()` with a key. - `e2e/picker.spec.ts`: `[[` and `@` find a note through search, and Enter writes `[Title](<Title.md>)`. Runs in Chromium and WebKit at 390 and 1440. The full picker (embeds, Create note, Tab, a list that shows on the first keystroke) and the cards come in follow-up PRs on #165. Verified locally: picker spec 8/8 (Chromium and WebKit, 390 and 1440); editor, shortcuts and links specs pass. Screenshots at 320, 390 and 1440, light and dark, are on #165. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Web: @ and [[ offer notes again, from search (#165)
Some checks failed
CI / rust (pull_request) Successful in 2m3s
CI / web (pull_request) Failing after 7m18s
536adc4171
Why they showed nothing: the editor's link shortcuts (@ and [[) only
offer notes when the app hands them a search, and Editor.svelte never
did. The completion source returned nothing on every keystroke.

- One search client (lib/search.ts) for ⌘K and the link picker, on
  search.query, so ranking, typo fixes and "used lately" match ⌘K.
- lib/link-targets.ts turns hits into link targets; offline or on an
  error it falls back to notes whose title matches. Never offers the
  note itself. A typed [[Title]] links the note with that title.
- The picker sits on <body> with the palette's glass and the app font,
  a set width, 12px from the screen's sides, so it never clips or
  overflows at 320.
- e2e/picker.spec.ts: [[ and @ find a note by search and Enter writes a
  standard [Title](<Title.md>) link, Chromium and WebKit, 390 and 1440.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Superseded by #261 (same change, rebased on dev; this one conflicted in cm.css).

Superseded by #261 (same change, rebased on dev; this one conflicted in cm.css).
kayg closed this pull request 2026-10-14 11:58:52 +00:00
Some checks failed
CI / rust (pull_request) Successful in 2m3s
CI / web (pull_request) Failing after 7m18s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!220
No description provided.