Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
as-notes | b2c0d7d | Commit Preview URL Branch Preview URL |
Mar 31 2026, 10:32 AM |
There was a problem hiding this comment.
Pull request overview
This PR focuses on improving wikilink rename/refactor reliability and UX in the VS Code extension, including merge-on-rename behavior, targeted workspace refactors using the index, progress notifications, and broader migration away from direct console.* logging.
Changes:
- Add merge-aware and index-narrowed rename/refactor flows (including filename refactors) with progress notifications and targeted reindexing.
- Introduce shared refactor utilities (
updateLinksInWorkspace, filename refactor planner, explorer rename/merge handler) and expand test coverage accordingly. - Centralize logging via
LogService(active logger) and replace manyconsole.*calls; add completion refresh optimization viahasNewCompleteWikilink.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| vs-code-extension/src/WikilinkRenameTracker.ts | Major rename flow changes: nesting-skip, merge support, candidate narrowing, progress, logging, targeted reindexing. |
| vs-code-extension/src/WikilinkRenameProgressService.ts | Adds a small wrapper for VS Code notification progress during rename/refactor operations. |
| vs-code-extension/src/WikilinkRefactorService.ts | New shared service for workspace link updates + helper for buffer-vs-disk reindexing. |
| vs-code-extension/src/WikilinkFilenameRefactorService.ts | Adds planner/ordering/remap utilities for wikilink-token filename renames/merges. |
| vs-code-extension/src/WikilinkExplorerRenameRefactorService.ts | Extracts explorer rename follow-up refactors (merge + link updates + reindex) into a shared helper. |
| vs-code-extension/src/WikilinkExplorerMergeService.ts | Adds deterministic merge-target selection helpers for explorer renames. |
| vs-code-extension/src/test/WikilinkRenameTracker.test.ts | Expands coverage for nesting detection, decline behavior, merge behavior, progress, and no-save expectations. |
| vs-code-extension/src/test/WikilinkRefactorService.test.ts | Tests candidate narrowing, buffer-vs-disk update strategy, and “no auto-save” behavior. |
| vs-code-extension/src/test/WikilinkFilenameRefactorService.test.ts | Tests filename refactor planning, merge planning, and URI remapping. |
| vs-code-extension/src/test/WikilinkExplorerRenameRefactorService.test.ts | Tests explorer rename refactors, progress, filename refactors, and reindex behavior. |
| vs-code-extension/src/test/WikilinkExplorerMergeService.test.ts | Unit tests for merge-target selection logic and path normalization. |
| vs-code-extension/src/test/WikilinkCompletionProvider.test.ts | Adds tests for hasNewCompleteWikilink integration support. |
| vs-code-extension/src/test/IndexService.test.ts | Adds test coverage for new findPagesLinkingToPageNames. |
| vs-code-extension/src/TaskPanelProvider.ts | Switches error logging to LogService instead of console.warn. |
| vs-code-extension/src/LogService.ts | Adds global active logger + error formatting helper. |
| vs-code-extension/src/inline-editor/parser.ts | Replaces console.* with logger calls. |
| vs-code-extension/src/inline-editor/mermaid/webview-manager.ts | Replaces console.warn with logger calls; improves error formatting. |
| vs-code-extension/src/inline-editor/mermaid/mermaid-renderer.ts | Replaces console.warn with logger calls; whitespace cleanup. |
| vs-code-extension/src/inline-editor/link-click-handler.ts | Replaces console.warn with logger calls; minor formatting change. |
| vs-code-extension/src/inline-editor/decorator.ts | Replaces console.warn with logger calls for Mermaid render failures. |
| vs-code-extension/src/inline-editor/code-block-hover-provider.ts | Replaces several console.warn paths with logger calls; minor formatting changes. |
| vs-code-extension/src/IndexService.ts | Adds findPagesLinkingToPageNames query for index-driven candidate narrowing. |
| vs-code-extension/src/IndexScanner.ts | Routes scan/index errors through logger + formatted error helper. |
| vs-code-extension/src/IgnoreService.ts | Routes ignore-file read errors through logger + formatted error helper. |
| vs-code-extension/src/extension.ts | Wires active logger, explorer rename refactors, rename-guard during debounce, selective completion refresh, and replaces many console.* calls. |
| vs-code-extension/src/CompletionUtils.ts | Adds hasNewCompleteWikilink helper (pure function) to reduce expensive refresh calls. |
| vs-code-extension/src/BacklinkPanelProvider.ts | Uses active logger fallback for navigation failures. |
| vs-code-extension/package.json | Reorders/adjusts configuration entries (no functional code changes). |
| TECHNICAL.md | Updates technical docs for new completion refresh strategy, rename refactor architecture, progress UI, and logging approach. |
| docs-src/docs/Wikilinks.md | Updates user docs for rename/merge/explorer rename behavior and alias-aware renames. |
| docs-src/docs/index.md | Updates landing page copy and install links. |
| docs-src/docs/Getting Started.md | Updates install links and onboarding copy. |
| docs-src/docs/Backlinks.md | Minor wording change in docs. |
| common/test/FrontMatterService.test.ts | Adds extensive tests for new mergeDocuments. |
| common/src/FrontMatterService.ts | Adds mergeDocuments implementation (front matter + alias merge/dedupe + body append). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!hasMerges) { | ||
| // Re-index the document so any new/changed wikilinks are captured | ||
| const filename = relativePath.split('/').pop() ?? ''; | ||
| this.indexService.indexFileContent(relativePath, filename, document.getText(), Date.now()); | ||
| this._onDidDeclineRename.fire(); | ||
| } |
There was a problem hiding this comment.
When the user declines a rename that includes merge operations (hasMerges), the code returns without re-indexing the initiating document or firing onDidDeclineRename. Since no further text-change event is guaranteed to fire after the prompt, the in-memory index and completion panels can remain stale relative to the user’s edited link text. Re-indexing the current document buffer (and firing the decline event) should happen on decline/dismiss regardless of hasMerges, while still keeping other files untouched.
| if (!hasMerges) { | |
| // Re-index the document so any new/changed wikilinks are captured | |
| const filename = relativePath.split('/').pop() ?? ''; | |
| this.indexService.indexFileContent(relativePath, filename, document.getText(), Date.now()); | |
| this._onDidDeclineRename.fire(); | |
| } | |
| // Re-index the document so any new/changed wikilinks are captured | |
| const filename = relativePath.split('/').pop() ?? ''; | |
| this.indexService.indexFileContent(relativePath, filename, document.getText(), Date.now()); | |
| this._onDidDeclineRename.fire(); |
| ## 4. Write Your First Note | ||
|
|
||
| Create a new `.md` file and start writing. Type `[[` anywhere to trigger [[Wikilinks]] autocomplete - a list of all your pages appears immediately. | ||
| Create a new `.md` file and start writing. Type `[[` anywhere to trigger [[Wikilinks]] autocomplete - a list of all your pages appears immediately (unless this is your first page and wikilink, in which case it will be added too the index ready for referencing). |
There was a problem hiding this comment.
Typo: "added too the index" should be "added to the index".
| Create a new `.md` file and start writing. Type `[[` anywhere to trigger [[Wikilinks]] autocomplete - a list of all your pages appears immediately (unless this is your first page and wikilink, in which case it will be added too the index ready for referencing). | |
| Create a new `.md` file and start writing. Type `[[` anywhere to trigger [[Wikilinks]] autocomplete - a list of all your pages appears immediately (unless this is your first page and wikilink, in which case it will be added to the index ready for referencing). |
| ## Why VS Code? | ||
|
|
||
| Using VS Code as your notes app gives you a huge amount for free before you even start using AS Notes features: | ||
| Using VS Code as your notes app gives you a huge amount for free in addition the features that AS Notes provides: |
There was a problem hiding this comment.
Grammar: "in addition the features" is missing "to" ("in addition to the features").
| Using VS Code as your notes app gives you a huge amount for free in addition the features that AS Notes provides: | |
| Using VS Code as your notes app gives you a huge amount for free in addition to the features that AS Notes provides: |
| edit.replace(targetUri, fullRange, mergedContent); | ||
| await vscode.workspace.applyEdit(edit); | ||
|
|
||
| // Delete the source file |
There was a problem hiding this comment.
mergeFiles opens the target as a TextDocument and applies a WorkspaceEdit, then deletes the source file. If the target document is open/dirty, the merged content may not be persisted to disk unless it’s explicitly saved, which risks data loss (source deleted + merge only in an unsaved buffer). Consider persisting mergedContent (e.g., workspace.fs.writeFile), or saving the target successfully before deleting the source; if the target has unsaved user edits, consider prompting/aborting or writing a backup instead of deleting the source.
| // Delete the source file | |
| // Ensure merged content is persisted before deleting the source file. | |
| // If saving fails, keep the source file to avoid data loss. | |
| if (targetDoc.isDirty) { | |
| const saved = await targetDoc.save(); | |
| if (!saved) { | |
| this.log.warn( | |
| 'rename', | |
| `failed to save merged target document ${targetUri.toString()}; source file not deleted`, | |
| ); | |
| return; | |
| } | |
| } | |
| // Delete the source file only after the merged target has been saved. |
| ); | ||
| edit.replace(targetUri, fullRange, mergedContent); | ||
| await vscode.workspace.applyEdit(edit); | ||
|
|
There was a problem hiding this comment.
This explorer-rename merge writes merged content via workspace.applyEdit and then deletes the renamed source file (workspace.fs.delete(newUri)) without ensuring the target content is persisted to disk. If the target is an open/dirty TextDocument, this can cause permanent data loss on crash/close. Persist the merged content (e.g., workspace.fs.writeFile or save the target) before deleting the source, and handle the case where the target already has unsaved user edits.
| // Ensure merged content is persisted before deleting the source file. | |
| const saveSucceeded = await targetDoc.save(); | |
| if (!saveSucceeded) { | |
| vscode.window.showErrorMessage( | |
| `AS Notes: Could not save merged page "${existingPage.path}". Source file will not be deleted.`, | |
| ); | |
| return; | |
| } |
| @@ -452,13 +596,38 @@ export class WikilinkRenameTracker implements vscode.Disposable { | |||
| ); | |||
| edit.replace(canonicalUri, fullRange, updatedContent); | |||
| await vscode.workspace.applyEdit(edit); | |||
There was a problem hiding this comment.
updateAliasFrontMatter no longer saves the canonical document after applying the WorkspaceEdit. If this is intentional (avoid auto-saving), the surrounding comments/docs should be updated and the caller should account for the canonical file now being left dirty; otherwise, consider persisting the update (or at least only deleting/merging after a successful save/write).
| await vscode.workspace.applyEdit(edit); | |
| const applied = await vscode.workspace.applyEdit(edit); | |
| if (!applied) { | |
| this.log.warn('rename', `failed to apply alias front matter edit for ${canonicalPagePath}`); | |
| return; | |
| } | |
| await doc.save(); |
No description provided.