Remove Rust code, delegate server to nuwiki-rs repo
CI / cargo clippy (pull_request) Failing after 42s
CI / cargo fmt --check (pull_request) Failing after 45s
CI / cargo test (pull_request) Failing after 49s
CI / editor keymaps (pull_request) Has been skipped

Delete all Rust crates (crates/) and Cargo files. The nuwiki-ls binary
is now built in the separate nuwiki-rs repository and downloaded at
install time from the Gitea release assets, with a cargo build fallback
that clones nuwiki-rs.

Update all documentation to reflect the split repo layout.
This commit is contained in:
gffranco
2026-06-24 12:57:15 +00:00
parent 0df72e52ea
commit cb11889e72
81 changed files with 234 additions and 26425 deletions
+44 -90
View File
@@ -4,41 +4,12 @@
nuwiki is a vimwiki-compatible Vim/Neovim plugin backed by a Rust language server. It provides full vimwiki syntax support while keeping the original file format, keymaps, and command surface intact. The substantive work happens in a Rust LSP daemon — Vim and Neovim are thin client layers that wire up keystrokes and display results.
The Rust LSP server lives in the separate [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) repository. This plugin repo is the Vim/Neovim client layer and is distributed independently from the server binary.
## Repository Structure
```
nuwiki/
├── Cargo.toml # Rust workspace root
├── Cargo.lock
├── crates/
│ ├── nuwiki-ls/ # Binary crate — thin main.rs, starts stdio LSP server
│ │ ├── Cargo.toml
│ │ └── src/main.rs
│ │
│ ├── nuwiki-core/ # Library crate — parser, AST, renderer (no editor deps)
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── syntax/ # Syntax plugins (vimwiki, future markdown)
│ │ │ ├── mod.rs
│ │ │ ├── registry.rs
│ │ │ └── vimwiki/
│ │ │ ├── mod.rs
│ │ │ ├── lexer.rs
│ │ │ └── parser.rs
│ │ ├── ast/ # Abstract Syntax Tree node definitions
│ │ │ ├── mod.rs
│ │ │ ├── block.rs
│ │ │ ├── inline.rs
│ │ │ └── link.rs
│ │ └── render/ # Renderers (HTML, etc.)
│ │ ├── mod.rs
│ │ └── html.rs
│ │
│ └── nuwiki-lsp/ # Library crate — LSP protocol bridge
│ ├── Cargo.toml
│ └── src/lib.rs
├── plugin/ # Universal Vim/Neovim entry point
│ └── nuwiki.vim
@@ -47,7 +18,7 @@ nuwiki/
│ ├── init.lua
│ ├── config.lua
│ ├── lsp.lua
│ └── install.lua # Binary download / build-from-source logic
│ └── install.lua # Binary download logic
├── autoload/ # Lazy-loaded VimL (Vim compat layer)
│ └── nuwiki/
@@ -92,26 +63,21 @@ nuwiki/
└── release.yaml # Cross-compile + release on v* tag
```
## Key Crates
## Server Component
1. **nuwiki-core**: Contains the parser, lexer, AST, and renderer. This is the pure-Rust core with no editor dependencies.
2. **nuwiki-lsp**: Bridges the core to the LSP protocol using tower-lsp. Handles LSP requests/responses and manages the document store.
3. **nuwiki-ls**: Binary crate that starts the stdio LSP server. Very thin — just initializes the LSP server and runs it.
The Rust LSP server (`nuwiki-ls`) lives in the separate [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) repository. Pre-built binaries are downloaded automatically by the plugin's `install()` function. To build from source:
```bash
git clone https://code.gfran.co/gffranco/nuwiki-rs
cd nuwiki-rs
cargo build --release -p nuwiki-ls
```
## Build & Installation
### Prerequisites
- Rust toolchain (1.83+ stable)
- Cargo
- For editor integration: Vim 9+ or Neovim 0.5+ with an LSP client (vim-lsp recommended for Vim, built-in for Neovim 0.11+)
### Development Build
```bash
# From the repository root
cargo build --release -p nuwiki-ls # Builds the LSP binary
```
The binary will be placed at `target/release/nuwiki-ls`.
- The `nuwiki-ls` binary is downloaded automatically; no Rust toolchain required unless building from source
### Installation via Plugin Managers
@@ -143,37 +109,34 @@ call dein#add('gffranco/nuwiki', {
```bash
git clone https://code.gfran.co/gffranco/nuwiki ~/.vim/pack/gffranco/start/nuwiki
cd ~/.vim/pack/gffranco/start/nuwiki
cargo build --release -p nuwiki-ls
mkdir -p bin && ln -s ../target/release/nuwiki-ls bin/nuwiki-ls
vim -e -s -c "source scripts/download_bin.vim" -c "q"
```
Plain Vim users also need an LSP client — vim-lsp is recommended.
## Development Workflow
### Testing
```bash
# Run all tests (workspace)
cargo test --workspace
### Testing (Editor Layer)
# Run tests for a specific crate
cargo test -p nuwiki-core
cargo test -p nuwiki-lsp
cargo test -p nuwiki-ls
```bash
# Run editor tests (shell + Lua harnesses in development/tests/)
./development/tests/test-keymaps.sh
./development/tests/test-calendar.sh
```
### Linting & Formatting
```bash
# Check formatting
cargo fmt -- --check
For Rust-level tests, see the [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) repository:
# Run Clippy
```bash
# In the nuwiki-rs repo
cargo test --workspace
cargo clippy --workspace -- -D warnings
```
### Running the LSP Server Manually (for debugging)
Build from [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) and run:
```bash
# Build and run the binary
cargo run -p nuwiki-ls -- --help
```
@@ -210,44 +173,35 @@ This verifies:
## Important Notes
- The core library (`nuwiki-core`) is completely editor-agnostic and can be tested independently.
- The LSP layer (`nuwiki-lsp`) depends only on the core and tower-lsp.
- The binary crate (`nuwiki-ls`) is intentionally thin — it just initializes and runs the LSP server.
- The Rust LSP server is in the separate [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) repository.
- This plugin repo contains only the editor client layer (VimL/Lua).
- Editor layers (VimL/Lua) contain zero logic — they are pure wiring only.
- All syntax-specific code lives in `nuwiki-core/src/syntax/<syntax>/` making it easy to add new syntaxes (e.g., markdown) in the future.
- The project uses a workspace Cargo.toml with resolver v2 (edition 2021).
- All syntax-specific code lives in the Rust LSP server's `nuwiki-core` crate.
## Getting Started
1. Clone the repository:
```bash
git clone https://code.gfran.co/gffranco/nuwiki
cd nuwiki
```
1. Clone this plugin repository:
```bash
git clone https://code.gfran.co/gffranco/nuwiki
cd nuwiki
```
2. Build the LSP binary:
```bash
cargo build --release -p nuwiki-ls
```
2. Install the plugin in your Neovim/Vim configuration using your preferred plugin manager (see above examples). The `nuwiki-ls` binary will be downloaded automatically.
3. Set up a test wiki directory:
```bash
mkdir -p ~/test-wiki
echo "# Test Wiki" > ~/test-wiki/index.wiki
```
3. Open a .wiki file and verify:
- Syntax highlighting works
- `:VimwikiIndex` opens the index page
- LSP features (go-to-definition, hover, completions) work via `:checkhealth nuwiki`
4. Install the plugin in your Neovim/Vim configuration using your preferred plugin manager (see above examples).
5. Open a .wiki file and verify:
- Syntax highlighting works
- `:VimwikiIndex` opens the index page
- LSP features (go-to-definition, hover, completions) work via `:checkhealth nuwiki`
To modify the LSP server itself, clone the [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) repository and build the binary from source.
## CI/CD
The project uses Gitea Actions:
- CI (`.gitea/workflows/ci.yaml`): Runs on every push/PR — checks formatting, Clippy, and runs tests.
- Release (`.gitea/workflows/release.yaml`): Triggers on `v*` tag — cross-compiles for Linux targets and creates a Gitea release.
This repo (editor client) uses Gitea Actions:
- CI (`.gitea/workflows/ci.yaml`): Runs editor tests on every push/PR.
The Rust LSP server lives in [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) which handles:
- Release (`.gitea/workflows/release.yaml`): Triggers on `v*` tag — cross-compiles for Linux targets and creates a Gitea release with downloadable binaries.
## License
+19 -46
View File
@@ -6,16 +6,12 @@ For day-one setup see [ONBOARDING.md](ONBOARDING.md); for user-facing help see
nuwiki is a vimwiki-compatible Vim/Neovim plugin backed by a Rust language
server. The editor layers are thin clients; all parsing, navigation, and
editing logic lives in the Rust crates and is reached over LSP.
editing logic lives in the [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs)
repository and is reached over LSP.
| Property | Value |
|---|---|
| License | Dual MIT / Apache-2.0 |
| MSRV | Rust 1.83 |
| Edition / resolver | 2021 / v2 |
| Repo | `https://code.gfran.co/gffranco/nuwiki` |
| VCS / CI | Gitea + Gitea Actions |
| LSP library | `tower-lsp` (tokio, stdio transport) |
| Min editors | Neovim 0.11+, Vim 9.1+ |
---
@@ -28,42 +24,21 @@ editing logic lives in the Rust crates and is reached over LSP.
Editor client (VimL / Lua) — pure wiring, no logic
│ LSP over stdio
nuwiki-lsp — protocol bridge, executeCommand, document store, config
nuwiki-core — lexer → parser → AST → renderer (no editor deps)
nuwiki-ls (nuwiki-rs) — Rust LSP server: protocol bridge, executeCommand,
document store, config, parser, renderer
```
### Crate dependency rules
> The Rust LSP server is in the separate [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs)
> repository. This plugin repo is the Vim/Neovim client layer only.
>
> The architecture table below is for reference — the Rust source lives in nuwiki-rs.
```
nuwiki-ls → nuwiki-lsp → nuwiki-core
```
- `nuwiki-core` never depends on `nuwiki-lsp` / `nuwiki-ls`.
- `nuwiki-lsp` never depends on `nuwiki-ls`.
- The VimL and Lua layers contain no logic — every command body issues a
`workspace/executeCommand` or a built-in LSP request.
### Repository layout
```
crates/
nuwiki-core/ # parser, AST, renderer — editor-independent
src/
ast/ # block.rs inline.rs link.rs span.rs visit.rs
syntax/ # registry.rs + vimwiki/{lexer,parser}.rs
render/ # html.rs
date.rs # diary period math (no chrono dependency)
nuwiki-lsp/ # LSP backend
src/
lib.rs # Backend, capabilities, textDocument handlers
commands.rs # executeCommand dispatcher + pure edit ops
config.rs # Config / WikiConfig / HtmlConfig
diagnostics.rs index.rs nav.rs rename.rs semantic_tokens.rs
diary.rs export.rs edits.rs folding.rs wiki.rs
nuwiki-ls/ # thin binary: starts the stdio server
plugin/nuwiki.vim # universal entry point (detects Vim vs Neovim)
lua/nuwiki/ # Neovim layer: init, config, lsp, keymaps, commands,
# folding, install
@@ -72,12 +47,15 @@ ftdetect/ ftplugin/ syntax/ # filetype detection, buffer setup, fallback HL
doc/nuwiki.txt # :help
scripts/download_bin.vim # plugin-runtime binary download (build hooks)
development/ # dev-only tooling + this document (not shipped)
.gitea/workflows/ # ci.yaml, release.yaml
```
---
## 2. nuwiki-core
## 2. nuwiki-core (nuwiki-rs)
> This section documents the Rust server's internals — the source lives in
> the [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) repository. Kept
> here as a technical reference for the LSP protocol contract.
### AST
@@ -199,9 +177,8 @@ raw and external URLs are never diagnosed.
Pre-built binaries are published as Gitea release assets
(`nuwiki-ls-{version}-{target}.tar.gz`) and fetched at install time by
`lua/nuwiki/install.lua` (Neovim) or `scripts/download_bin.vim` (Vim build
hooks), installed to `{plugin_dir}/bin/nuwiki-ls`. Falls back to
`cargo build --release` when download fails or
`g:nuwiki_build_from_source = 1`.
hooks), installed to `{plugin_dir}/bin/nuwiki-ls`. The binary is downloaded
from the [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) releases.
`plugin/nuwiki.vim` dispatches: Neovim → `require('nuwiki').setup()`; Vim →
`nuwiki#lsp#start()` (prefers `vim-lsp`, falls back to `coc.nvim`). On Neovim
@@ -323,16 +300,12 @@ provides a no-LSP fallback):
| Job | Command |
|---|---|
| fmt | `cargo fmt --all -- --check` |
| clippy | `cargo clippy --workspace --all-targets -- -D warnings` |
| test | `cargo test --workspace --all-targets` |
| keymaps | `development/tests/test-keymaps.sh` (Neovim 0.11) + `test-keymaps-vim.sh` (Vim) |
| calendar | `development/tests/test-calendar.sh` (Neovim) + `test-calendar-vim.sh` (Vim) |
`.gitea/workflows/release.yaml` triggers on `v*` tags: cross-compiles the four
Linux targets (gnu/musl × x86_64/aarch64) via `cross`, packages `.tar.gz`, and
creates a Gitea release using `RELEASE_TOKEN`. macOS and Windows binaries are
built manually and attached to the same release. crates.io publishing is not
wired up.
`.gitea/workflows/release.yaml` (in [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs))
triggers on `v*` tags: cross-compiles the four Linux targets (gnu/musl × x86_64/aarch64)
via `cross`, packages `.tar.gz`, and creates a Gitea release using `RELEASE_TOKEN`.
A change is semver-breaking if it alters `nuwiki-core` AST nodes, the
`SyntaxPlugin`/`Renderer` traits, the user-config schema, or removes an LSP
+27 -13
View File
@@ -10,7 +10,7 @@
# Exports:
# REPO_ROOT / DEV_DIR / WIKI_DIR — common paths
# log — prefixed status line
# ensure_binary — build + symlink nuwiki-ls
# ensure_binary — verify nuwiki-ls exists (download if missing)
# write_sample_wiki DIR — lay down the feature-showcase wiki
# reset_dirs DIR... — wipe + recreate owned state dirs
# seed_wiki — (re)seed WIKI_DIR fresh each run; never
@@ -27,20 +27,34 @@ log() { printf '\033[1;34m[nuwiki-dev]\033[0m %s\n' "$*"; }
ensure_binary() {
local bin="$REPO_ROOT/bin/nuwiki-ls"
local built="$REPO_ROOT/target/release/nuwiki-ls"
if [[ "${NUWIKI_DEV_SKIP_BUILD:-0}" == "1" ]]; then
if [[ ! -x "$bin" ]]; then
log "NUWIKI_DEV_SKIP_BUILD=1 but $bin is missing — building anyway"
else
log "NUWIKI_DEV_SKIP_BUILD=1 — using existing $bin"
return
fi
if [[ -x "$bin" ]]; then
log "binary ready: $bin"
return
fi
if [[ "${NUWIKI_DEV_SKIP_BUILD:-0}" == "1" ]]; then
log "NUWIKI_DEV_SKIP_BUILD=1 but $bin is missing"
return 1
fi
log "downloading nuwiki-ls…"
vim -e -s -c "source $REPO_ROOT/scripts/download_bin.vim" -c "q"
if [[ -x "$bin" ]]; then
log "binary ready: $bin"
return
fi
log "download failed, falling back to cargo build from nuwiki-rs…"
local rs_repo="$REPO_ROOT/nuwiki-rs"
if [[ ! -f "$rs_repo/Cargo.toml" ]]; then
log "cloning nuwiki-rs …"
git clone --depth 1 https://code.gfran.co/gffranco/nuwiki-rs.git "$rs_repo"
fi
cargo build --release -p nuwiki-ls --manifest-path "$rs_repo/Cargo.toml"
if [[ ! -f "$rs_repo/target/release/nuwiki-ls" ]]; then
log "cargo build failed"
return 1
fi
log "building nuwiki-ls (release)…"
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml"
mkdir -p "$REPO_ROOT/bin"
ln -sf "$built" "$bin"
log "binary ready: $bin (built $(date -r "$built" '+%Y-%m-%d %H:%M:%S'))"
ln -sf "$rs_repo/target/release/nuwiki-ls" "$bin"
log "binary ready: $bin"
}
# write_sample_wiki DIR — lay down a fixture that exercises every vimwiki
+5 -13
View File
@@ -2,25 +2,17 @@
#
# start-nvim.sh — launch Neovim with a minimal config that loads nuwiki.
#
# Builds the language server (release mode), symlinks it into `bin/` so
# the plugin's default install path resolves, then spawns Neovim with
# `--clean` and a generated `init.lua` that:
# * adds this repo to `runtimepath`
# * configures wiki_root to a scratch directory under
# $XDG_CACHE_HOME/nuwiki-dev/wiki
# * calls `require('nuwiki').setup({...})`
# The plugin's install() downloads a pre-built release of nuwiki-ls for
# your platform from the nuwiki-rs repository. On first launch a missing
# binary is auto-downloaded via the bundled Vim script; set
# NUWIKI_DEV_SKIP_BUILD=1 to skip the download entirely.
#
# Usage: ./development/start-nvim.sh [extra args...]
# ./development/start-nvim.sh # open the scratch wiki's index
# ./development/start-nvim.sh path/to/note.wiki # open a specific file
# NUWIKI_DEV_WIKI=/tmp/foo ./development/start-nvim.sh
# NUWIKI_DEV_NO_SEED=1 ./development/start-nvim.sh # use WIKI_DIR as-is (no scratch seeding)
# NUWIKI_DEV_SKIP_BUILD=1 ./development/start-nvim.sh # reuse the cached binary
#
# The release binary is rebuilt on every launch so source changes
# always reach the running LSP. `cargo build --release` is incremental,
# so this is a fast no-op when nothing changed. Set
# NUWIKI_DEV_SKIP_BUILD=1 to skip the build step entirely.
# NUWIKI_DEV_SKIP_BUILD=1 ./development/start-nvim.sh # skip the download step
#
# Each launch starts clean: the scratch wiki is reseeded from a pristine
# copy and the editor state (cache/data/config) is wiped, so stale edits
+3 -4
View File
@@ -22,13 +22,12 @@
# ./development/start-vim-coc.sh path/to/note.wiki # open a specific file
# NUWIKI_DEV_WIKI=/tmp/foo ./development/start-vim-coc.sh
# NUWIKI_DEV_NO_SEED=1 ./development/start-vim-coc.sh # use WIKI_DIR as-is (no scratch seeding)
# NUWIKI_DEV_SKIP_BUILD=1 ./development/start-vim-coc.sh # reuse the cached binary
# NUWIKI_DEV_SKIP_BUILD=1 ./development/start-vim-coc.sh # skip the download
# NUWIKI_DEV_COC_JUMP=edit ./development/start-vim-coc.sh # change coc.preferences.jumpCommand
# NUWIKI_DEV_VIMWIKI=1 ./development/start-vim-coc.sh # drive nuwiki from a g:vimwiki_list config (drop-in)
#
# The release binary is rebuilt on every launch so source changes always reach
# the running LSP. `cargo build --release` is incremental, so this is a fast
# no-op when nothing changed. Set NUWIKI_DEV_SKIP_BUILD=1 to skip the build.
# The LSP binary is downloaded on every launch if missing, falling back to a
# cached version. Set NUWIKI_DEV_SKIP_BUILD=1 to skip the download.
#
# Each launch starts clean: the scratch wiki is reseeded from a pristine
# copy and the editor state (viminfo/swap/undo, coc data) is wiped, so stale
+6 -6
View File
@@ -7,18 +7,18 @@
# the dev cache on first run so the LSP integration is exercisable
# without polluting your real Vim install.
#
# The plugin's install() downloads a pre-built release of nuwiki-ls for
# your platform from the nuwiki-rs repository. On first launch a missing
# binary is auto-downloaded via the bundled Vim script; set
# NUWIKI_DEV_SKIP_BUILD=1 to skip the download entirely.
#
# Usage: ./development/start-vim.sh [extra args...]
# ./development/start-vim.sh # open the scratch wiki's index
# ./development/start-vim.sh path/to/note.wiki # open a specific file
# NUWIKI_DEV_WIKI=/tmp/foo ./development/start-vim.sh
# NUWIKI_DEV_NO_LSP=1 ./development/start-vim.sh # skip vim-lsp setup
# NUWIKI_DEV_NO_SEED=1 ./development/start-vim.sh # use WIKI_DIR as-is (no scratch seeding)
# NUWIKI_DEV_SKIP_BUILD=1 ./development/start-vim.sh # reuse the cached binary
#
# The release binary is rebuilt on every launch so source changes
# always reach the running LSP. `cargo build --release` is incremental,
# so this is a fast no-op when nothing changed. Set
# NUWIKI_DEV_SKIP_BUILD=1 to skip the build step entirely.
# NUWIKI_DEV_SKIP_BUILD=1 ./development/start-vim.sh # skip the download step
#
# Each launch starts clean: the scratch wiki is reseeded from a pristine
# copy and the editor state (viminfo/swap/undo) is wiped, so stale edits
+29 -8
View File
@@ -10,8 +10,8 @@
# * opting out with use_calendar = false.
#
# A stub calendar-vim on the runtimepath provides :Calendar and seeds the
# default hook names. The LSP binary is built (setup() registers the client);
# the calendar paths themselves don't need the server.
# default hook names. The LSP binary is downloaded (setup() registers the
# client); the calendar paths themselves don't need the server.
#
# Exit: 0 when both runs are green, 1 otherwise. Skips (0) without nvim.
@@ -28,13 +28,34 @@ if ! command -v nvim >/dev/null 2>&1; then
exit 0
fi
# setup() registers the LSP client, so build the binary like the other
# Neovim harnesses do (incremental, fast).
# Download the LSP binary from nuwiki-rs releases (falls back to cargo build).
BIN="$REPO_ROOT/bin/nuwiki-ls"
log 'building nuwiki-ls (release, incremental)…'
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml" >/dev/null
mkdir -p "$REPO_ROOT/bin"
ln -sf "$REPO_ROOT/target/release/nuwiki-ls" "$BIN"
log 'downloading nuwiki-ls…'
if [[ ! -x "$BIN" ]]; then
vim -e -s -c "source $REPO_ROOT/scripts/download_bin.vim" -c "q" >/dev/null 2>&1 || true
fi
# If download failed, fall back to cargo build from nuwiki-rs.
if [[ ! -x "$BIN" ]]; then
log "download failed, falling back to cargo build from nuwiki-rs…"
rs_repo="$REPO_ROOT/nuwiki-rs"
if [[ ! -f "$rs_repo/Cargo.toml" ]]; then
log "cloning nuwiki-rs …"
git clone --depth 1 https://code.gfran.co/gffranco/nuwiki-rs.git "$rs_repo"
fi
cargo build --release -p nuwiki-ls --manifest-path "$rs_repo/Cargo.toml" >/dev/null
if [[ ! -f "$rs_repo/target/release/nuwiki-ls" ]]; then
echo 'FAIL: could not build nuwiki-ls binary' >&2
exit 1
fi
mkdir -p "$REPO_ROOT/bin"
ln -sf "$rs_repo/target/release/nuwiki-ls" "$BIN"
fi
if [[ ! -x "$BIN" ]]; then
echo 'FAIL: could not obtain nuwiki-ls binary' >&2
exit 1
fi
# --- Scratch wiki with one seeded diary entry (2026-05-30) ----------------
WIKI="$TMP/wiki"
+28 -9
View File
@@ -5,7 +5,7 @@
#
# The Lua harness needs a real LSP attachment (most keymaps dispatch
# `workspace/executeCommand`), so we:
# 1. ensure `bin/nuwiki-ls` is built (release),
# 1. download `bin/nuwiki-ls` from the nuwiki-rs releases,
# 2. spin up a scratch wiki under a temp dir,
# 3. invoke `nvim --headless` with a minimal init that loads the
# plugin + calls `setup()`, then sources the harness Lua.
@@ -20,15 +20,34 @@ trap 'rm -rf "$TMP"' EXIT
log() { printf '\033[1;34m[keymap-test]\033[0m %s\n' "$*"; }
# Always rebuild the LSP binary so harness runs against current sources.
# A previous version only built when the symlink was missing, which let
# stale binaries pass tests against unrelated code — incremental cargo
# build is fast, so just always run it.
# Download the LSP binary from nuwiki-rs releases (falls back to cargo build).
BIN="$REPO_ROOT/bin/nuwiki-ls"
log 'building nuwiki-ls (release, incremental)…'
cargo build --release -p nuwiki-ls --manifest-path "$REPO_ROOT/Cargo.toml" >/dev/null
mkdir -p "$REPO_ROOT/bin"
ln -sf "$REPO_ROOT/target/release/nuwiki-ls" "$BIN"
log 'downloading nuwiki-ls…'
if [[ ! -x "$BIN" ]]; then
vim -e -s -c "source $REPO_ROOT/scripts/download_bin.vim" -c "q" >/dev/null 2>&1 || true
fi
# If download failed, fall back to cargo build from nuwiki-rs.
if [[ ! -x "$BIN" ]]; then
log "download failed, falling back to cargo build from nuwiki-rs…"
rs_repo="$REPO_ROOT/nuwiki-rs"
if [[ ! -f "$rs_repo/Cargo.toml" ]]; then
log "cloning nuwiki-rs …"
git clone --depth 1 https://code.gfran.co/gffranco/nuwiki-rs.git "$rs_repo"
fi
cargo build --release -p nuwiki-ls --manifest-path "$rs_repo/Cargo.toml" >/dev/null
if [[ ! -f "$rs_repo/target/release/nuwiki-ls" ]]; then
echo 'FAIL: could not build nuwiki-ls binary' >&2
exit 1
fi
mkdir -p "$REPO_ROOT/bin"
ln -sf "$rs_repo/target/release/nuwiki-ls" "$BIN"
fi
if [[ ! -x "$BIN" ]]; then
echo 'FAIL: could not obtain nuwiki-ls binary' >&2
exit 1
fi
mkdir -p "$TMP/wiki"
echo "= seed =" > "$TMP/wiki/index.wiki"