Repository navigation
feat(nsgo): completions, find, formatting and links in source mode - #291
Merged
Merged
Conversation
The second half of plan 0011's Phase 2: source mode in the NSGo client gets what the MyGo client's editor does on top of the text. - Completions on the editor's list: [[ notes in the vault's link format, [[note# headings, [[note#^ blocks and #tags by count, from the vault's catalog (internal/desktop/catalog), which the client now keeps. - Find and replace in the note: a bar over source mode on the editor's search, with case, whole word and regular expressions; mod+F and mod+H in the editor, the notes' filter elsewhere. - Obsidian's formatting commands (markup.Commands) in the palette and by their keys in the editor, applied with Ref.Edit as 1 step of undo. Inside the editor mod+K inserts a Markdown link, as in the MyGo client; mod+O stays the palette. - Smart lists on Enter and Backspace, bound once the editor has the keyboard, and a mark typed over a selection wraps it. - Following the link or tag under the caret (Alt+Enter, Ctrl+click, F12): a note at its heading or block, a note made for an unresolved link, a tag in Search vault. - The inline title, which renames the note through the client's move, asking about links unless the vault updates them.
frostyard-machines
approved these changes
Nov 25, 2026
4 tasks done
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.
Summary
The second half (2b) of Phase 2 of plan 0011, "Source mode on NSGo's code editor". Source mode in the NSGo client (
cmd/frostnotes-nsgo) now does what the MyGo client's editor does on top of the text. The plain logic is ininternal/desktop/markupandinternal/desktop/catalog, with unit tests. Each item has a test in the client's suite, against a real notesd.links.go,markup.CompletionAt). They use the editor'sCompletion,CompletionTriggerCharacters([[,#,^),OnCompletionRequestandRef.PresentCompletions.[[: the vault's files and aliases, in the vault's link format (catalog.NoteSources). The list asks again as the query grows.[[note#: the note's headings. After[[note#^: its blocks.#: tags, by count.vault.settingsfor the link format, the new-note location and Update links.TestCompletionsInSourceMode.findbar.go). It usesEditor.Search,Ref.Run(FindNext/FindPrevious)andRef.Replace/ReplaceAll.Input,ToggleButton(Match case, Match whole word, Use regular expression),IconButtonandButton, on the kit's spacing. It shows "2 of 4", "No results" or "Not a regular expression".TestFindAndReplaceInTheNote. It covers case, whole word, regexp with${1}, Replace all as 1 undo step, and Escape.markup.Commandsholds the 22 that edit text: bold, italics, strike, highlight, code, insert link, checklist, comment, delete paragraph, remove heading and set heading 1 to 6, wikilink, embed, tag, blockquote, bullet and numbered list.find.go, viaeditToolsinedit.go) also gets Search current file, Search & replace, Indent and Unindent list, Undo, Redo and Follow link under cursor, each with its keys. That makes 29 commands.Ref.Editas 1 undo step. A test ininternal/desktop/commandschecks that the IDs, titles and editor keys match the MyGo client's table.TestFormattingCommandsInSourceMode.TestAppKeysAroundTheEditorfound. They usemarkup.ContinueMarkupandDeleteMarkupBackward, and fall back toRef.Run(editor.Newline)andDeleteBackward.*_~=and backtick) typed over a selection wraps it (markup.WrapInMark). The editor's typing is undone and the wrap is made as 1 step. If that typing had merged into an earlier undo step, the wrap is completed as a second step instead.TestSmartListsAndMarksInSourceMode. It checks the 1-step undo.OnDefinitionRequest. Ctrl over a link underlines it (PresentDefinitionLink).#headingor#^block(markup.SubpathLine,Ref.GoToLine).catalog.LinkedNotePath).tag:#x.TestFollowingLinksInSourceMode. It runs headless as a desktop idiom, because the editor only handles Ctrl+press there; it also passes in GTK.title.go). It sits above the note in both modes. Enter or leaving the field renames the file through the client's existing move (manage.go,catalog.Renamed).TestInlineTitleRenamesTheNote. It checks that another note's link is rewritten on disk.TestSeveralCaretsInSourceMode.Ctrl+K: I followed the MyGo client and Obsidian. Inside source mode's editor, mod+K inserts a Markdown link. Everywhere else mod+K stays the palette, and mod+O opens the palette from the editor.
Ctrl+F: inside the editor, mod+F and mod+H open find (and replace) in the note. Anywhere else, mod+F still focuses the notes tree's filter.
TestFilterNarrowsTheTreenow presses it from the title field.Keys the editor gives up: NSGo's mod+D (select next occurrence) and mod+L (select line) give way to Obsidian's Delete paragraph and Toggle checkbox status.
Left out
internal/desktop/systemdoes not build for the web.Other changes:
replaceSourcein the tests types line breaks as Shift+Enter, so smart lists don't continue lists.docs/design/app.md(the NSGo section's palette, keys, filter and source mode, plus the live suite) andAGENTS.md(the map's lines formarkupandcatalog).Risk tier
Risk tier: 2 — behaviour change in the NSGo client's editor and its keys. I matched all 33 changed files with a script against
.github/risk-paths.json(schema version 2, 22 globs, with braces and**expanded). None match, so all are at the default level, L3. The change touches no workflow, release, install, secrets or auth path.Docs housekeeping
docs/design/app.mdsits in the section that already links plan 0011 and ADR-0049. No new doc.Verification
make checkgreen (host): exit 0 on this tree. It includesmake nsgo-check, which runs the headless suite and the wasm build.make nsgo-livegreen (Xvfb,GDK_BACKEND=x11from the Makefile): exit 0, 42 passed, 0 failed, 0 skipped. That includes the 7 new tests and Ctrl+click in GTK.make nsgo-bench: exit 0. Source 8.61 ms and live 5.18 ms per keystroke on this host. On main before this change it was 8.3 ms and 5.0 ms (the numbers from feat(nsgo): edit source mode in NSGo's code editor #290).TestNoLiteralLookspasses. No look is written as a number. The title usesworkspaceui.Heading(1)and the bar uses the kit's spacing.make nsgo-pictures: 14 PNGs changed. A small Go program compared each one pixel by pixel with main. Every difference is in the editor's pane: the inline title, which pushes the text down. The other 11 came out byte-identical. I looked atnote-source,dark-note-live-previewandnarrow-note.