diff --git a/autoload/nuwiki/commands.vim b/autoload/nuwiki/commands.vim index 1aecd5a..7bae968 100644 --- a/autoload/nuwiki/commands.vim +++ b/autoload/nuwiki/commands.vim @@ -1,5 +1,5 @@ " autoload/nuwiki/commands.vim — Vim-side wrappers around the LSP -" commands the server advertises (Phase 19). +" commands the server advertises. " " Lives in autoload/ so the cost is paid only when a `:Vimwiki*` / " `:Nuwiki*` command is actually invoked. Dispatches via vim-lsp's @@ -634,9 +634,9 @@ function! nuwiki#commands#rename_file() abort endif endfunction -" ===== §13.1 deferred ===== +" ===== Deferred ===== -" §13.1 Cluster A — list rewriters. +" Cluster A — list rewriters. " `gl` — remove done items from the current list only. Passing the " cursor position scopes the server to the contiguous list block under it. @@ -737,7 +737,7 @@ function! nuwiki#commands#list_toggle_or_add_checkbox() abort let l:new = strpart(l:line, 0, l:end) . '[ ] ' . strpart(l:line, l:end) call setline('.', l:new) endfunction -" §13.1 Cluster B — table rewriters. +" Cluster B — table rewriters. function! nuwiki#commands#table_insert(...) abort let l:cols = a:0 >= 1 ? str2nr(a:1) : 3 @@ -815,7 +815,7 @@ function! nuwiki#commands#colorize(...) abort \ . strpart(l:line, l:right - 1) call setline('.', l:new) endfunction -" §13.1 Cluster C — link helpers. +" Cluster C — link helpers. function! nuwiki#commands#paste_link() abort let l:p = s:cursor_position() diff --git a/autoload/nuwiki/lsp.vim b/autoload/nuwiki/lsp.vim index 1238ea0..34759c0 100644 --- a/autoload/nuwiki/lsp.vim +++ b/autoload/nuwiki/lsp.vim @@ -1,6 +1,6 @@ " autoload/nuwiki/lsp.vim — Vim (non-Neovim) LSP client wiring. " -" Spec §7.4 preference order: +" Preference order: " 1. vim-lsp (matoto/vim-lsp) " 2. coc.nvim " 3. Print an error if neither is available. diff --git a/crates/nuwiki-core/src/ast/block.rs b/crates/nuwiki-core/src/ast/block.rs index 2a12d09..52ccf8d 100644 --- a/crates/nuwiki-core/src/ast/block.rs +++ b/crates/nuwiki-core/src/ast/block.rs @@ -1,6 +1,4 @@ //! Block-level AST nodes and their supporting types. -//! -//! See SPEC.md §6.4. use super::inline::InlineNode; use super::span::Span; @@ -17,7 +15,7 @@ pub enum BlockNode { DefinitionList(DefinitionListNode), Table(TableNode), Comment(CommentNode), - /// Vimwiki tag line — `:tag1:tag2:`. Phase 12 (v1.1). The placement + /// Vimwiki tag line — `:tag1:tag2:`. The placement /// rule (file / heading / standalone) is captured in `TagScope` so /// LSP handlers and renderers can treat the three differently. Tag(TagNode), diff --git a/crates/nuwiki-core/src/ast/inline.rs b/crates/nuwiki-core/src/ast/inline.rs index 59c48b5..47f878a 100644 --- a/crates/nuwiki-core/src/ast/inline.rs +++ b/crates/nuwiki-core/src/ast/inline.rs @@ -1,6 +1,6 @@ //! Inline AST nodes. //! -//! See SPEC.md §6.4. The link-related variants (`WikiLink`, `ExternalLink`, +//! The link-related variants (`WikiLink`, `ExternalLink`, //! `Transclusion`, `RawUrl`) wrap structs defined in `super::link`. use super::link::{ExternalLinkNode, RawUrlNode, TransclusionNode, WikiLinkNode}; diff --git a/crates/nuwiki-core/src/ast/link.rs b/crates/nuwiki-core/src/ast/link.rs index 8f6a74c..e3b230c 100644 --- a/crates/nuwiki-core/src/ast/link.rs +++ b/crates/nuwiki-core/src/ast/link.rs @@ -1,6 +1,6 @@ //! Link-related AST nodes and supporting types. //! -//! See SPEC.md §6.4. All nodes here are inline (`InlineNode` variants); +//! All nodes here are inline (`InlineNode` variants); //! they live in their own module because the link model has enough surface //! area (kinds, anchors, interwiki indirection) to warrant separation. diff --git a/crates/nuwiki-core/src/ast/mod.rs b/crates/nuwiki-core/src/ast/mod.rs index 35ca6c4..ca868f2 100644 --- a/crates/nuwiki-core/src/ast/mod.rs +++ b/crates/nuwiki-core/src/ast/mod.rs @@ -1,7 +1,7 @@ //! AST types for nuwiki documents. //! //! Types here are syntax-agnostic — both vimwiki and (eventually) markdown -//! produce the same node shapes. See SPEC.md §6.4. +//! produce the same node shapes. pub mod block; pub mod inline; @@ -28,7 +28,7 @@ pub use visit::{ walk_table, walk_table_row, Visitor, }; -/// Root of an AST. See SPEC.md §6.4. +/// Root of an AST. #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct DocumentNode { pub span: Span, @@ -37,8 +37,7 @@ pub struct DocumentNode { } /// Document-level placeholders parsed from `%title` / `%nohtml` / `%template` -/// / `%date` directives, plus the v1.1 file-level tag accumulator -/// (SPEC §12.3). See SPEC.md §9. +/// / `%date` directives, plus the file-level tag accumulator. /// /// New fields are added at the bottom; consumers should construct with /// `..Default::default()` to stay forward-compatible. @@ -48,7 +47,7 @@ pub struct PageMetadata { pub nohtml: bool, pub template: Option, pub date: Option, - /// File-scope tags parsed by the v1.1 tag lexer (Phase 12). Convenience + /// File-scope tags parsed by the tag lexer. Convenience /// projection of the `BlockNode::Tag` nodes whose scope is `File`. pub tags: Vec, } diff --git a/crates/nuwiki-core/src/ast/span.rs b/crates/nuwiki-core/src/ast/span.rs index 3d6a5f8..aefc11c 100644 --- a/crates/nuwiki-core/src/ast/span.rs +++ b/crates/nuwiki-core/src/ast/span.rs @@ -1,6 +1,6 @@ //! Source positions and spans carried on every AST node. //! -//! See SPEC.md §6.5. Positions are 0-indexed; `column` is a byte offset +//! Positions are 0-indexed; `column` is a byte offset //! within a line; `offset` is a byte offset from the start of the document. #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, PartialOrd, Ord)] diff --git a/crates/nuwiki-core/src/ast/visit.rs b/crates/nuwiki-core/src/ast/visit.rs index 23312ce..30d5783 100644 --- a/crates/nuwiki-core/src/ast/visit.rs +++ b/crates/nuwiki-core/src/ast/visit.rs @@ -5,10 +5,10 @@ //! Override any method to short-circuit or augment traversal — call the //! matching `walk_*` from your override to keep descending. //! -//! Pattern follows `rustc`'s and `syn`'s visitors. See SPEC.md §6.4 + P4. +//! Pattern follows `rustc`'s and `syn`'s visitors. //! //! Read-only for now. A `VisitorMut` flavor can be added when transformations -//! become relevant (post-Phase 5). +//! become relevant. use super::block::{ BlockNode, BlockquoteNode, CommentNode, DefinitionItemNode, DefinitionListNode, ErrorNode, diff --git a/crates/nuwiki-core/src/date.rs b/crates/nuwiki-core/src/date.rs index 5f91bb4..8687fc3 100644 --- a/crates/nuwiki-core/src/date.rs +++ b/crates/nuwiki-core/src/date.rs @@ -1,6 +1,6 @@ -//! Date primitives for the diary subsystem (Phase 16). +//! Date primitives for the diary subsystem. //! -//! v1.1 deliberately doesn't pull in `chrono` or `time`. The diary feature +//! This crate deliberately doesn't pull in `chrono` or `time`. The diary feature //! only needs `YYYY-MM-DD` parsing/formatting and ±1 day arithmetic, which //! is small enough that the dependency cost outweighs the convenience. //! @@ -56,7 +56,7 @@ impl DiaryDate { format!("{:04}-{:02}-{:02}", self.year, self.month, self.day) } - /// UTC "today" computed from `SystemTime::now()`. Phase 16's diary + /// UTC "today" computed from `SystemTime::now()`. The diary /// commands intentionally use UTC — local-time semantics depend on a /// timezone DB we don't ship and would surprise users crossing DST /// boundaries. diff --git a/crates/nuwiki-core/src/lib.rs b/crates/nuwiki-core/src/lib.rs index 8401d3a..0c57b44 100644 --- a/crates/nuwiki-core/src/lib.rs +++ b/crates/nuwiki-core/src/lib.rs @@ -1,7 +1,7 @@ //! Core parser, AST, and renderer for nuwiki. //! //! This crate is editor-independent and must never depend on `nuwiki-lsp` or -//! `nuwiki-ls`. See SPEC.md §6.2 for the dependency rules. +//! `nuwiki-ls`. pub mod ast; pub mod date; diff --git a/crates/nuwiki-core/src/render/html.rs b/crates/nuwiki-core/src/render/html.rs index 59cea3a..1d3e792 100644 --- a/crates/nuwiki-core/src/render/html.rs +++ b/crates/nuwiki-core/src/render/html.rs @@ -3,12 +3,12 @@ //! Walks a `DocumentNode` and writes HTML5 fragments. The renderer is //! configured with a link resolver (callback that turns a `LinkTarget` into //! a URL string) and, optionally, an enclosing template with substitution -//! placeholders (SPEC.md §6.8 + §12.8). +//! placeholders. //! //! Substitution model: `{{content}}` and `{{title}}` are computed from //! the rendered body and the document's metadata; `with_var(k, v)` / -//! `with_vars(map)` add arbitrary key→value pairs (Phase 17 ships -//! `{{date}}`, `{{root_path}}`, `{{toc}}`). Order: `{{content}}` is +//! `with_vars(map)` add arbitrary key→value pairs (`{{date}}`, +//! `{{root_path}}`, `{{toc}}`). Order: `{{content}}` is //! substituted first so a body that happens to contain a literal //! `{{title}}` isn't itself rewritten in the next pass. //! @@ -44,7 +44,7 @@ pub struct HtmlRenderer { /// `color_dic`-style override: vimwiki colour-tag names → CSS /// values (`"red"` / `"#ffe119"` / `"oklch(…)"`). Unspecified /// names fall through to the default `class="color-"` - /// rendering. Matches SPEC §12.11 `color_dic`. + /// rendering. Matches vimwiki's `color_dic`. colors: HashMap, } @@ -662,7 +662,7 @@ fn table_spans(table: &TableNode) -> Vec> { // ===== Default link resolver ===== -/// Default `LinkResolver`. Mirrors the conventions in SPEC.md §9: +/// Default `LinkResolver`. Mirrors the vimwiki link conventions: /// wiki pages become `path.html`; interwiki links land in sibling /// directories; diary entries land under `diary/`; file/local schemes /// use their literal path; anchor-only links collapse to a fragment. diff --git a/crates/nuwiki-core/src/render/mod.rs b/crates/nuwiki-core/src/render/mod.rs index a305703..d22520a 100644 --- a/crates/nuwiki-core/src/render/mod.rs +++ b/crates/nuwiki-core/src/render/mod.rs @@ -1,6 +1,6 @@ //! Document renderers. //! -//! SPEC.md §6.8: a `Renderer` is writer-based, takes a `DocumentNode`, and +//! A `Renderer` is writer-based, takes a `DocumentNode`, and //! emits its representation into any `Write`. Errors propagate through //! `io::Result` — there's no separate per-renderer error type so the trait //! stays object-safe (`Box` is useful for the LSP later). diff --git a/crates/nuwiki-core/src/syntax/mod.rs b/crates/nuwiki-core/src/syntax/mod.rs index 4dffa33..39fc746 100644 --- a/crates/nuwiki-core/src/syntax/mod.rs +++ b/crates/nuwiki-core/src/syntax/mod.rs @@ -4,8 +4,6 @@ //! a `Lexer` produces a `TokenStream`, a `Parser` consumes it and produces a //! `DocumentNode`. A `SyntaxPlugin` is the type-erased facade that the LSP //! layer holds in a `SyntaxRegistry`. -//! -//! See SPEC.md §6.3 (interface) and §6.6 (lexer strategy). pub mod registry; pub mod vimwiki; @@ -15,7 +13,7 @@ pub use registry::SyntaxRegistry; use crate::ast::DocumentNode; /// Eager token buffer produced by a `Lexer`. The newtype keeps the door -/// open to a lazy/streaming variant later (SPEC.md §6.6) without breaking +/// open to a lazy/streaming variant later without breaking /// callers. #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct TokenStream { @@ -89,7 +87,7 @@ pub trait Lexer { } /// Parser half of a syntax plugin. Consumes a `TokenStream` and produces a -/// `DocumentNode`. Per SPEC.md §6.7 parsing is resilient — malformed input +/// `DocumentNode`. Parsing is resilient — malformed input /// becomes `BlockNode::Error(ErrorNode)`, never a hard failure. pub trait Parser { type Token; @@ -104,13 +102,13 @@ pub trait Parser { /// hold heterogeneous plugins behind a single trait object. /// /// `Send + Sync` is required — the LSP server stores plugins behind an `Arc` -/// and shares them across request handler tasks (SPEC.md §6.3). +/// and shares them across request handler tasks. pub trait SyntaxPlugin: Send + Sync { fn id(&self) -> &str; fn display_name(&self) -> &str; /// File extensions associated with this syntax. Each entry includes the - /// leading dot, e.g. `[".wiki"]`. See SPEC.md §6.3. + /// leading dot, e.g. `[".wiki"]`. fn file_extensions(&self) -> &[&str]; fn parse(&self, text: &str) -> DocumentNode; diff --git a/crates/nuwiki-core/src/syntax/registry.rs b/crates/nuwiki-core/src/syntax/registry.rs index 84de3d7..b12fa64 100644 --- a/crates/nuwiki-core/src/syntax/registry.rs +++ b/crates/nuwiki-core/src/syntax/registry.rs @@ -1,4 +1,4 @@ -//! Registry of syntax plugins. See SPEC.md §6.3. +//! Registry of syntax plugins. //! //! Plugins are stored behind `Arc` so the LSP layer can //! hand a cheap clone to per-document tasks without re-locking the registry. diff --git a/crates/nuwiki-core/src/syntax/vimwiki/lexer.rs b/crates/nuwiki-core/src/syntax/vimwiki/lexer.rs index f8f13da..21948bb 100644 --- a/crates/nuwiki-core/src/syntax/vimwiki/lexer.rs +++ b/crates/nuwiki-core/src/syntax/vimwiki/lexer.rs @@ -1,6 +1,6 @@ //! Vimwiki lexer. //! -//! Hand-rolled, two-pass per SPEC.md §6.6: +//! Hand-rolled, two-pass: //! //! - **Block pass:** scan the source line by line, recognise structural //! constructs (headings, lists, tables, fences, comments, etc.), emit @@ -12,7 +12,7 @@ //! Both passes share one `Vec` so the parser sees a single, //! ordered stream. The lexer is permissive: every delimiter is emitted; the //! parser pairs them and falls back to literal text on mismatches. Spans are -//! stored as 0-indexed byte offsets per SPEC.md §6.5. +//! stored as 0-indexed byte offsets. //! //! Multi-line constructs (`{{{ }}}`, `{{$ }}$`, `%%+ +%%`) flip a //! `BlockMode` so subsequent lines are treated as raw content until the @@ -97,13 +97,13 @@ pub enum VimwikiTokenKind { CommentMultiClose, CommentMultiLine(String), - // ----- Tags (SPEC §12.3) ----- + // ----- Tags ----- /// `:tag1:tag2:` — colon-delimited tag line. The lexer treats this as /// block-level (must be the entire trimmed content of the line). /// Scope (file / heading / standalone) is the parser's job. Tag(Vec), - // ----- Page placeholders (SPEC §9) ----- + // ----- Page placeholders ----- PlaceholderTitle(Option), PlaceholderNohtml, PlaceholderTemplate(Option), @@ -129,7 +129,7 @@ pub enum VimwikiTokenKind { TransclusionSep, RawUrl(String), - /// Lex error — never aborts the whole document (SPEC §6.7). + /// Lex error — never aborts the whole document. Error(String), } @@ -481,7 +481,7 @@ impl<'src> LexState<'src> { if trimmed.len() < 4 || !trimmed.bytes().all(|b| b == b'-') { return false; } - // SPEC §9: four or more dashes. Allow surrounding whitespace. + // Four or more dashes. Allow surrounding whitespace. let span = Span::new(self.line_start_pos(), self.line_end_pos(line)); self.push(VimwikiTokenKind::HorizontalRule, span); self.emit_newline(line); diff --git a/crates/nuwiki-core/src/syntax/vimwiki/mod.rs b/crates/nuwiki-core/src/syntax/vimwiki/mod.rs index 0667564..6b2d6d0 100644 --- a/crates/nuwiki-core/src/syntax/vimwiki/mod.rs +++ b/crates/nuwiki-core/src/syntax/vimwiki/mod.rs @@ -10,7 +10,7 @@ use crate::ast::DocumentNode; use crate::syntax::{Lexer, Parser, SyntaxPlugin}; /// SyntaxPlugin facade: chains `VimwikiLexer` + `VimwikiParser` so the -/// registry can hand out a single trait object per SPEC.md §6.3. +/// registry can hand out a single trait object. #[derive(Debug, Default, Clone)] pub struct VimwikiSyntax; diff --git a/crates/nuwiki-core/src/syntax/vimwiki/parser.rs b/crates/nuwiki-core/src/syntax/vimwiki/parser.rs index 95179d7..d0153fa 100644 --- a/crates/nuwiki-core/src/syntax/vimwiki/parser.rs +++ b/crates/nuwiki-core/src/syntax/vimwiki/parser.rs @@ -1,6 +1,6 @@ //! Vimwiki parser. //! -//! Hand-rolled recursive-descent over `Vec` (SPEC.md §6.7). +//! Hand-rolled recursive-descent over `Vec`. //! Resilient: never aborts the document. Anything the dispatcher can't //! claim becomes a `BlockNode::Error(ErrorNode)` so progress is //! guaranteed. @@ -28,7 +28,7 @@ //! //! `[[ ]]` payloads are inspected to choose between `WikiLinkNode` //! (the default) and `ExternalLinkNode` (when the target is a URL). The -//! `LinkTarget` enum follows SPEC §9: leading `/` is root-relative, +//! `LinkTarget` enum follows the vimwiki conventions: leading `/` is root-relative, //! `//` is filesystem-absolute, `wiki:` / `wn.:` are interwiki, //! `diary:` / `file:` / `local:` are their own kinds, and a trailing `/` //! marks a directory link. @@ -69,10 +69,10 @@ impl Parser for VimwikiParser { struct ParseState<'a> { toks: &'a [VimwikiToken], pos: usize, - /// Phase 12: count of `HeadingNode`s already pushed to `children`. + /// Count of `HeadingNode`s already pushed to `children`. /// `headings_seen - 1` is the most recent heading's index. headings_seen: usize, - /// Phase 12: source line of the most recently-emitted heading. + /// Source line of the most recently-emitted heading. /// `tag_line - last_heading_line ∈ {1, 2}` is a header-scope tag. last_heading_line: Option, } @@ -141,7 +141,7 @@ impl<'a> ParseState<'a> { } let before = self.pos; let block = self.parse_block(); - // Phase 12: file-scope tags get accumulated into metadata so + // File-scope tags get accumulated into metadata so // callers can read page-level tag membership without walking // the AST. The TagNode itself stays in `children` so renderers // see it too. @@ -280,7 +280,7 @@ impl<'a> ParseState<'a> { let inline = parse_inline_seq(&self.toks[inline_start..self.pos]); self.advance(); self.eat_newline(); - // Record for tag-scope resolution (Phase 12). + // Record for tag-scope resolution. self.headings_seen += 1; self.last_heading_line = Some(span_end.line); return BlockNode::Heading(HeadingNode { diff --git a/crates/nuwiki-core/tests/syntax.rs b/crates/nuwiki-core/tests/syntax.rs index ebdc93d..4f0ef14 100644 --- a/crates/nuwiki-core/tests/syntax.rs +++ b/crates/nuwiki-core/tests/syntax.rs @@ -136,7 +136,7 @@ fn registry_can_parse_through_trait_object() { } /// Compile-time check: SyntaxRegistry must be Send + Sync so the LSP server -/// can share it across handler tasks (SPEC.md §6.3). +/// can share it across handler tasks. #[test] fn registry_is_send_and_sync() { fn assert_send_sync() {} diff --git a/crates/nuwiki-core/tests/tags.rs b/crates/nuwiki-core/tests/tags.rs index b524fa1..c92c727 100644 --- a/crates/nuwiki-core/tests/tags.rs +++ b/crates/nuwiki-core/tests/tags.rs @@ -1,4 +1,4 @@ -//! Phase 12 tag tests: lexer + parser + renderer behaviour on +//! Tag tests: lexer + parser + renderer behaviour on //! `:tag:` lines, plus the scope-detection rules. use nuwiki_core::ast::{BlockNode, TagScope}; diff --git a/crates/nuwiki-lsp/src/commands.rs b/crates/nuwiki-lsp/src/commands.rs index 70b2810..3bc74eb 100644 --- a/crates/nuwiki-lsp/src/commands.rs +++ b/crates/nuwiki-lsp/src/commands.rs @@ -1,10 +1,10 @@ //! `workspace/executeCommand` dispatcher. //! -//! Phase 13 introduced the router + `nuwiki.file.delete`. Phase 14 added -//! the cheap surgical edits — checkbox toggle/cycle/reject, heading -//! promote/demote, "next task" navigation. Phase 15 layers on the -//! generation + workspace-query commands: `toc.generate`, -//! `links.generate`, `workspace.checkLinks`, `workspace.findOrphans`. +//! The router handles `nuwiki.file.delete`, the cheap surgical edits — +//! checkbox toggle/cycle/reject, heading promote/demote, "next task" +//! navigation — and the generation + workspace-query commands: +//! `toc.generate`, `links.generate`, `workspace.checkLinks`, +//! `workspace.findOrphans`. //! //! Every command resolves to either a `WorkspaceEdit` (the server then //! calls `apply_edit`) or a JSON `Value` (returned to the client) — see @@ -663,7 +663,7 @@ fn tags_rebuild(backend: &Backend, args: Vec) -> Result, St }))) } -// ===== Phase 18: multi-wiki picker commands ===== +// ===== multi-wiki picker commands ===== fn wiki_list_all(backend: &Backend) -> Result, String> { let wikis = backend.wikis_snapshot(); @@ -821,7 +821,7 @@ fn wiki_goto_page(backend: &Backend, args: Vec) -> Result, }))) } -// ===== §13.1 Cluster A: list rewriters ===== +// ===== Cluster A: list rewriters ===== fn list_remove_done(backend: &Backend, args: Vec) -> Result, String> { let p = parse_optional_uri_arg(args.clone())?; @@ -954,7 +954,7 @@ fn list_change_level(backend: &Backend, args: Vec) -> Result) -> Result, String> { #[derive(Deserialize)] @@ -1030,7 +1030,7 @@ fn table_move_column(backend: &Backend, args: Vec) -> Result//.wiki`. pub diary_index: String, /// `daily`/`weekly`/`monthly`/`yearly`. Picks the date format the - /// diary commands use. v1.1 ships `daily`; the others fall through - /// to vimwiki-style names but the commands are no-ops until - /// Cluster 4 lands. + /// diary commands use. `daily` is supported; the others fall through + /// to vimwiki-style names but the commands are no-ops for them. pub diary_frequency: String, /// First day of the week (`monday`..`sunday`). Used by weekly /// diary entry naming. @@ -74,7 +72,7 @@ pub struct WikiConfig { pub nested_syntaxes: std::collections::HashMap, /// Rebuild the page's TOC on save when set. pub auto_toc: bool, - /// Phase 17 HTML export options. See SPEC §12.8. + /// HTML export options. pub html: HtmlConfig, } @@ -104,7 +102,7 @@ pub struct HtmlConfig { /// to skip during `allToHtml*`. pub exclude_files: Vec, /// `color_dic`: vimwiki colour-tag name → CSS value mapping used - /// by the HTML renderer (SPEC §12.11). Empty by default; the + /// by the HTML renderer. Empty by default; the /// renderer falls back to `class="color-"` when a name /// isn't in the dict. pub color_dic: std::collections::HashMap, @@ -130,7 +128,7 @@ impl Default for HtmlConfig { impl HtmlConfig { /// Synthesise default paths under `root` when the user hasn't /// specified explicit ones. `html_path` defaults to `/_html` - /// and `template_path` to `/_templates` per SPEC §12.8. + /// and `template_path` to `/_templates`. pub fn from_root(root: &Path) -> Self { Self { html_path: root.join("_html"), @@ -284,7 +282,7 @@ fn default_links_space_char() -> String { " ".to_string() } -/// Fill in the v1.1 per-wiki keys that none of the constructors care +/// Fill in the per-wiki keys that none of the constructors care /// about. Centralising the defaults here keeps `empty()`, `from_root()`, /// the legacy single-wiki path, and `From` in sync. fn wiki_defaults() -> WikiDefaults { @@ -329,9 +327,9 @@ impl Config { /// Build a `Config` from `InitializeParams`. /// /// Priority for the wikis list: - /// 1. `initialization_options.wikis = [...]` (v1.1 shape) + /// 1. `initialization_options.wikis = [...]` (multi-wiki shape) /// 2. `initialization_options.wiki_root + file_extension + syntax` - /// (v1.0 single-wiki shape, P16) + /// (legacy single-wiki shape) /// 3. `workspace_folders[0]` if present /// 4. deprecated `root_uri` if present /// 5. empty list (server stays alive but won't index anything) @@ -445,7 +443,7 @@ mod opt_bool_or_int { #[serde(default, rename_all = "snake_case")] struct InitOptions { wikis: Option>, - // v1.0 single-wiki compat fields + // legacy single-wiki compat fields wiki_root: Option, file_extension: Option, syntax: Option, @@ -466,7 +464,7 @@ struct RawWiki { diary_rel_path: Option, #[serde(default)] diary_index: Option, - // Phase 17 HTML keys — all optional, fall back to per-root defaults. + // HTML keys — all optional, fall back to per-root defaults. #[serde(default)] html_path: Option, #[serde(default)] @@ -487,7 +485,7 @@ struct RawWiki { exclude_files: Option>, #[serde(default)] color_dic: Option>, - // v1.1 per-wiki keys mirroring vimwiki globals. All optional so + // per-wiki keys mirroring vimwiki globals. All optional so // existing single-wiki configs migrate without touching anything. #[serde(default)] index: Option, diff --git a/crates/nuwiki-lsp/src/diagnostics.rs b/crates/nuwiki-lsp/src/diagnostics.rs index 267b234..31769e1 100644 --- a/crates/nuwiki-lsp/src/diagnostics.rs +++ b/crates/nuwiki-lsp/src/diagnostics.rs @@ -1,6 +1,6 @@ //! Diagnostic sources beyond parse-time `ErrorNode`s. //! -//! Phase 15 lands the `nuwiki.link` source — broken-link warnings. Walks +//! The `nuwiki.link` source emits broken-link warnings. Walks //! every `WikiLinkNode` in the AST and emits one diagnostic per: //! - `Wiki` target that doesn't resolve to a page in the workspace index, //! - `Wiki`/`AnchorOnly` target with an anchor that matches neither a @@ -8,7 +8,7 @@ //! - `File`/`Local` target whose resolved path doesn't exist on disk. //! //! Interwiki, Diary, Raw, and external links are not diagnosed — -//! interwiki resolution is Phase 18's job, diary is Phase 16's, and we +//! interwiki resolution and diary handling live elsewhere, and we //! don't fetch URLs. use std::path::PathBuf; @@ -332,8 +332,7 @@ fn resolve_file_path( index.root.as_ref().map(|r| r.join(&candidate)) } -/// `nuwiki.link` diagnostics for a single document. Phase 11 left this as -/// a stub; Phase 15 fills it in. +/// `nuwiki.link` diagnostics for a single document. pub fn link_health( ast: &DocumentNode, text: &str, diff --git a/crates/nuwiki-lsp/src/diary.rs b/crates/nuwiki-lsp/src/diary.rs index eda13e4..ed291f1 100644 --- a/crates/nuwiki-lsp/src/diary.rs +++ b/crates/nuwiki-lsp/src/diary.rs @@ -1,4 +1,4 @@ -//! Diary subsystem (Phase 16) — pure helpers used by the +//! Diary subsystem — pure helpers used by the //! `nuwiki.diary.*` `executeCommand` handlers. //! //! All path/URI math lives here so the command dispatcher stays a thin diff --git a/crates/nuwiki-lsp/src/edits.rs b/crates/nuwiki-lsp/src/edits.rs index 7aad9ba..7f449c6 100644 --- a/crates/nuwiki-lsp/src/edits.rs +++ b/crates/nuwiki-lsp/src/edits.rs @@ -1,6 +1,6 @@ //! Helpers for building `WorkspaceEdit`s. //! -//! Phase 13+ (rename, list/table edits, link/TOC generation) all return +//! Rename, list/table edits, and link/TOC generation all return //! `WorkspaceEdit`. The builder centralises the byte-offset → LSP-position //! conversion (UTF-8 or UTF-16, matching whatever was negotiated in //! `initialize`) so each call site doesn't have to redo it. diff --git a/crates/nuwiki-lsp/src/export.rs b/crates/nuwiki-lsp/src/export.rs index 3ceeae4..88de5a8 100644 --- a/crates/nuwiki-lsp/src/export.rs +++ b/crates/nuwiki-lsp/src/export.rs @@ -1,4 +1,4 @@ -//! HTML export — pure helpers shared by the Phase 17 `nuwiki.export.*` +//! HTML export — pure helpers shared by the `nuwiki.export.*` //! command handlers. Side-effecting work (reading the template from //! disk, writing the rendered HTML, copying CSS) lives in `commands.rs` //! since the dispatcher is the one with a `&Backend` and async context. diff --git a/crates/nuwiki-lsp/src/folding.rs b/crates/nuwiki-lsp/src/folding.rs index 49b1718..e9cf32c 100644 --- a/crates/nuwiki-lsp/src/folding.rs +++ b/crates/nuwiki-lsp/src/folding.rs @@ -1,4 +1,4 @@ -//! `textDocument/foldingRange` provider — SPEC §12.10 / P14. +//! `textDocument/foldingRange` provider. //! //! Strategy: one fold per heading (line → line before the next heading //! of same-or-higher level) plus one fold per top-level list block. diff --git a/crates/nuwiki-lsp/src/index.rs b/crates/nuwiki-lsp/src/index.rs index 732192f..5fc154a 100644 --- a/crates/nuwiki-lsp/src/index.rs +++ b/crates/nuwiki-lsp/src/index.rs @@ -1,7 +1,7 @@ //! Workspace index — the in-memory model of every `.wiki` page nuwiki -//! has seen, used to power Phase 8 nav features. +//! has seen, used to power nav features. //! -//! Per P8 (SPEC §11), the initial scan runs as a background tokio task so +//! The initial scan runs as a background tokio task so //! the server stays responsive on startup. Per-document updates land here //! synchronously via `upsert` whenever the LSP backend re-parses on //! `didOpen` / `didChange`. @@ -29,10 +29,10 @@ pub struct IndexedPage { pub title: Option, pub headings: Vec, pub outgoing: Vec, - /// Phase 12: every `TagNode` on the page. `tags_by_name` on the + /// Every `TagNode` on the page. `tags_by_name` on the /// containing `WorkspaceIndex` is the reverse map. pub tags: Vec, - /// Phase 16: `Some(date)` when this page is a *daily* diary entry — + /// `Some(date)` when this page is a *daily* diary entry — /// stem parses as `YYYY-MM-DD`. Equivalent to /// `diary_period.and_then(|p| if let DiaryPeriod::Day(d) = p { Some(d) } else { None })`. /// Kept as its own field for back-compat with prev/next/list callers @@ -97,7 +97,7 @@ pub struct Backlink { } /// A tag's location, used by `WorkspaceIndex::tags_for` for cross-page -/// `[[Page#tag]]` resolution and `nuwiki.tags.search` (Phase 13). +/// `[[Page#tag]]` resolution and `nuwiki.tags.search`. #[derive(Debug, Clone)] pub struct TagOccurrence { pub uri: Url, @@ -108,7 +108,7 @@ pub struct TagOccurrence { #[derive(Debug, Default)] pub struct WorkspaceIndex { pub root: Option, - /// Phase 16: subdir relative to `root` that holds diary entries. + /// Subdir relative to `root` that holds diary entries. /// Mirrors `WikiConfig::diary_rel_path`; stored here so `upsert` can /// classify each indexed URI without a back-reference to the config. pub diary_rel_path: Option, @@ -119,9 +119,9 @@ pub struct WorkspaceIndex { pub pages_by_uri: HashMap, pub pages_by_name: HashMap, pub backlinks: HashMap>, - /// Phase 12: tag name → every occurrence across the workspace. Used by - /// the v1.1 nav handlers (tag-as-anchor `definition`, `workspace/symbol` - /// inclusion) and the Phase 13 `nuwiki.tags.search` command. + /// Tag name → every occurrence across the workspace. Used by + /// the nav handlers (tag-as-anchor `definition`, `workspace/symbol` + /// inclusion) and the `nuwiki.tags.search` command. pub tags_by_name: HashMap>, } @@ -187,7 +187,7 @@ impl WorkspaceIndex { } } - // Phase 12: maintain the reverse tag map alongside the per-page list. + // Maintain the reverse tag map alongside the per-page list. for tag in &page.tags { self.tags_by_name .entry(tag.name.clone()) diff --git a/crates/nuwiki-lsp/src/lib.rs b/crates/nuwiki-lsp/src/lib.rs index a4dd1e4..b9356a3 100644 --- a/crates/nuwiki-lsp/src/lib.rs +++ b/crates/nuwiki-lsp/src/lib.rs @@ -1,8 +1,7 @@ //! LSP protocol bridge for nuwiki. //! -//! `tower-lsp` server that maintains a `DocumentStore` (SPEC §6.10) plus a -//! workspace-wide index (SPEC §6.10 + P8) and exposes every LSP method -//! through Phase 8: +//! `tower-lsp` server that maintains a `DocumentStore` plus a +//! workspace-wide index and exposes every LSP method: //! //! - `initialize` / `initialized` / `shutdown` //! - `textDocument/didOpen`, `didChange` (full sync), `didClose` @@ -14,12 +13,12 @@ //! - `workspace/symbol` — search across indexed headings //! //! Position encoding is negotiated as UTF-8 when the client supports LSP -//! 3.17+ encodings (SPEC §6.11). When the client only supports the legacy +//! 3.17+ encodings. When the client only supports the legacy //! UTF-16 default, positions get translated through a per-line lookup. //! -//! Re-parses are full per change (incremental parsing deferred post-v1). +//! Re-parses are full per change (no incremental parsing). //! The workspace scan runs in a background tokio task spawned from -//! `initialize` (P8) with `window/workDoneProgress` begin/end events. +//! `initialize` with `window/workDoneProgress` begin/end events. pub mod commands; pub mod config; @@ -111,8 +110,8 @@ pub async fn run_stdio() -> io::Result<()> { struct DocumentState { text: String, ast: DocumentNode, - /// Last version we observed from the client. Held per SPEC §6.10 even - /// though the foundation phase doesn't yet need to read it back. + /// Last version we observed from the client. Held even + /// though nothing reads it back yet. #[allow(dead_code)] version: i32, } @@ -124,8 +123,8 @@ struct Backend { /// True after `initialize` if the client opted into UTF-8 encoding. /// Otherwise we keep the LSP 3.16 default of UTF-16. use_utf8: Arc, - /// Per-wiki state (P11). Vector holds one entry until Phase 18 - /// (multi-wiki) lets users add more. + /// Per-wiki state. Vector holds one entry until multi-wiki + /// support lets users add more. wikis: Arc>>, /// Server config received via `initializationOptions` and refreshed /// via `workspace/didChangeConfiguration` (P18). @@ -151,7 +150,7 @@ impl Backend { wikis.iter().find(|w| w.id == id).cloned() } - /// Used by Phase 15 workspace-level commands (`checkLinks`, `findOrphans`) + /// Used by workspace-level commands (`checkLinks`, `findOrphans`) /// when no URI is supplied — they fall back to the first registered wiki. fn default_wiki(&self) -> Option { let wikis = self.wikis.read().ok()?; @@ -290,7 +289,7 @@ impl Backend { /// Return live state if `uri` is open in the editor, otherwise read /// the file from disk and re-parse. The closed-doc path is used by - /// cross-document operations (Phase 13 `workspace/rename` and link + /// cross-document operations (`workspace/rename` and link /// health) that need accurate spans + text without trusting cached /// `WorkspaceIndex` data. pub async fn read_or_open(&self, uri: &Url) -> io::Result { @@ -318,7 +317,7 @@ impl Backend { } async fn update_document(&self, uri: Url, text: String, version: i32) { - // For Phase 6 we always treat unknown buffers as vimwiki — if/when + // We always treat unknown buffers as vimwiki — if/when // multi-syntax dispatch lands the pick should follow the URI's ext. let plugin = match self.registry.get("vimwiki") { Some(p) => p, @@ -373,7 +372,7 @@ impl Backend { #[tower_lsp::async_trait] impl LanguageServer for Backend { async fn initialize(&self, params: InitializeParams) -> LspResult { - // SPEC §6.11: prefer UTF-8 if the client advertises support. + // Prefer UTF-8 if the client advertises support. let supports_utf8 = params .capabilities .general @@ -404,7 +403,7 @@ impl LanguageServer for Backend { change: Some(TextDocumentSyncKind::FULL), will_save: None, will_save_wait_until: None, - // Phase 17 `auto_export` listens on `did_save`. Asking + // `auto_export` listens on `did_save`. Asking // for `include_text: false` since the document store // already mirrors the live buffer. save: Some(TextDocumentSyncSaveOptions::SaveOptions(SaveOptions { @@ -502,9 +501,9 @@ impl LanguageServer for Backend { async fn did_change_configuration(&self, params: DidChangeConfigurationParams) { // Apply the new settings to `Config`. Re-indexing on root changes - // is out of scope for Phase 11; for now we just accept the new + // is out of scope here; for now we just accept the new // values so later commands see the right diagnostic settings etc. - // Phase 18 (multi-wiki) revisits this with proper rebuild semantics. + // Multi-wiki support revisits this with proper rebuild semantics. let mut cfg = self.config.write().expect("config lock poisoned"); cfg.apply_change(¶ms.settings); } @@ -530,7 +529,7 @@ impl LanguageServer for Backend { } async fn did_rename_files(&self, params: RenameFilesParams) { - // Phase 13 advertises this capability so the editor pushes + // We advertise this capability so the editor pushes // out-of-band renames (file explorer drags, `:VimwikiRenameFile` // when the client opts to surface the new URI). Update the index // so backlinks/headings track the new URI without waiting for @@ -576,7 +575,7 @@ impl LanguageServer for Backend { } async fn did_save(&self, params: DidSaveTextDocumentParams) { - // Phase 17: when `auto_export` is set on the resolved wiki, run + // When `auto_export` is set on the resolved wiki, run // the equivalent of `nuwiki.export.currentToHtml` after the file // hits disk. Best-effort — failures are logged but do not bubble // to the client. Skips pages with the `%nohtml` directive. @@ -934,7 +933,7 @@ impl LanguageServer for Backend { }); } } - // Phase 12: surface tags too, named as `:tag:` so editors + // Surface tags too, named as `:tag:` so editors // can distinguish them from headings at a glance. for t in &page.tags { if q.is_empty() || t.name.to_lowercase().contains(&q) { @@ -1121,9 +1120,9 @@ fn utf16_column(text: &str, line: u32, byte_col: u32) -> u32 { .sum::() as u32 } -/// Backward-compat wrapper kept for v1.0 test surface. New call sites +/// Backward-compat wrapper kept for the legacy test surface. New call sites /// should use `collect_diagnostics` so they can opt into link-health -/// (Phase 15) and other sources. +/// and other sources. pub fn ast_diagnostics(ast: &DocumentNode, text: &str, utf8: bool) -> Vec { collect_diagnostics( ast, @@ -1136,12 +1135,12 @@ pub fn ast_diagnostics(ast: &DocumentNode, text: &str, utf8: bool) -> Vec &'static str { // ===== Workspace + navigation helpers ===== // -// `workspace_root_from_params` lived here through Phase 10; Phase 11 lifted -// that logic into `Config::from_init_params` (see `config.rs`) so workspace +// `workspace_root_from_params` logic now lives in +// `Config::from_init_params` (see `config.rs`) so workspace // folders and `root_uri` are handled alongside `initializationOptions`. /// Background workspace scan (P8). Walks every `.wiki` file under `root`, @@ -1469,7 +1468,7 @@ fn heading_range_in(idx: &WorkspaceIndex, uri: &Url, anchor: &str, _utf8: bool) if let Some(h) = page.find_heading_by_anchor(anchor) { return Some(span_to_lsp_range_no_text(&h.span)); } - // Phase 12: tags-as-anchors. `[[Page#tag-name]]` lands on the + // Tags-as-anchors. `[[Page#tag-name]]` lands on the // matching `TagNode` on the target page. let t = page.tags.iter().find(|t| t.name == anchor)?; Some(span_to_lsp_range_no_text(&t.span)) diff --git a/crates/nuwiki-lsp/src/nav.rs b/crates/nuwiki-lsp/src/nav.rs index 55941eb..6042527 100644 --- a/crates/nuwiki-lsp/src/nav.rs +++ b/crates/nuwiki-lsp/src/nav.rs @@ -1,4 +1,4 @@ -//! Helpers shared by the Phase 8 navigation handlers (definition, +//! Helpers shared by the navigation handlers (definition, //! references, hover, completion). //! //! Two responsibilities: diff --git a/crates/nuwiki-lsp/src/rename.rs b/crates/nuwiki-lsp/src/rename.rs index 4490a20..a2be058 100644 --- a/crates/nuwiki-lsp/src/rename.rs +++ b/crates/nuwiki-lsp/src/rename.rs @@ -1,12 +1,12 @@ //! `textDocument/rename` — server-side rename with cross-document link //! rewriting. //! -//! Phase 13 implementation: +//! Implementation: //! 1. Resolve the rename target — cursor on a wikilink renames the linked //! page; otherwise rename the current file. //! 2. Build the new URI from the wiki root + the user-supplied path. //! 3. For every page in the wiki's index with an outgoing link to the -//! old page name, read its source via the Phase 11 closed-doc loader +//! old page name, read its source via the closed-doc loader //! so cached spans are validated against current text, then emit a //! `TextEdit` that swaps the `[[old]]` for `[[new]]` while preserving //! anchors and descriptions. diff --git a/crates/nuwiki-lsp/src/semantic_tokens.rs b/crates/nuwiki-lsp/src/semantic_tokens.rs index fc26b31..8f2a4ce 100644 --- a/crates/nuwiki-lsp/src/semantic_tokens.rs +++ b/crates/nuwiki-lsp/src/semantic_tokens.rs @@ -1,8 +1,7 @@ //! Semantic-token emission for the vimwiki AST. //! -//! Token-type scheme settled in P7: custom `vimwiki*` types plus -//! `level1`..`level6` + `centered` modifiers (SPEC §11). Default highlight -//! groups for these arrive in Phase 9. +//! Token-type scheme: custom `vimwiki*` types plus +//! `level1`..`level6` + `centered` modifiers. //! //! Pipeline: //! diff --git a/crates/nuwiki-lsp/src/wiki.rs b/crates/nuwiki-lsp/src/wiki.rs index efe1e6b..16d95b8 100644 --- a/crates/nuwiki-lsp/src/wiki.rs +++ b/crates/nuwiki-lsp/src/wiki.rs @@ -1,9 +1,9 @@ //! `Wiki` aggregate — per-wiki state, even when there's only one. //! -//! v1.0 shipped with a single `Arc>` on `Backend`. -//! Phase 11 lifts that into a `Wiki` aggregate so Phase 18 (multi-wiki) -//! only changes config shape, not data flow. Phases 12–17 always operate -//! on a `Wiki`; in practice the `wikis` `Vec` has one entry until 18. +//! The single `Arc>` on `Backend` is lifted into a +//! `Wiki` aggregate so multi-wiki support only changes config shape, not +//! data flow. Handlers always operate on a `Wiki`; in practice the `wikis` +//! `Vec` has one entry until multi-wiki support lands. use std::path::Path; use std::sync::{Arc, RwLock}; diff --git a/crates/nuwiki-lsp/tests/commands_colorize.rs b/crates/nuwiki-lsp/tests/commands_colorize.rs index c08085b..60a8000 100644 --- a/crates/nuwiki-lsp/tests/commands_colorize.rs +++ b/crates/nuwiki-lsp/tests/commands_colorize.rs @@ -1,9 +1,9 @@ -//! §13.1 §13.3 — `color_dic` → `HtmlRenderer` integration. +//! `color_dic` → `HtmlRenderer` integration. //! //! Drives the renderer directly so we don't have to spin up the full //! export pipeline. The end-to-end path (export command → renderer //! with `cfg.color_dic` plumbed through) is integration-tested via the -//! Phase 17 export tests. +//! export tests. use std::collections::HashMap; diff --git a/crates/nuwiki-lsp/tests/commands_coverage.rs b/crates/nuwiki-lsp/tests/commands_coverage.rs index aea2edf..6aca03a 100644 --- a/crates/nuwiki-lsp/tests/commands_coverage.rs +++ b/crates/nuwiki-lsp/tests/commands_coverage.rs @@ -1,6 +1,6 @@ //! Command-coverage suite: at least one behavioural test for every -//! documented `:Nuwiki*` / `:Vimwiki*` command (see `doc/nuwiki.txt` -//! §5 COMMANDS). +//! documented `:Nuwiki*` / `:Vimwiki*` command (see the COMMANDS section +//! of `doc/nuwiki.txt`). //! //! The user-facing commands funnel through `workspace/executeCommand` //! into the Backend dispatcher, or — for follow/backlinks/rename — through diff --git a/crates/nuwiki-lsp/tests/commands_files.rs b/crates/nuwiki-lsp/tests/commands_files.rs index ed02df5..8e17720 100644 --- a/crates/nuwiki-lsp/tests/commands_files.rs +++ b/crates/nuwiki-lsp/tests/commands_files.rs @@ -1,6 +1,6 @@ -//! Phase 13: pure-function tests for the rename helper + the file-delete +//! Pure-function tests for the rename helper + the file-delete //! command. The async `Backend::rename` end-to-end (with `read_or_open` -//! hitting disk) is exercised by Phase 14+ integration but covered here +//! hitting disk) is exercised by integration tests but covered here //! at the building-block level — same logic, no async client. use std::path::PathBuf; @@ -95,7 +95,7 @@ async fn file_delete_returns_workspace_edit_with_delete_op() { // // Easier: shape the test as an integration test over the public // module surface — call `commands::execute` once we expose a thin - // builder. For Phase 13 we test the JSON-shaped contract using the + // builder. We test the JSON-shaped contract using the // edits module directly, since that's what `file_delete` returns. let uri = Url::parse("file:///tmp/note.wiki").unwrap(); let mut b = nuwiki_lsp::edits::WorkspaceEditBuilder::new(); diff --git a/crates/nuwiki-lsp/tests/commands_lists.rs b/crates/nuwiki-lsp/tests/commands_lists.rs index 38ef2e8..e77c205 100644 --- a/crates/nuwiki-lsp/tests/commands_lists.rs +++ b/crates/nuwiki-lsp/tests/commands_lists.rs @@ -1,4 +1,4 @@ -//! §13.1 Cluster A — list rewriters: `removeDone`, `renumber`, +//! Cluster A — list rewriters: `removeDone`, `renumber`, //! `changeSymbol`, `changeLevel`. use nuwiki_core::ast::ListSymbol; diff --git a/crates/nuwiki-lsp/tests/commands_tables.rs b/crates/nuwiki-lsp/tests/commands_tables.rs index 99a88f2..4ac4e40 100644 --- a/crates/nuwiki-lsp/tests/commands_tables.rs +++ b/crates/nuwiki-lsp/tests/commands_tables.rs @@ -1,4 +1,4 @@ -//! §13.1 Cluster B — table rewriters: `insert`, `align`, `moveColumn`. +//! Cluster B — table rewriters: `insert`, `align`, `moveColumn`. use nuwiki_core::syntax::vimwiki::VimwikiSyntax; use nuwiki_core::syntax::SyntaxPlugin; diff --git a/crates/nuwiki-lsp/tests/folding.rs b/crates/nuwiki-lsp/tests/folding.rs index e6a587e..47b5270 100644 --- a/crates/nuwiki-lsp/tests/folding.rs +++ b/crates/nuwiki-lsp/tests/folding.rs @@ -1,4 +1,4 @@ -//! Phase 19: LSP folding-range provider. +//! LSP folding-range provider. //! //! Drives `folding::folding_ranges` directly. The handler wiring is //! shallow — it just calls into this function — so we verify the diff --git a/crates/nuwiki-lsp/tests/helpers.rs b/crates/nuwiki-lsp/tests/helpers.rs index 043e58d..866e038 100644 --- a/crates/nuwiki-lsp/tests/helpers.rs +++ b/crates/nuwiki-lsp/tests/helpers.rs @@ -1,7 +1,7 @@ //! Tests for the pure helpers that the LSP backend uses to translate //! between `nuwiki-core` ASTs and the LSP wire format. The async -//! request-handling loop is exercised at integration time in Phase 8+ -//! (navigation), so this file stays focused on conversion correctness. +//! request-handling loop is exercised at integration time by the +//! navigation tests, so this file stays focused on conversion correctness. use nuwiki_core::ast::{ inline::InlineNode, BlockNode, BlockquoteNode, DocumentNode, ErrorNode, ParagraphNode, diff --git a/crates/nuwiki-lsp/tests/html_export.rs b/crates/nuwiki-lsp/tests/html_export.rs index b41db6c..3a55c6e 100644 --- a/crates/nuwiki-lsp/tests/html_export.rs +++ b/crates/nuwiki-lsp/tests/html_export.rs @@ -1,4 +1,4 @@ -//! Phase 17: HTML export commands. +//! HTML export commands. //! //! Drives the pure `export::*` helpers directly. The side-effecting //! `export_ops::write_page` / `write_rss` paths get exercised via a diff --git a/crates/nuwiki-lsp/tests/link_health.rs b/crates/nuwiki-lsp/tests/link_health.rs index e460fd6..be596e5 100644 --- a/crates/nuwiki-lsp/tests/link_health.rs +++ b/crates/nuwiki-lsp/tests/link_health.rs @@ -1,4 +1,4 @@ -//! Phase 15: link-health diagnostics + TOC/links/orphans queries. +//! Link-health diagnostics + TOC/links/orphans queries. use std::path::PathBuf; diff --git a/crates/nuwiki-lsp/tests/multi_wiki.rs b/crates/nuwiki-lsp/tests/multi_wiki.rs index 8a0fb3e..edc6b2d 100644 --- a/crates/nuwiki-lsp/tests/multi_wiki.rs +++ b/crates/nuwiki-lsp/tests/multi_wiki.rs @@ -1,8 +1,8 @@ -//! Phase 18: multi-wiki — interwiki resolution + picker commands. +//! Multi-wiki — interwiki resolution + picker commands. //! //! The cross-wiki resolver methods on `Backend` are exercised indirectly //! through `tower_lsp::LspService`'s test harness via a synthetic -//! `Backend` (the same pattern Phase 13 used). To keep this test suite +//! `Backend`. To keep this test suite //! lightweight we drive the *pure* resolution primitives — the parser //! producing `LinkKind::Interwiki` targets, then the `WorkspaceIndex` //! lookup-by-name — and verify the multi-wiki config shape end-to-end. @@ -80,7 +80,7 @@ fn multi_wiki_config_loads_two_entries() { #[test] fn v1_0_single_root_still_works_alongside_multi_wiki_shape() { - // Single-wiki shorthand is the v1.0 form; ensure it still desugars. + // Single-wiki shorthand is the legacy form; ensure it still desugars. let cfg = config_from_json(serde_json::json!({ "wiki_root": "/tmp/legacy", })); @@ -135,7 +135,7 @@ fn nested_root_picks_longest_prefix_match() { // ===== Cross-wiki resolution (uses WorkspaceIndex per wiki) ===== -/// Verify that the cross-wiki resolution semantics match the SPEC: +/// Verify the cross-wiki resolution semantics: /// `[[wiki1:Page]]` looks up `Page` in the *second* wiki's index, not /// the source wiki's. The pure-data check here mirrors what /// `Backend::resolve_target_uri` does. diff --git a/crates/nuwiki-lsp/tests/navigation.rs b/crates/nuwiki-lsp/tests/navigation.rs index 5cf0ff3..e5ea3e8 100644 --- a/crates/nuwiki-lsp/tests/navigation.rs +++ b/crates/nuwiki-lsp/tests/navigation.rs @@ -1,7 +1,7 @@ -//! Tests for the Phase 8 navigation pieces: WorkspaceIndex queries, +//! Tests for the navigation pieces: WorkspaceIndex queries, //! page-name derivation, anchor slugify, position lookup, and link //! resolution. The async LSP handlers are exercised through these -//! helpers; end-to-end JSON-RPC drive lives in a follow-up phase. +//! helpers; end-to-end JSON-RPC drive lives elsewhere. use std::path::PathBuf; diff --git a/development/tests/test-keymaps-vim.vim b/development/tests/test-keymaps-vim.vim index 3832fea..06bd04c 100644 --- a/development/tests/test-keymaps-vim.vim +++ b/development/tests/test-keymaps-vim.vim @@ -95,10 +95,10 @@ else call s:record(0, 'cmd.NuwikiIndex_defined', ':NuwikiIndex not registered') endif -" ===== Documented command surface (doc/nuwiki.txt §5) ===== +" ===== Documented command surface ===== " Every command must be reachable in BOTH the canonical :Nuwiki* form and -" the vimwiki-compatible :Vimwiki* form. The suffixes below are the §5 list -" minus the prefix. :NuwikiInstall is the one exception — it's a nuwiki-only +" the vimwiki-compatible :Vimwiki* form. The suffixes below are the command +" list minus the prefix. :NuwikiInstall is the one exception — it's a nuwiki-only " maintenance command with no :Vimwiki* alias, so it's checked separately. let s:both_forms = [ @@ -151,7 +151,7 @@ call s:record( \ 'invoke.VimwikiNextLink_jumps_to_first_link', \ 'col=' . col('.')) -" ===== Documented mapping surface (doc §6/§7/§8) ===== +" ===== Documented mapping surface ===== " Every documented mapping must resolve to a buffer-local mapping in the " mode(s) the doc lists it under. The mouse group is opt-in — the shell " wrapper sets g:nuwiki_mouse_mappings before the ftplugin loads. diff --git a/development/tests/test-keymaps.lua b/development/tests/test-keymaps.lua index 9b0089a..68aaac8 100644 --- a/development/tests/test-keymaps.lua +++ b/development/tests/test-keymaps.lua @@ -123,10 +123,10 @@ vim.defer_fn(function() end record(true, 'lsp.attached', 'client=' .. client.name) - -- ===== Documented command surface (doc/nuwiki.txt §5) ===== + -- ===== Documented command surface ===== -- Every command must be reachable in BOTH the canonical :Nuwiki* form -- and the vimwiki-compatible :Vimwiki* form. The suffixes below are the - -- §5 list minus the prefix. :NuwikiInstall is the one exception — a + -- command list minus the prefix. :NuwikiInstall is the one exception — a -- nuwiki-only maintenance command with no :Vimwiki* alias. local both_forms = { 'Index', 'TabIndex', 'UISelect', 'Goto', 'FollowLink', 'Backlinks', @@ -169,7 +169,7 @@ vim.defer_fn(function() record(ok, 'invoke.next_prev_link_cursor_movement', ok and '' or tostring(err)) end - -- ===== Documented mapping surface (doc §6/§7/§8) ===== + -- ===== Documented mapping surface ===== -- Every documented mapping must resolve to a buffer-local mapping in -- the mode(s) the doc lists it under. `modes` is a string of mode -- letters: n/x/o/i. The mouse group is opt-in — the harness enables it @@ -179,36 +179,36 @@ vim.defer_fn(function() return next(d) ~= nil and d.buffer == 1 end local mapping_surface = { - -- §6 Links + -- Links { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, { '+', 'nx' }, - -- §6 Lists + -- Lists { '', 'nx' }, { '', 'nx' }, { '', 'nx' }, { 'gnt', 'n' }, { 'gln', 'nx' }, { 'glp', 'nx' }, { 'glx', 'nx' }, { 'glh', 'n' }, { 'gll', 'n' }, { 'gLh', 'n' }, { 'gLl', 'n' }, { 'glr', 'n' }, { 'gLr', 'n' }, { 'gl', 'n' }, { 'gL', 'n' }, { 'o', 'n' }, { 'O', 'n' }, - -- §6 Headers + -- Headers { '=', 'n' }, { '-', 'n' }, { ']]', 'n' }, { '[[', 'n' }, { ']=', 'n' }, { '[=', 'n' }, { ']u', 'n' }, { '[u', 'n' }, - -- §6 Tables + -- Tables { 'gqq', 'n' }, { 'gq1', 'n' }, { 'gww', 'n' }, { 'gw1', 'n' }, { '', 'n' }, { '', 'n' }, - -- §6 Wiki / diary / export + -- Wiki / diary / export { 'ww', 'n' }, { 'ws', 'n' }, { 'wi', 'n' }, { 'ww', 'n' }, { 'wy', 'n' }, { 'wt', 'n' }, { 'wi', 'n' }, { 'wn', 'n' }, { 'wd', 'n' }, { 'wr', 'n' }, { 'wh', 'n' }, { 'whh', 'n' }, { 'wha', 'n' }, { 'wc', 'nx' }, { '', 'n' }, { '', 'n' }, - -- §6 Mouse (opt-in) + -- Mouse (opt-in) { '<2-LeftMouse>', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, - -- §7 Text objects (operator-pending + visual) + -- Text objects (operator-pending + visual) { 'ah', 'ox' }, { 'ih', 'ox' }, { 'aH', 'ox' }, { 'iH', 'ox' }, { 'al', 'ox' }, { 'il', 'ox' }, { 'a\\', 'ox' }, { 'i\\', 'ox' }, { 'ac', 'ox' }, { 'ic', 'ox' }, - -- §8 Insert-mode + -- Insert-mode { '', 'i' }, { '', 'i' }, { '', 'i' }, { '', 'i' }, { '', 'i' }, { '', 'i' }, { '', 'i' }, { '', 'i' }, @@ -424,7 +424,7 @@ vim.defer_fn(function() wait_ms = 200, }) - -- ===== Link helpers (§13.1 Cluster C) ===== + -- ===== Link helpers (Cluster C) ===== run('links.normalize_via_+', { lines = { 'MyPage rest' }, diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 5bb3ae3..c181218 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -1,9 +1,9 @@ -" ftplugin/nuwiki.vim — per-buffer settings + Phase 19 command/keymap glue. +" ftplugin/nuwiki.vim — per-buffer settings + command/keymap glue. " " Wires up: " - basic edit-time options (commentstring, suffixesadd, …) -" - every `:Vimwiki*` / `:Nuwiki*` command from SPEC §12.10 that has a -" server-side counterpart (deferred §13.1 commands stub out with a +" - every `:Vimwiki*` / `:Nuwiki*` command that has a +" server-side counterpart (deferred commands stub out with a " "not yet implemented" notification) " - on Neovim: keymaps + text objects + folding via " `nuwiki.ftplugin.attach()` @@ -78,7 +78,7 @@ if !has('nvim') command! -buffer -nargs=? VimwikiSearchTags call nuwiki#commands#tags_search() command! -buffer -nargs=? VimwikiGenerateTagLinks call nuwiki#commands#tags_generate_links() - " §13.1 deferred stubs. + " Deferred stubs. command! -buffer -nargs=1 VimwikiTable call nuwiki#commands#table_insert() command! -buffer VimwikiTableMoveColumnLeft call nuwiki#commands#table_move_left() command! -buffer VimwikiTableMoveColumnRight call nuwiki#commands#table_move_right() @@ -115,7 +115,7 @@ if !has('nvim') command! -buffer -nargs=? NuwikiGenerateTagLinks call nuwiki#commands#tags_generate_links() command! -buffer -nargs=1 NuwikiGoto call nuwiki#commands#wiki_goto_page() - " Canonical :Nuwiki* names that mirror the documented surface (doc §5). + " Canonical :Nuwiki* names that mirror the documented surface. " The older :Nuwiki* spellings above stay defined for back-compat. command! -buffer NuwikiNextLink call nuwiki#commands#link_next() command! -buffer NuwikiPrevLink call nuwiki#commands#link_prev() @@ -331,7 +331,7 @@ command! -buffer VimwikiRebuildTags lua require('nuwiki.commands'). command! -buffer -nargs=? VimwikiSearchTags lua require('nuwiki.commands').tags_search() command! -buffer -nargs=? VimwikiGenerateTagLinks lua require('nuwiki.commands').tags_generate_links() -" §13.1 deferred — stubs notify the user instead of erroring. +" Deferred — stubs notify the user instead of erroring. command! -buffer -nargs=1 VimwikiTable lua require('nuwiki.commands').table_insert() command! -buffer VimwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left() command! -buffer VimwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right() @@ -370,7 +370,7 @@ command! -buffer -nargs=? NuwikiSearchTags lua require('nuwiki.commands' command! -buffer -nargs=? NuwikiGenerateTagLinks lua require('nuwiki.commands').tags_generate_links() command! -buffer -nargs=1 NuwikiGoto lua require('nuwiki.commands').wiki_goto_page() -" Canonical :Nuwiki* names that mirror the documented surface (doc §5). +" Canonical :Nuwiki* names that mirror the documented surface. " The older :Nuwiki* spellings above stay defined for back-compat. command! -buffer NuwikiNextLink lua require('nuwiki.commands').link_next() command! -buffer NuwikiPrevLink lua require('nuwiki.commands').link_prev() @@ -384,5 +384,5 @@ command! -buffer Nuwiki2HTML lua require('nuwiki.command command! -buffer Nuwiki2HTMLBrowse lua require('nuwiki.commands').export_browse() command! -buffer -bang NuwikiAll2HTML execute (0 ? "lua require('nuwiki.commands').export_all_force()" : "lua require('nuwiki.commands').export_all()") -" Phase 19 buffer attach: keymaps + text objects + folding. +" Buffer attach: keymaps + text objects + folding. lua require('nuwiki.ftplugin').attach(0) diff --git a/lua/nuwiki/commands.lua b/lua/nuwiki/commands.lua index bfeaa49..cb10158 100644 --- a/lua/nuwiki/commands.lua +++ b/lua/nuwiki/commands.lua @@ -1,5 +1,5 @@ -- lua/nuwiki/commands.lua — Lua wrappers around every `nuwiki.*` --- `workspace/executeCommand` the server advertises. Phase 19 plumbing. +-- `workspace/executeCommand` the server advertises. -- -- Each public function is named after its `:Vimwiki*` / `:Nuwiki*` -- counterpart so `ftplugin/nuwiki.vim` can wire them up declaratively. @@ -468,7 +468,7 @@ function M.rename_file() vim.lsp.buf.rename() end --- ===== Deferred placeholders (§13.1) ===== +-- ===== Deferred placeholders ===== -- -- These commands aren't implemented on the server yet. Stub them so the -- `:Vimwiki*` compat surface exists and users get a clear message @@ -483,7 +483,7 @@ local function _not_yet(name) end end --- §13.1 Cluster A — list rewriters. +-- Cluster A — list rewriters. -- `gl` — remove done items from the current list only. Passing the -- cursor position scopes the server to the contiguous list block under it. @@ -891,7 +891,7 @@ function M.smart_shift_tab() ) end --- §13.1 Cluster B — table rewriters. +-- Cluster B — table rewriters. function M.table_insert(cols, rows) cols = tonumber(cols) or 3 @@ -974,7 +974,7 @@ function M.colorize(color) vim.api.nvim_buf_set_lines(0, row - 1, row, false, { new_line }) end --- §13.1 Cluster C — link helpers. +-- Cluster C — link helpers. function M.paste_link() exec('nuwiki.link.pasteWikilink', pos_args()) diff --git a/lua/nuwiki/config.lua b/lua/nuwiki/config.lua index f7d048b..f937610 100644 --- a/lua/nuwiki/config.lua +++ b/lua/nuwiki/config.lua @@ -1,12 +1,11 @@ -- lua/nuwiki/config.lua — defaults and user-config merge. -- --- Schema mirrors SPEC §7.5 + §12.11. Keep this aligned with --- `doc/nuwiki.txt`. +-- Keep this aligned with `doc/nuwiki.txt`. local M = {} M.defaults = { - -- v1.0 single-wiki shorthand. The server desugars these into a + -- Single-wiki shorthand. The server desugars these into a -- one-entry `wikis = {…}` list. Use either this or the multi-wiki -- form below; if both are set, `wikis` wins. wiki_root = '~/vimwiki', @@ -14,12 +13,12 @@ M.defaults = { syntax = 'vimwiki', log_level = 'warn', - -- v1.1 multi-wiki shape. Each entry honours every per-wiki key the + -- Multi-wiki shape. Each entry honours every per-wiki key the -- server understands. Leave nil to fall through to the shorthand -- above. -- - -- Per-wiki keys (all optional, server defaults documented in SPEC - -- §12.11): + -- Per-wiki keys (all optional, server defaults documented in + -- `doc/nuwiki.txt`): -- name, root, file_extension, syntax, index -- diary_rel_path, diary_index, diary_frequency, -- diary_start_week_day, diary_caption_level, diary_sort, @@ -31,7 +30,7 @@ M.defaults = { -- links_space_char, nested_syntaxes wikis = nil, - -- Phase 19: per-buffer glue. Each subgroup mirrors vimwiki's + -- Per-buffer glue. Each subgroup mirrors vimwiki's -- `g:vimwiki_key_mappings` shape and can be flipped off -- independently to suppress that group of keymaps. mappings = { @@ -47,7 +46,7 @@ M.defaults = { mouse = false, -- <2-LeftMouse>, , … (opt-in) }, - -- Phase 19: folding. `'lsp'` uses the server's `foldingRange` + -- Folding. `'lsp'` uses the server's `foldingRange` -- provider (Neovim 0.11+ wires it automatically). `'expr'` falls -- back to a regex-based `foldexpr`. `'off'` skips folding setup. folding = 'lsp', diff --git a/lua/nuwiki/ftplugin.lua b/lua/nuwiki/ftplugin.lua index f729560..d48a1c6 100644 --- a/lua/nuwiki/ftplugin.lua +++ b/lua/nuwiki/ftplugin.lua @@ -1,6 +1,6 @@ -- lua/nuwiki/ftplugin.lua — per-buffer hookup invoked by --- `ftplugin/nuwiki.vim`. Centralises the Lua side of Phase 19 so the --- VimL ftplugin stays a one-liner regardless of which subgroups are +-- `ftplugin/nuwiki.vim`. Centralises the Lua side of the per-buffer +-- glue so the VimL ftplugin stays a one-liner regardless of which subgroups are -- enabled. local M = {} diff --git a/lua/nuwiki/health.lua b/lua/nuwiki/health.lua index 524e04b..beea5bd 100644 --- a/lua/nuwiki/health.lua +++ b/lua/nuwiki/health.lua @@ -1,7 +1,7 @@ -- lua/nuwiki/health.lua — `:checkhealth nuwiki` target. -- --- v1.0 checks per SPEC §7.6 (binary, version, filetype, LSP attach). --- v1.1 §12.10 additions: registered LSP commands, indexed wikis, HTML +-- Core checks: binary, version, filetype, LSP attach. +-- Additional checks: registered LSP commands, indexed wikis, HTML -- output path writability, default keymaps installed. local M = {} diff --git a/lua/nuwiki/init.lua b/lua/nuwiki/init.lua index 7a0217b..b37a471 100644 --- a/lua/nuwiki/init.lua +++ b/lua/nuwiki/init.lua @@ -5,7 +5,7 @@ -- require('nuwiki').install() — install / build the language server -- require('nuwiki').health() — :checkhealth nuwiki target -- --- Per SPEC §6.2/§6.3 this layer is wiring only. Everything substantive +-- This layer is wiring only. Everything substantive -- happens in the Rust language server. local M = {} diff --git a/lua/nuwiki/install.lua b/lua/nuwiki/install.lua index 660ce04..690445d 100644 --- a/lua/nuwiki/install.lua +++ b/lua/nuwiki/install.lua @@ -1,6 +1,6 @@ -- lua/nuwiki/install.lua — install / build the `nuwiki-ls` binary. -- --- Strategy (matches SPEC §7.2): +-- Strategy: -- 1. Look for `bin/nuwiki-ls[.exe]` next to the plugin. -- 2. If missing or `g:nuwiki_build_from_source` is set, build with cargo. -- 3. Otherwise try to download a release asset for the current target. diff --git a/lua/nuwiki/keymaps.lua b/lua/nuwiki/keymaps.lua index eabbbb8..9d7f230 100644 --- a/lua/nuwiki/keymaps.lua +++ b/lua/nuwiki/keymaps.lua @@ -16,7 +16,7 @@ -- wiki_prefix = true, -- ww, ws, wi, … -- } -- --- Mappings that point at §13.1-deferred commands stub out to a +-- Mappings that point at deferred commands stub out to a -- "not yet implemented" notification — better than a silent no-op -- so users get parity *signalling*, not just parity in lhs. @@ -133,7 +133,7 @@ local function open_above_with_bullet() vim.api.nvim_feedkeys('O' .. prefix, 'n', false) end --- ===== Stub for deferred §13.1 commands ===== +-- ===== Stub for deferred commands ===== local function deferred(name) return function() diff --git a/plugin/nuwiki.vim b/plugin/nuwiki.vim index 840df90..8a2a71e 100644 --- a/plugin/nuwiki.vim +++ b/plugin/nuwiki.vim @@ -4,7 +4,7 @@ " their config (lazy.nvim does this automatically through `opts`). On Vim " we start the LSP client when a vimwiki buffer is loaded. " -" Per SPEC §6.2 / §6.3 this file contains wiring only — all logic lives in +" This file contains wiring only — all logic lives in " the Rust language server. if exists('g:loaded_nuwiki') diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index 635be2f..c9af182 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -1,8 +1,8 @@ " syntax/vimwiki.vim — default highlight groups for nuwiki. " " Two responsibilities: -" 1. Default `@vimwiki*` highlight groups for the LSP semantic tokens -" (SPEC §11 P7). Loaded eagerly so the very first hover/highlight +" 1. Default `@vimwiki*` highlight groups for the LSP semantic tokens. +" Loaded eagerly so the very first hover/highlight " cycle after server startup already has colours. " 2. A small regex-based fallback so static highlighting works on " buffers where the LSP isn't running yet.