diff --git a/.agents/docs/2026-11-21-editor-surfaces-and-feature-matrix.md b/.agents/docs/2026-11-21-editor-surfaces-and-feature-matrix.md index b8cd8e2..ac34177 100644 --- a/.agents/docs/2026-11-21-editor-surfaces-and-feature-matrix.md +++ b/.agents/docs/2026-11-21-editor-surfaces-and-feature-matrix.md @@ -1,8 +1,10 @@ # Editor surfaces and the feature matrix: one rule for every plugin, with Zed and Helix Status, 2026-11-21: accepted. Stream F (the fixes) is implemented in series 1.6.0; the section -"Stream F as implemented" records where the implementation differs from the plan. Streams S and E (the -surfaces, Zed and Helix) are not implemented and follow in pull requests of their own. The facts about +"Stream F as implemented" records where the implementation differs from the plan. Zed's extension, +its language server part only, is implemented as mcpp-zed 1.7.0 (2026-11-22, #21; section "Zed, as +implemented"). The rest of streams S and E (the surfaces, Zed's tasks and debug locator, Helix) is not +implemented and follows in pull requests of their own. The facts about this repository were read from `main` (7c411fb) and from mcpp-ide 1.5.0 run over its protocol. The facts about Zed and Helix come from their documentation and issue trackers and were not run; the section "Unverified facts" lists them. The facts about mcppls were read from its repository at release @@ -361,6 +363,25 @@ in a real Zed in that repository's CI. `mcpp-ide launch`. - A context server for Zed's agent is a later addition over the same backend as `agents/`. +### Zed, as implemented (2026-11-22) + +mcpp-zed 1.7.0 is the language server part of the plan above, made to the rules of Zed's registry +(zed-industries/extensions) and run in a real Zed 1.29.3 (Linux x86_64, under Xvfb with lavapipe). +Where it differs from the plan, and the facts the run settled: + +| Point | As implemented | Why | +|---|---|---| +| Id | `mcpp-ide-language-server`, name `mcpp IDE` | the registry asks an extension that provides only a language server for a `-language-server` or `-lsp` suffix, and an id never changes; `mcpp` is free for an extension that provides more | +| The backend | `lsp.mcpp-ide.binary`, else the bundle of `vX.Y.0` downloaded into the work directory (GitHub, else GitCode's `xlings-res/mcpp-ide`); not PATH | the extension cannot read the series a backend answers, so it could not refuse another series; the plan's PATH first is dropped | +| Where it starts | with any TOML file of a worktree, not only where `mcpp.toml` is at its root | declining was shown in Zed's status bar of every TOML project ("Failed to run mcpp-ide"), and missed projects below the root; the backend reads `mcpp.toml` and `build.mcpp` only | +| Trust | `trusted: true` | Zed starts no language server in a worktree it does not trust ("Waiting for worktree … to be trusted, before starting language server mcpp-ide", Zed.log) | +| `lsp..binary` | Zed itself starts the named command with the `arguments` given and nothing else, and still asks the extension for the initialization options | measured: a wrapper named without `arguments` was started with none; the README says to include `serve` | +| The series | 1.7.0: `protocol.schema.json` names `zed` among the editors, a backend path, so the extension begins a series | AGENTS.md §7: a change of behaviour updates the protocol schema in the same pull request | +| Tasks, the debug locator, a C++ server for `build.mcpp` | not yet | they follow; mcppls's extension serves C++ | + +mcppls's extension was made to the same rules in its repository (Sunrisepeak/mcpp-language-server +#93, `mcppls-language-server`, zed 0.23.1): its payload is downloaded the same way. + ### Versions and release Zed's `extension.toml` becomes a seventh statement of the version, with the tag `zed-vX.Y.Z`. The diff --git a/.agents/skills/mcpp-ide-development/SKILL.md b/.agents/skills/mcpp-ide-development/SKILL.md index e2e87aa..a951601 100644 --- a/.agents/skills/mcpp-ide-development/SKILL.md +++ b/.agents/skills/mcpp-ide-development/SKILL.md @@ -32,6 +32,7 @@ change reaches every plugin, because each plugin is tested over the backend. | vscode | `mide-plugins/vscode/` | `npm ci && npm test`; `npm run test:parity`, `npm run test:webui`, `npm run test:e2e`; `npm run package` | | clion | `mide-plugins/clion/` | `gradle test buildPlugin verifyPlugin` | | nvim | `mide-plugins/nvim/` | `nvim --headless --clean -l mide-plugins/nvim/tests/smoke.lua` | +| zed | `mide-plugins/zed/` | `cargo test`, `cargo build --release --target wasm32-wasip2` (Rust `ZED_RUST_VERSION`), `bash .github/scripts/check-zed-extension.sh mide-plugins/zed` | | CI | `.github/` | `bash .github/scripts/test_changes.sh`, `bash .github/scripts/release-plan.sh` | ## 3. Common changes @@ -64,8 +65,8 @@ change reaches every plugin, because each plugin is tested over the backend. The rules are in AGENTS.md §4 and [release-plan.sh](../../../.github/scripts/release-plan.sh). 1. Decide the kind. Any backend path changed since `vX.Y.0` means a series release `vX.Y+1.0` (or - `vX+1.0.0`). Otherwise it is a plugin patch, `-vX.Y.Z+1`. -2. On `release/`, bump the version statements (all six for a series, only the plugin's + `vX+1.0.0`). Otherwise it is a plugin patch, `-vX.Y.Z+1`. +2. On `release/`, bump the version statements (all seven for a series, only the plugin's own for a patch) and add the CHANGELOG.md section under its series, listing each component's version. Then run `bash .github/scripts/release-plan.sh `. 3. Open a pull request titled `X.Y.Z: ` and merge it after `ci` passes. @@ -75,3 +76,6 @@ The rules are in AGENTS.md §4 and [release-plan.sh](../../../.github/scripts/re `JETBRAINS_TOKEN`; Marketplace availability follows JetBrains review. 5. Watch the run until every job passes, then check that the release assets install (`mcpp-ide self-check` on a project). +6. A release that carries the Zed extension reaches Zed through a pull request to Zed's registry, + which a person opens and answers (its AI policy admits no agent): `mide-plugins/zed/README.md`, + "Zed's extension registry". diff --git a/.github/components.tsv b/.github/components.tsv index 54d5476..2e4098d 100644 --- a/.github/components.tsv +++ b/.github/components.tsv @@ -20,6 +20,7 @@ backend build.mcpp vscode mide-plugins/vscode/* clion mide-plugins/clion/* nvim mide-plugins/nvim/* +zed mide-plugins/zed/* # What only people read. docs docs/* docs agents/* diff --git a/.github/scripts/check-zed-extension.sh b/.github/scripts/check-zed-extension.sh new file mode 100755 index 0000000..4c35277 --- /dev/null +++ b/.github/scripts/check-zed-extension.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# check-zed-extension.sh -- what Zed's registry checks of an extension before it +# builds one (zed-industries/extensions: src/lib/validation.js, src/lib/license.js, and the +# publishing prerequisites at zed.dev/docs/extensions/publishing/prerequisites), so that a pull request +# there does not fail on it. +set -euo pipefail +dir="${1:?the extension directory}" +manifest="$dir/extension.toml" +field() { sed -n "s/^$1 = \"\(.*\)\"$/\1/p" "$manifest" | head -1; } +fail() { echo "check-zed-extension: $*" >&2; exit 1; } +id="$(field id)"; name="$(field name)"; version="$(field version)" +[[ "$id" =~ ^[a-z0-9-]+$ ]] || fail "the id '$id' is not lowercase letters, digits and '-'" +case "$id" in zed-*|*-zed|*extension*) fail "the id '$id' starts with zed-, ends with -zed or names 'extension'" ;; esac +case "$name" in "Zed "*|*" Zed") fail "the name '$name' starts or ends with Zed" ;; esac +[[ "${name,,}" != *extension* ]] || fail "the name '$name' names 'extension'" +[[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] || fail "the version '$version' is not X.Y.Z" +grep -qx 'schema_version = 1' "$manifest" || fail "schema_version is not 1" +# An extension that provides a language server and nothing else is named for it. +if ! grep -qE '^\[(grammars|languages)' "$manifest" && ! [ -d "$dir/languages" ] && ! [ -d "$dir/themes" ]; then + case "$id" in *-language-server|*-lsp) ;; *) fail "the id '$id' provides a language server only and ends in neither -language-server nor -lsp" ;; esac +fi +# The license is read in the extension's own directory; the repository's root does not count. +license="$(find "$dir" -maxdepth 1 -type f -iname 'licen[cs]e*' | head -1)" +[ -n "$license" ] || fail "no LICENSE in $dir" +text="$(tr -s '[:space:]' ' ' < "$license")" +for pattern in 'Apache License' 'Version 2.0, January 2004' 'http://www.apache.org/licenses/' \ + 'TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION' '1. Definitions.' \ + '2. Grant of Copyright License.' '3. Grant of Patent License.' '4. Redistribution.' \ + '5. Submission of Contributions.' '6. Trademarks.' '7. Disclaimer of Warranty.' \ + '8. Limitation of Liability.' '9. Accepting Warranty or Additional Liability.'; do + grep -qiF "$pattern" <<<"$text" || fail "$license is not the Apache 2.0 license the registry accepts (no '$pattern')" +done +echo "check-zed-extension: $id $version ($name): the registry's checks of the manifest and the license pass" diff --git a/.github/scripts/release-plan.sh b/.github/scripts/release-plan.sh index acbdfba..d626b2f 100755 --- a/.github/scripts/release-plan.sh +++ b/.github/scripts/release-plan.sh @@ -6,7 +6,7 @@ # of the backend changes every package, and it begins a series. Two kinds of tag: # # vX.Y.0 a series release: every component, each at X.Y.0 (a change of the backend) -# -vX.Y.Z one editor plugin's patch: vscode, clion or nvim, at X.Y.Z +# -vX.Y.Z one editor plugin's patch: vscode, clion, nvim or zed, at X.Y.Z # # Prints `components=...`, `version=...` and `title=...` for $GITHUB_OUTPUT. Without a tag it only # checks that every component states one series, the backend's two statements agree and the backend @@ -18,40 +18,45 @@ version[backend]="$(sed -n 's/^version *= *"\(.*\)"/\1/p' "$root/mcpp.toml" | he version[vscode]="$(sed -n 's/^ "version": "\(.*\)",$/\1/p' "$root/mide-plugins/vscode/package.json" | head -1)" version[clion]="$(sed -n 's/^pluginVersion *= *\(.*\)$/\1/p' "$root/mide-plugins/clion/gradle.properties" | head -1)" version[nvim]="$(sed -n "s/^M.version = '\(.*\)'$/\1/p" "$root/mide-plugins/nvim/lua/mcpp/session.lua" | head -1)" +version[zed]="$(sed -n 's/^version = "\(.*\)"$/\1/p' "$root/mide-plugins/zed/extension.toml" | head -1)" +zed_crate="$(sed -n 's/^version = "\(.*\)"$/\1/p' "$root/mide-plugins/zed/Cargo.toml" | head -1)" +zed_lock="$(sed -n '/^name = "zed-mcpp-ide"$/{n;s/^version = "\(.*\)"$/\1/p;}' "$root/mide-plugins/zed/Cargo.lock" | head -1)" backend_source="$(sed -n 's/^inline constexpr std::string_view kVersion = "\(.*\)";$/\1/p' "$root/src/server.cppm" | head -1)" series_source="$(sed -n 's/^inline constexpr std::string_view kSeries = "\(.*\)";$/\1/p' "$root/src/server.cppm" | head -1)" fail() { echo "release-plan: $*" >&2; exit 1; } series() { [[ "$1" =~ ^([0-9]+)\.([0-9]+)\.[0-9]+$ ]] && echo "${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"; } -for c in backend vscode clion nvim; do +for c in backend vscode clion nvim zed; do [ -n "${version[$c]}" ] && [ -n "$(series "${version[$c]}")" ] || fail "$c states no X.Y.Z version (${version[$c]:-none})" done +[ "$zed_crate" = "${version[zed]}" ] || fail "mide-plugins/zed/Cargo.toml says $zed_crate and its extension.toml ${version[zed]}" +[ "$zed_lock" = "${version[zed]}" ] || fail "mide-plugins/zed/Cargo.lock says $zed_lock and its extension.toml ${version[zed]}" [ "$backend_source" = "${version[backend]}" ] || fail "src/server.cppm says $backend_source and mcpp.toml ${version[backend]}" the_series="$(series "${version[backend]}")" [ "${version[backend]}" = "$the_series.0" ] \ || fail "the backend is ${version[backend]}; it is always its series' X.Y.0 (the editor packages carry it, so a change of it begins a series)" [ "$series_source" = "$the_series" ] || fail "src/server.cppm's kSeries is $series_source, the backend's series $the_series" -for c in vscode clion nvim; do +for c in vscode clion nvim zed; do [ "$(series "${version[$c]}")" = "$the_series" ] \ || fail "$c is ${version[$c]}, of another series than the backend's ${version[backend]}" done tag="${1:-}" if [ -z "$tag" ]; then - echo "one series $the_series: backend ${version[backend]}, vscode ${version[vscode]}, clion ${version[clion]}, nvim ${version[nvim]}" + echo "one series $the_series: backend ${version[backend]}, vscode ${version[vscode]}, clion ${version[clion]}, nvim ${version[nvim]}, zed ${version[zed]}" exit 0 fi if [[ "$tag" =~ ^v([0-9]+\.[0-9]+\.0)$ ]]; then v="${BASH_REMATCH[1]}" - for c in backend vscode clion nvim; do + for c in backend vscode clion nvim zed; do [ "${version[$c]}" = "$v" ] || fail "the series release $tag needs every component at $v; $c is ${version[$c]}" done - echo "components=backend vscode clion nvim" + echo "components=backend vscode clion nvim zed" echo "version=$v" echo "title=mcpp-ide $v" elif [[ "$tag" =~ ^backend-v ]]; then fail "$tag: the backend has no patch of its own; a change of it is a series release vX.Y.0" -elif [[ "$tag" =~ ^(vscode|clion|nvim)-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then +elif [[ "$tag" =~ ^(vscode|clion|nvim|zed)-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then c="${BASH_REMATCH[1]}"; v="${BASH_REMATCH[2]}" [ "${version[$c]}" = "$v" ] || fail "the tag $tag names $c $v, and $c is ${version[$c]}" # A plugin's patch carries its series' backend: no path of the backend (.github/components.tsv) @@ -70,10 +75,10 @@ elif [[ "$tag" =~ ^(vscode|clion|nvim)-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then done done < <(git -C "$root" diff --name-only "v$the_series.0" HEAD) fi - declare -A names=([vscode]=mcpp-vscode [clion]=mcpp-clion [nvim]=mcpp-nvim) + declare -A names=([vscode]=mcpp-vscode [clion]=mcpp-clion [nvim]=mcpp-nvim [zed]=mcpp-zed) echo "components=$c" echo "version=$v" echo "title=${names[$c]} $v" else - fail "$tag is neither vX.Y.0 nor -vX.Y.Z" + fail "$tag is neither vX.Y.0 nor -vX.Y.Z" fi diff --git a/.github/scripts/test_changes.sh b/.github/scripts/test_changes.sh index ebd3707..27b8f5f 100755 --- a/.github/scripts/test_changes.sh +++ b/.github/scripts/test_changes.sh @@ -24,7 +24,8 @@ check() { # check -- check "a plugin alone" pull_request backend=false clion=true vscode=false nvim=false full=false -- mide-plugins/clion/src/main/kotlin/X.kt check "its README is the plugin's" pull_request vscode=true docs=false backend=false -- mide-plugins/vscode/README.md check "documentation alone" pull_request docs=true backend=false vscode=false -- docs/x.md README.md -check "the backend reaches every plugin" pull_request backend=true vscode=true clion=true nvim=true -- src/main.cpp +check "the backend reaches every plugin" pull_request backend=true vscode=true clion=true nvim=true zed=true -- src/main.cpp +check "the Zed extension alone" pull_request zed=true backend=false vscode=false clion=false nvim=false full=false -- mide-plugins/zed/src/lib.rs check "spec/ is the backend's" pull_request backend=true vscode=true -- spec/test-frameworks.json check "the issue and pull-request forms are documentation" pull_request docs=true backend=false full=false -- .github/ISSUE_TEMPLATE/bug_report.yml .github/pull_request_template.md check "a skill is documentation" pull_request docs=true backend=false full=false -- .agents/skills/mcpp-ide-development/SKILL.md AGENTS.md diff --git a/.github/versions.env b/.github/versions.env index 2ab092b..f170d82 100644 --- a/.github/versions.env +++ b/.github/versions.env @@ -12,3 +12,6 @@ XLINGS_VERSION=v2026.10.26.1 VSCODE_VERSION=1.91.0 # The mtest whose report of each `mcpp test` run is the job's summary (.github/actions/mtest-report). MTEST_VERSION=0.5.2 +# The Rust Zed's registry builds extensions with (zed-industries/extensions, ci.yml), which the Zed +# extension's job builds it with. +ZED_RUST_VERSION=1.90 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e54fee3..445dad6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,7 @@ jobs: vscode: ${{ steps.classify.outputs.vscode }} clion: ${{ steps.classify.outputs.clion }} nvim: ${{ steps.classify.outputs.nvim }} + zed: ${{ steps.classify.outputs.zed }} digest: ${{ steps.classify.outputs.digest }} lend: ${{ steps.classify.outputs.lend }} steps: @@ -659,6 +660,32 @@ jobs: with: plugin_artifact: mcpp-clion-zip + # The Zed extension (mide-plugins/zed): its tests on the host, the crate built for wasm32-wasip2 with + # the Rust Zed's registry builds extensions with (ZED_RUST_VERSION), and what the registry checks of + # the manifest and the license. It needs no backend: it downloads its series' release. Zed's registry + # builds the commit a pull request there names, so nothing is packaged here (its README). + zed: + name: Zed extension + needs: changes + if: needs.changes.outputs.zed == 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 15 + defaults: + run: + working-directory: mide-plugins/zed + steps: + - uses: actions/checkout@v5 + - name: The Rust of Zed's registry + run: | + set -euo pipefail + version="$(sed -n 's/^ZED_RUST_VERSION=//p' ../../.github/versions.env)" + rustup toolchain install "$version" --profile minimal --target wasm32-wasip2 + echo "RUSTUP_TOOLCHAIN=$version" >> "$GITHUB_ENV" + - run: cargo test --locked + - run: cargo build --locked --release --target wasm32-wasip2 + - name: What the registry checks of the manifest and the license + run: bash ../../.github/scripts/check-zed-extension.sh . + # The Neovim plugin (mide-plugins/nvim) in a headless Neovim, against the backend built here: over # the mock mcpp on the oldest and the newest Neovim it supports, then over the real mcpp, which # builds the test's project. Neovim comes from xlings (`nvim` in xim-pkgindex), each version @@ -778,7 +805,7 @@ jobs: name: ci if: always() needs: [changes, checks, versions, matrix, backend, backend-openkal, vscode-gates, vscode-drift, vscode, vscode-e2e, - vscode-isolated-install, vscode-graph-browser, clion, clion-stable, nvim, packages] + vscode-isolated-install, vscode-graph-browser, clion, clion-stable, nvim, zed, packages] runs-on: ubuntu-24.04 timeout-minutes: 5 steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a9cd9a..c86e87c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,13 +15,15 @@ name: Release # vscode-vX.Y.Z the VSIX (Open VSX) # clion-vX.Y.Z the CLion ZIP (JetBrains Marketplace) # nvim-vX.Y.Z the Neovim plugin: the tag's source archive (xim's mcpp-ide-nvim) +# zed-vX.Y.Z the Zed extension: the tagged commit, which a pull request to Zed's registry +# (zed-industries/extensions) names; the release carries no file of its own # # The tag's version must be the component's own, and every component one series. on: workflow_dispatch: push: - tags: ['v*', 'vscode-v*', 'clion-v*', 'nvim-v*'] + tags: ['v*', 'vscode-v*', 'clion-v*', 'nvim-v*', 'zed-v*'] permissions: contents: read @@ -83,6 +85,7 @@ jobs: vscode) cp artifacts/mcpp-vscode-vsix/*.vsix dist/ ;; clion) cp artifacts/mcpp-clion-zip/*.zip dist/ ;; nvim) ;; # the tag's source archive is the plugin + zed) ;; # Zed's registry builds the tagged commit esac done notes="$RUNNER_TEMP/notes.md" diff --git a/.gitignore b/.gitignore index f4d2e55..a7c2b03 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ mide-plugins/clion/build/ mide-plugins/clion/.gradle/ mide-plugins/clion/.intellijPlatform/ mide-plugins/clion/.kotlin/ +mide-plugins/zed/extension.wasm webui/dist/ *.log compile_commands.json diff --git a/AGENTS.md b/AGENTS.md index 8561ce6..b14c982 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # AGENTS.md mcpp-ide is the IDE layer of [mcpp](https://github.com/mcpp-community/mcpp): one backend (`mcpp-ide serve`, -C++23 modules) and the editor plugins that host it (`mide-plugins/`: VS Code, CLion, Neovim). This file +C++23 modules) and the editor plugins that host it (`mide-plugins/`: VS Code, CLion, Neovim, Zed). This file gives the rules in their shortest form and links to the full statement, which holds where they differ. ## 1. Where a fact lives @@ -55,11 +55,14 @@ gives the rules in their shortest form and links to the full statement, which ho - A version is `X.Y.Z`. The series `X.Y` is shared by the backend and every plugin; `Z` is one plugin's own patch. The backend is always `X.Y.0`: every package carries it, so a change to any backend path ([components.tsv](.github/components.tsv)) begins a new series. -- Six statements: `mcpp.toml`, `src/server.cppm` (`kVersion`, `kSeries`), `vscode/package.json`, - `clion/gradle.properties` (`pluginVersion`), `nvim/lua/mcpp/session.lua` (`M.version`). A series - changes all of them in one commit, a patch only its plugin's; CI checks that they agree. -- Tags: `vX.Y.0` releases every component. `vscode-vX.Y.Z`, `clion-vX.Y.Z` and `nvim-vX.Y.Z` release - one plugin's patch, and are refused if the backend changed after `vX.Y.0`. +- Seven statements: `mcpp.toml`, `src/server.cppm` (`kVersion`, `kSeries`), `vscode/package.json`, + `clion/gradle.properties` (`pluginVersion`), `nvim/lua/mcpp/session.lua` (`M.version`), + `zed/extension.toml` (with its `Cargo.toml` and `Cargo.lock`). A series changes all of them in one commit, a patch + only its plugin's; CI checks that they agree. +- Tags: `vX.Y.0` releases every component. `vscode-vX.Y.Z`, `clion-vX.Y.Z`, `nvim-vX.Y.Z` and + `zed-vX.Y.Z` release one plugin's patch, and are refused if the backend changed after `vX.Y.0`. + Zed's registry builds a tagged commit through a pull request a person opens there + (`mide-plugins/zed/README.md`). - Pins name only released versions: [versions.env](.github/versions.env) (CI), `.xlings.json`, `mcpp = ">=..."`. ## 5. Build and test @@ -70,6 +73,7 @@ mcpp run mcpp-ide-dev -- check-sources && mcpp run mcpp-ide-dev -- check-i18n (cd mide-plugins/vscode && npm ci && npm test) # extension, parity gates included (cd mide-plugins/clion && gradle buildPlugin verifyPlugin) # CLion plugin nvim --headless --clean -l mide-plugins/nvim/tests/smoke.lua # Neovim plugin +(cd mide-plugins/zed && cargo test) # Zed extension ``` - Edit `spec/`, never what is generated from it. `mcpp-ide-dev gen vscode` rewrites the extension's @@ -83,7 +87,9 @@ nvim --headless --clean -l mide-plugins/nvim/tests/smoke.lua # Neovim plugin reached only through `mcpplibs.os` (`os::host()`, never `os::is_`, which an ok image answers false). `check-sources` enforces all of this. - CLion: public IntelliJ API only (the verifier reports internal use). VS Code: the oldest - `engines.vscode` (`VSCODE_VERSION`). Neovim: 0.10 and later, over `vim.lsp`. + `engines.vscode` (`VSCODE_VERSION`). Neovim: 0.10 and later, over `vim.lsp`. Zed: + `zed_extension_api` for `wasm32-wasip2` and the rules of Zed's registry; its few messages, shown + before a backend answers, are English, as the registry asks. - User-facing strings belong to the backend (`spec/i18n`), and English and Chinese change together. - Follow the neighbouring code and change only what the task needs. A comment says why, not what. diff --git a/CHANGELOG.md b/CHANGELOG.md index 0129979..1d4c75e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,31 @@ The changelog is kept by series (`X.Y`); each section lists its components' releases. +## 1.7 + +### 1.7.0 + +Every component is 1.7.0: the backend, mcpp-vscode, mcpp-clion and mcpp-nvim (from 1.6.0), and +mcpp-zed, new. The backend's code is that of 1.6.0; the protocol names the new editor. + +- **mcpp-zed, the Zed extension** (#21): the backend as a language server of `mcpp.toml`, in Zed's + own UI. It is published through Zed's extension registry (zed-industries/extensions) as + `mcpp IDE` (`mcpp-ide-language-server`). + - **The backend of its own series.** `lsp.mcpp-ide.binary` in Zed's settings names one; otherwise + the extension downloads `mcpp-ide-1.7.0-openkal-bundle-all.tar.gz` of `v1.7.0` once into its work + directory (GitHub, else the GitCode mirror) and starts this system's runner on this + architecture's image. A `mcpp-ide` on PATH is not started: the extension cannot read the series a + backend answers. + - **Every TOML worktree, every mcpp project in it.** Zed starts the backend with a worktree's first + TOML file, once the worktree is trusted; the backend finds the projects below the worktree and + reads `mcpp.toml` and `build.mcpp` only, so a worktree without one shows nothing. + - **What Zed's registry requires.** The id's `-language-server` suffix, the license in + `mide-plugins/zed/`, Rust 1.90 for `wasm32-wasip2`: CI's Zed job builds it so and runs the + registry's checks of the manifest and the license. `extension.toml` (with its `Cargo.toml` and + `Cargo.lock`) is the seventh statement of the series, and `zed-vX.Y.Z` tags a patch. +- **The protocol names `zed`** among the editors of `initialize`'s options and of + `mcpp-ide/commands/list`. + ## 1.6 ### 1.6.0 diff --git a/README.md b/README.md index 2103706..2d5e57e 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,12 @@ flowchart TB vscode("VS Code
mcpp-vscode"):::client clion("CLion
mcpp-clion"):::client nvim("Neovim
mcpp-nvim"):::client + zed("Zed
mcpp-zed"):::client agent("Agents
mcpp-ide skill"):::client serve("mcpp-ide serve
LSP · every decision"):::core mcppls("mcppls
C++ language server"):::ls mcpp("mcpp
build · test · pack"):::tool - vscode & clion & nvim & agent --> serve + vscode & clion & nvim & zed & agent --> serve serve -- contract --> mcpp serve -. status .-> mcppls classDef client fill:#ffffff,stroke:#54aeff,color:#0550ae @@ -56,16 +57,16 @@ flowchart TB ## Editors -| | VS Code 1.91+ | CLion 2026.1+ | Neovim 0.10+ | -|---|---|---|---| -| **Install** | [Marketplace](https://marketplace.visualstudio.com/items?itemName=mcpp-community.mcpp-vscode) · [Open VSX](https://open-vsx.org/extension/mcpp-community/mcpp-vscode) | [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/35632-mcpp) | `xlings install mcpp-ide-nvim` | -| **Build · run · test** | tasks, Testing view | run configurations, test runner | `:Mcpp`, quickfix | -| **Debug** | CodeLLDB · C/C++ · lldb-dap | GDB · LLDB | nvim-dap | -| **Views** | libraries, graphs, cache, settings | native trees, forms, JCEF graphs | floating windows | -| **C++ (mcppls)** | [installed with it](https://marketplace.visualstudio.com/items?itemName=sunrisepeak.mcpp-language-server) | [mcppls plugin](https://plugins.jetbrains.com/plugin/35609) | `xlings install mcppls-nvim` | -| **Guide** | [mcpp-vscode](mide-plugins/vscode/README.md) | [mcpp-clion](mide-plugins/clion/README.md) | [mcpp-nvim](mide-plugins/nvim/README.md) | +| | VS Code 1.91+ | CLion 2026.1+ | Neovim 0.10+ | Zed | +|---|---|---|---|---| +| **Install** | [Marketplace](https://marketplace.visualstudio.com/items?itemName=mcpp-community.mcpp-vscode) · [Open VSX](https://open-vsx.org/extension/mcpp-community/mcpp-vscode) | [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/35632-mcpp) | `xlings install mcpp-ide-nvim` | Zed's extensions: **mcpp IDE** | +| **Build · run · test** | tasks, Testing view | run configurations, test runner | `:Mcpp`, quickfix | not yet | +| **Debug** | CodeLLDB · C/C++ · lldb-dap | GDB · LLDB | nvim-dap | not yet | +| **Views** | libraries, graphs, cache, settings | native trees, forms, JCEF graphs | floating windows | not yet | +| **C++ (mcppls)** | [installed with it](https://marketplace.visualstudio.com/items?itemName=sunrisepeak.mcpp-language-server) | [mcppls plugin](https://plugins.jetbrains.com/plugin/35609) | `xlings install mcppls-nvim` | Zed's extensions: **C++ Modules Language Server** | +| **Guide** | [mcpp-vscode](mide-plugins/vscode/README.md) | [mcpp-clion](mide-plugins/clion/README.md) | [mcpp-nvim](mide-plugins/nvim/README.md) | [mcpp-zed](mide-plugins/zed/README.md) | -mcpp.toml and build.mcpp get completion, hover, jumps and diagnostics in every editor. The VS Code and +mcpp.toml and build.mcpp get completion, hover, jumps and diagnostics in every editor (Zed: mcpp.toml). The VS Code and CLion packages carry the backend for Linux x64/arm64, macOS arm64 and Windows x64; offline, install the `.vsix` or `.zip` from [Releases](https://github.com/mcpp-community/mcpp-ide/releases). Agents and other clients use `xlings install mcpp-ide`, then `mcpp-ide serve`. Verify any install with `mcpp-ide self-check`; versions: [docs/versions.md](docs/versions.md). @@ -96,6 +97,7 @@ mcpp build && mcpp test # the backend, its (cd mide-plugins/vscode && npm ci && npm test) # VS Code, the parity gates included (cd mide-plugins/clion && gradle buildPlugin verifyPlugin) # CLion (xlings install gradle) nvim --headless --clean -l mide-plugins/nvim/tests/smoke.lua # Neovim +(cd mide-plugins/zed && cargo test) # Zed ``` The environment, the tests for each component, common changes and the release procedure are in the diff --git a/README.zh-CN.md b/README.zh-CN.md index 7dc8e46..2d472eb 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -31,11 +31,12 @@ flowchart TB vscode("VS Code
mcpp-vscode"):::client clion("CLion
mcpp-clion"):::client nvim("Neovim
mcpp-nvim"):::client + zed("Zed
mcpp-zed"):::client agent("Agents
mcpp-ide skill"):::client serve("mcpp-ide serve
LSP · 所有决定"):::core mcppls("mcppls
C++ 语言服务器"):::ls mcpp("mcpp
构建 · 测试 · 打包"):::tool - vscode & clion & nvim & agent --> serve + vscode & clion & nvim & zed & agent --> serve serve -- 契约 --> mcpp serve -. 状态 .-> mcppls classDef client fill:#ffffff,stroke:#54aeff,color:#0550ae @@ -55,16 +56,16 @@ flowchart TB ## 编辑器 -| | VS Code 1.91+ | CLion 2026.1+ | Neovim 0.10+ | -|---|---|---|---| -| **安装** | [Marketplace](https://marketplace.visualstudio.com/items?itemName=mcpp-community.mcpp-vscode) · [Open VSX](https://open-vsx.org/extension/mcpp-community/mcpp-vscode) | [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/35632-mcpp) | `xlings install mcpp-ide-nvim` | -| **构建 · 运行 · 测试** | 任务、测试视图 | 运行配置、测试运行器 | `:Mcpp`、quickfix | -| **调试** | CodeLLDB · C/C++ · lldb-dap | GDB · LLDB | nvim-dap | -| **视图** | 库、依赖图、缓存、设置 | 原生树、表单、JCEF 图 | 浮动窗口 | -| **C++(mcppls)** | [随扩展安装](https://marketplace.visualstudio.com/items?itemName=sunrisepeak.mcpp-language-server) | [mcppls 插件](https://plugins.jetbrains.com/plugin/35609) | `xlings install mcppls-nvim` | -| **指南** | [mcpp-vscode](mide-plugins/vscode/README.zh-CN.md) | [mcpp-clion](mide-plugins/clion/README.md) | [mcpp-nvim](mide-plugins/nvim/README.md) | +| | VS Code 1.91+ | CLion 2026.1+ | Neovim 0.10+ | Zed | +|---|---|---|---|---| +| **安装** | [Marketplace](https://marketplace.visualstudio.com/items?itemName=mcpp-community.mcpp-vscode) · [Open VSX](https://open-vsx.org/extension/mcpp-community/mcpp-vscode) | [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/35632-mcpp) | `xlings install mcpp-ide-nvim` | Zed 扩展页:**mcpp IDE** | +| **构建 · 运行 · 测试** | 任务、测试视图 | 运行配置、测试运行器 | `:Mcpp`、quickfix | 暂无 | +| **调试** | CodeLLDB · C/C++ · lldb-dap | GDB · LLDB | nvim-dap | 暂无 | +| **视图** | 库、依赖图、缓存、设置 | 原生树、表单、JCEF 图 | 浮动窗口 | 暂无 | +| **C++(mcppls)** | [随扩展安装](https://marketplace.visualstudio.com/items?itemName=sunrisepeak.mcpp-language-server) | [mcppls 插件](https://plugins.jetbrains.com/plugin/35609) | `xlings install mcppls-nvim` | Zed 扩展页:**C++ Modules Language Server** | +| **指南** | [mcpp-vscode](mide-plugins/vscode/README.zh-CN.md) | [mcpp-clion](mide-plugins/clion/README.md) | [mcpp-nvim](mide-plugins/nvim/README.md) | [mcpp-zed](mide-plugins/zed/README.md) | -mcpp.toml 与 build.mcpp 在所有编辑器中都有补全、悬停、跳转与诊断。VS Code 与 CLion 的包自带后端,覆盖 +mcpp.toml 与 build.mcpp 在所有编辑器中都有补全、悬停、跳转与诊断(Zed 只有 mcpp.toml)。VS Code 与 CLion 的包自带后端,覆盖 Linux x64/arm64、macOS arm64 与 Windows x64;离线时从[发布页](https://github.com/mcpp-community/mcpp-ide/releases)安装 `.vsix` 或 `.zip`。Agent 与其他 客户端使用 `xlings install mcpp-ide`,然后运行 `mcpp-ide serve`。安装后用 `mcpp-ide self-check` 验证;版本见 [docs/versions.md](docs/versions.md)。 @@ -93,6 +94,7 @@ mcpp build && mcpp test # 后端、mock 与 (cd mide-plugins/vscode && npm ci && npm test) # VS Code,含 parity 门禁 (cd mide-plugins/clion && gradle buildPlugin verifyPlugin) # CLion(xlings install gradle) nvim --headless --clean -l mide-plugins/nvim/tests/smoke.lua # Neovim +(cd mide-plugins/zed && cargo test) # Zed ``` 环境、各组件的测试、常见改动与发布流程见[开发 skill](.agents/skills/mcpp-ide-development/SKILL.md)。 diff --git a/docs/architecture.md b/docs/architecture.md index e8b3046..4ef64ce 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -35,6 +35,7 @@ backend (`webui/tests`). The strings are the backend's (`i18n/bundle`), the ones | `mide-plugins/vscode` | mcpp-vscode | `vscode` | package.json's contributes, from `mcpp-ide-dev gen vscode` | the pages, tasks, the Testing view, debug configurations, Problems | | `mide-plugins/clion` | mcpp-clion | `jetbrains` (the IntelliJ platform) | actions and message bundles, from `mcpp-ide-dev gen jetbrains` | run configurations, the test tree, CLion's debugger, the tool window's native views, the settings form, the graph page in JCEF | | `mide-plugins/nvim` | mcpp-nvim | `nvim` | nothing: `:Mcpp` reads the command table from the backend | jobs in a buffer, a terminal for the program, `vim.diagnostic` and the quickfix list, the view models as text, nvim-dap | +| `mide-plugins/zed` | mcpp-zed | `zed` | `extension.toml`: the backend as a language server of TOML | nothing beyond LSP: completion, hover and diagnostics of mcpp.toml in Zed's own UI | `spec/commands.json` says which editors offer a command (`editors`, every editor when absent; a forward to mcppls's commands only VS Code) and, where an editor is left out, why (`omitted`). The @@ -194,7 +195,9 @@ Before it, a configured `mcpp.ide.backendPath` (a program or an `.okb`) is used; installed `mcpp-ide` (xlings, whose command runs okrun on its bundle) or one on PATH. The Neovim plugin carries no package of the backend: it starts setup()'s `backend`, else `mcpp-ide` on PATH, and `xlings install mcpp-ide-nvim` installs it from the release's source tree, with the backend's -package as its dependency. CI packs the +package as its dependency. The Zed extension carries no backend either: it starts the one +`lsp.mcpp-ide.binary` names, else downloads its series' bundle from the release `vX.Y.0` into its +work directory, and never one from PATH, whose series it could not check. CI packs the bundle and the target set's tree (`mcpp-ide--openkal-bundle-all.tar.gz`, a release asset) in one pack on Linux, takes okrun from that tree, opens both editor packages and the tree on every system and starts what they carry for it (`.github/scripts/check-package.sh`). diff --git a/docs/versions.md b/docs/versions.md index 2f99b90..7b46e17 100644 --- a/docs/versions.md +++ b/docs/versions.md @@ -9,7 +9,7 @@ install that matches. The VS Code and CLion packages carry the backend, so a change to the backend changes every package. It therefore begins a new series: every component moves to `X.Y.0`, tagged `vX.Y.0`, and the backend is always its series' `X.Y.0`. `Z` is an editor plugin's own patch, tagged -`vscode-vX.Y.Z`, `clion-vX.Y.Z` or `nvim-vX.Y.Z`. Such a tag publishes that plugin alone over its +`vscode-vX.Y.Z`, `clion-vX.Y.Z`, `nvim-vX.Y.Z` or `zed-vX.Y.Z`. Such a tag publishes that plugin alone over its series' backend; VS Code 1.3.2 and CLion 1.3.1, for example, both carry backend 1.3.0. A plugin patch is refused when any backend path has changed since its series' tag ([release-plan.sh](../.github/scripts/release-plan.sh)). diff --git a/mcpp.toml b/mcpp.toml index fbdc212..4f29fcd 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -9,7 +9,7 @@ # M2/M3), where the system it runs upon is answered when the image is loaded. [package] name = "mcpp-ide" -version = "1.6.0" +version = "1.7.0" description = "The IDE backend for mcpp: sessions, jobs, records and view models over mcpp's control contract" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/mide-plugins/clion/gradle.properties b/mide-plugins/clion/gradle.properties index c8d38d7..99e69c1 100644 --- a/mide-plugins/clion/gradle.properties +++ b/mide-plugins/clion/gradle.properties @@ -2,7 +2,7 @@ # where it installs (2026.1 and later); the verifier checks both ends. platformType = CL platformVersion = 2026.2.3 -pluginVersion = 1.6.0 +pluginVersion = 1.7.0 # The mcppls CLion plugin this one depends on (io.github.sunrisepeak.mcppls): # its release's one package for every system, fetched for the sandbox, the tests and the verifier. mcpplsPluginVersion = 0.23.0 diff --git a/mide-plugins/nvim/lua/mcpp/session.lua b/mide-plugins/nvim/lua/mcpp/session.lua index 3039203..814d4c6 100644 --- a/mide-plugins/nvim/lua/mcpp/session.lua +++ b/mide-plugins/nvim/lua/mcpp/session.lua @@ -13,7 +13,7 @@ local uv = vim.uv or vim.loop local is_windows = vim.fn.has('win32') == 1 -- mcpp-nvim's version: mcpp-ide's, whose release carries it. -M.version = '1.6.0' +M.version = '1.7.0' -- Neovim's version, as its release names it. function M.nvim_version() diff --git a/mide-plugins/vscode/package-lock.json b/mide-plugins/vscode/package-lock.json index 583db59..5167602 100644 --- a/mide-plugins/vscode/package-lock.json +++ b/mide-plugins/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "mcpp-vscode", - "version": "1.6.0", + "version": "1.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mcpp-vscode", - "version": "1.6.0", + "version": "1.7.0", "license": "Apache-2.0", "devDependencies": { "@mermaid-js/tiny": "12.2.0", diff --git a/mide-plugins/vscode/package.json b/mide-plugins/vscode/package.json index b9f4e31..3f436ee 100644 --- a/mide-plugins/vscode/package.json +++ b/mide-plugins/vscode/package.json @@ -2,7 +2,7 @@ "name": "mcpp-vscode", "displayName": "%displayName%", "description": "%description%", - "version": "1.6.0", + "version": "1.7.0", "publisher": "mcpp-community", "license": "Apache-2.0", "icon": "media/logo.png", diff --git a/mide-plugins/vscode/test/artifacts.test.ts b/mide-plugins/vscode/test/artifacts.test.ts index 1c4d0c7..eab4165 100644 --- a/mide-plugins/vscode/test/artifacts.test.ts +++ b/mide-plugins/vscode/test/artifacts.test.ts @@ -649,7 +649,7 @@ test("a release publishes the VSIX CI built, with its checksum", () => { const workflow = readFileSync(path.join(workflows, "release.yml"), "utf8"); // A series release (vX.Y.0) and each editor plugin's patch tag (D15); vscode-vX.Y.Z publishes the VSIX alone. // The backend has no patch tag: the packages carry it, so a change of it is a series release. - assert.match(workflow, /push:\s*\n\s+tags: \['v\*', 'vscode-v\*', 'clion-v\*', 'nvim-v\*'\]/); + assert.match(workflow, /push:\s*\n\s+tags: \['v\*', 'vscode-v\*', 'clion-v\*', 'nvim-v\*', 'zed-v\*'\]/); assert.doesNotMatch(workflow, /backend-v\*/); assert.match(workflow, /release-plan\.sh "\$GITHUB_REF_NAME"/); assert.match(workflow, /contents: write/); diff --git a/mide-plugins/zed/Cargo.lock b/mide-plugins/zed/Cargo.lock new file mode 100644 index 0000000..68804f9 --- /dev/null +++ b/mide-plugins/zed/Cargo.lock @@ -0,0 +1,845 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "auditable-serde" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7bf8143dfc3c0258df908843e169b5cc5fcf76c7718bd66135ef4a9cd558c5" +dependencies = [ + "semver", + "serde", + "serde_json", + "topological-sort", +] + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "crc32fast" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide", + "zlib-rs", +] + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.119", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" + +[[package]] +name = "spdx" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e17e880bafaeb362a7b751ec46bdc5b61445a188f80e0606e68167cd540fa3" +dependencies = [ + "smallvec", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "topological-sort" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "wasm-encoder" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bb72f02e7fbf07183443b27b0f3d4144abf8c114189f2e088ed95b696a7822" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce1ef0faabbbba6674e97a56bee857ccddf942785a336c8b47b42373c922a91d" +dependencies = [ + "anyhow", + "auditable-serde", + "flate2", + "indexmap", + "serde", + "serde_derive", + "serde_json", + "spdx", + "url", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "wit-bindgen" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10fb6648689b3929d56bbc7eb1acf70c9a42a29eb5358c67c10f54dbd5d695de" +dependencies = [ + "wit-bindgen-rt", + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92fa781d4f2ff6d3f27f3cc9b74a73327b31ca0dc4a3ef25a0ce2983e0e5af9b" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rt" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db52a11d4dfb0a59f194c064055794ee6564eb1ced88c25da2cf76e50c5621" +dependencies = [ + "bitflags", + "futures", + "once_cell", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d0809dc5ba19e2e98661bf32fc0addc5a3ca5bf3a6a7083aa6ba484085ff3ce" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn 2.0.119", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad19eec017904e04c60719592a803ee5da76cb51c81e3f6fbf9457f59db49799" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.119", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "635c3adc595422cbf2341a17fb73a319669cc8d33deed3a48368a841df86b676" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf445ed5157046e4baf56f9138c124a0824d4d1657e7204d71886ad8ce2fc11" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zed-mcpp-ide" +version = "1.7.0" +dependencies = [ + "zed_extension_api", +] + +[[package]] +name = "zed_extension_api" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0729d50b4ca0a7e28e590bbe32e3ca0194d97ef654961451a424c661a366fca0" +dependencies = [ + "serde", + "serde_json", + "wit-bindgen", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/mide-plugins/zed/Cargo.toml b/mide-plugins/zed/Cargo.toml new file mode 100644 index 0000000..40fa316 --- /dev/null +++ b/mide-plugins/zed/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "zed-mcpp-ide" +version = "1.7.0" +edition = "2021" +publish = false +license = "Apache-2.0" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +zed_extension_api = "0.7" diff --git a/mide-plugins/zed/LICENSE b/mide-plugins/zed/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/mide-plugins/zed/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/mide-plugins/zed/README.md b/mide-plugins/zed/README.md new file mode 100644 index 0000000..0a33dd8 --- /dev/null +++ b/mide-plugins/zed/README.md @@ -0,0 +1,116 @@ +# mcpp-zed + +mcpp-ide in [Zed](https://zed.dev): completion, hover and diagnostics of `mcpp.toml`, from the same +backend as VS Code, CLion and Neovim. Zed's id for it is `mcpp-ide-language-server`; it is listed as +**mcpp IDE**. + +## Install + +Zed's extensions page (command palette → **zed: extensions**): search for **mcpp IDE** and install +it, with Zed's **TOML** extension, which gives Zed the language `mcpp.toml` is written in. + +Until it is in Zed's registry, install it from a checkout: command palette → **zed: install dev +extension** → `mide-plugins/zed`. Zed compiles it, so Rust has to be installed through rustup. + +## The backend + +The backend is the one of the extension's own series, from the first of these: + +1. the command `lsp.mcpp-ide.binary` names in Zed's settings. Zed starts it with the `arguments` + given there and nothing else, so they include `serve`. It is started as it is: name a backend of + the extension's series, since nothing checks that one's series: + + ```json + { "lsp": { "mcpp-ide": { "binary": { "path": "/path/to/mcpp-ide", "arguments": ["serve"] } } } } + ``` + +2. the release's bundle, `mcpp-ide-X.Y.0-openkal-bundle-all.tar.gz` of the tag `vX.Y.0`, which the + extension downloads once into the work directory Zed gives it (from GitHub, else from the GitCode + mirror `xlings-res/mcpp-ide`, once the release's files are mirrored there) and starts as this + system's runner and this architecture's image. + The bundle has them for Linux x86_64 and aarch64, macOS aarch64 and Windows x86_64. + +A `mcpp-ide` on PATH is not started. The extension cannot read the series a backend answers, so it +could not refuse a backend of another series as the other plugins do. To use the xlings package, +name it in `lsp.mcpp-ide.binary`. + +Zed starts the backend with a worktree's first TOML file, and only in a worktree it trusts. The +backend finds the worktree's mcpp projects itself and reads `mcpp.toml` and `build.mcpp` only, so +in a worktree without one it answers nothing. The first TOML file after an install downloads the +bundle, about 13 MB. + +## Settings + +The backend's settings ([spec/settings.json](../../spec/settings.json)) go under `lsp.mcpp-ide.settings` +and reach it when it starts: + +```json +{ "lsp": { "mcpp-ide": { "settings": { "mcpp.path": "/opt/mcpp/bin/mcpp", "mcpp.toml.diagnostics.unknownKey": "error" } } } } +``` + +## What it does, and what it does not yet + +| In Zed | | +|---|---| +| `mcpp.toml` | completion of sections, keys and values, of a dependency's features; hover; diagnostics, unknown keys and features included | +| `build.mcpp` | as C++, with mcppls: `"file_types": { "C++": ["mcpp"] }` in Zed's settings | +| C and C++ | mcppls's own extension, **C++ Modules Language Server** (`mcppls-language-server`) | +| build, run, test, debug, the views | not yet: Zed's tasks and its debug locator follow in pull requests of their own ([design record](../../.agents/docs/2026-11-21-editor-surfaces-and-feature-matrix.md), "Zed, tier B") | + +## Tests + +`cargo test` covers which backend is started and how: the settings, the series' release and its +mirror, each platform's runner and image, the errors and the initialization options. CI builds the +crate for `wasm32-wasip2` with the Rust Zed's registry uses (`ZED_RUST_VERSION` in +[versions.env](../../.github/versions.env)) and runs what the registry checks of the manifest and +the license (`.github/scripts/check-zed-extension.sh`). + +## Zed's extension registry + +[zed-industries/extensions](https://github.com/zed-industries/extensions) builds this directory at +the commit a pull request there names and publishes it under `mcpp-ide-language-server`. A tag +`zed-vX.Y.Z` here marks that commit; the GitHub release carries no file of its own, and the +extension downloads the backend of its series from `vX.Y.0`. + +What the registry requires ([prerequisites](https://zed.dev/docs/extensions/publishing/prerequisites), +[publishing guide](https://zed.dev/docs/extensions/publishing/publishing-guide), its CI): + +| Rule | Here | +|---|---| +| An id of lowercase letters, digits and `-`, without `zed` or `extension`; an extension that provides only a language server ends in `-language-server` or `-lsp`; an id never changes once published | `mcpp-ide-language-server` | +| An accepted license in the extension's own directory; the repository's root does not count | `LICENSE`, Apache-2.0 | +| The server is downloaded or found, not bundled; nothing is read or written outside the work directory | the release's bundle, downloaded into the work directory | +| `version` in its `extensions.toml` is `extension.toml`'s at that commit, and only rises | the series' statement (AGENTS.md §4) | +| It builds with the registry's Rust 1.90 for `wasm32-wasip2` | CI's Zed job | +| Tested by hand in Zed at the submitted commit; text in English | | + +The registry's [AI policy](https://github.com/zed-industries/extensions/blob/main/AI_POLICY.md) +admits no autonomous agent: a person opens the pull request, writes its description and answers its +review. A pull request adds or updates one extension, and one left three weeks without an answer to +a review is closed. + +A version reaches Zed in four steps: + +1. The release `vX.Y.0` of its series exists, and the commit is on `main`, tagged `zed-vX.Y.Z`. +2. It is installed as a dev extension in Zed at that commit and opened on an mcpp project: the + bundle is downloaded and `mcpp.toml` has its diagnostics. +3. From a fork of zed-industries/extensions under a personal account (not an organization): + + ```bash + git submodule add https://github.com/mcpp-community/mcpp-ide.git extensions/mcpp-ide-language-server + git -C extensions/mcpp-ide-language-server checkout zed-vX.Y.Z + ``` + + and in `extensions.toml`: + + ```toml + [mcpp-ide-language-server] + submodule = "extensions/mcpp-ide-language-server" + path = "mide-plugins/zed" + version = "X.Y.Z" + ``` + + then `pnpm sort-extensions`, which orders `extensions.toml` and `.gitmodules`. +4. The pull request, titled `Add mcpp-ide-language-server` (later `Update + mcpp-ide-language-server to X.Y.Z`), with the registry's checklist confirmed. An update moves the + submodule to the new tag and changes the version. diff --git a/mide-plugins/zed/extension.toml b/mide-plugins/zed/extension.toml new file mode 100644 index 0000000..f606b99 --- /dev/null +++ b/mide-plugins/zed/extension.toml @@ -0,0 +1,17 @@ +id = "mcpp-ide-language-server" +name = "mcpp IDE" +version = "1.7.0" +schema_version = 1 +description = "mcpp projects: completion, hover and diagnostics of mcpp.toml from mcpp-ide" +repository = "https://github.com/mcpp-community/mcpp-ide" +authors = ["mcpp-community"] + +[lib] +kind = "Rust" +version = "0.7.0" + +# The backend for mcpp.toml, on the TOML language (Zed's TOML extension); it reads mcpp.toml and +# build.mcpp only. C and C++ are mcppls's (its own Zed extension). +[language_servers.mcpp-ide] +name = "mcpp-ide" +languages = ["TOML"] diff --git a/mide-plugins/zed/src/lib.rs b/mide-plugins/zed/src/lib.rs new file mode 100644 index 0000000..58ce48c --- /dev/null +++ b/mide-plugins/zed/src/lib.rs @@ -0,0 +1,122 @@ +// mcpp-ide in Zed: the backend started as a language server for mcpp.toml. +// +// The extension decides nothing (AGENTS.md §2): the backend answers completion, hover and diagnostics +// of mcpp.toml over standard LSP to an editor named `zed`. What this crate does is find the backend of +// its own series (resolve.rs, which `cargo test` covers on the host) -- the command the user's +// settings name, else the release's bundle, downloaded once into the work directory Zed gives the +// extension -- and start it. Zed starts it with a worktree's first TOML file. It reads mcpp.toml and +// build.mcpp only and finds the projects of the worktree itself, so in a worktree without one it +// answers nothing; declining there instead would show "Failed to run mcpp-ide" in Zed's status bar +// of every TOML project, and would miss a project below the worktree's root. +mod resolve; + +use std::fs; + +use resolve::{choose, initialization_options, Arch, Launch, Platform, Source}; +use zed_extension_api::{self as zed, settings::LspSettings, LanguageServerId, LanguageServerInstallationStatus, Result}; + +const SERVER: &str = "mcpp-ide"; + +struct McppIde; + +impl McppIde { + fn downloaded_backend(&self, id: &LanguageServerId) -> Result { + let (os, arch) = zed::current_platform(); + let platform = match os { + zed::Os::Windows => Platform::Windows, + zed::Os::Mac => Platform::Mac, + zed::Os::Linux => Platform::Linux, + }; + let arch = match arch { + zed::Architecture::Aarch64 => Arch::Aarch64, + zed::Architecture::X8664 => Arch::X86_64, + _ => Arch::Other, + }; + let release = resolve::release(); + let bundle = resolve::bundle(&release, platform, arch)?; + let present = |path: &str| fs::metadata(path).is_ok_and(|m| m.is_file()); + let marker = resolve::marker(&release); + if !present(&marker) { + zed::set_language_server_installation_status(id, &LanguageServerInstallationStatus::Downloading); + let fetch = |url: &str| -> Result<()> { + // A directory an interrupted download left is not reused. + fs::remove_dir_all(&release.directory).ok(); + zed::download_file(url, &release.directory, zed::DownloadedFileType::GzipTar)?; + if platform != Platform::Windows { + zed::make_file_executable(&bundle.runner)?; + } + if !(present(&bundle.runner) && present(&bundle.image)) { + return Err(format!("the archive holds no {} and {}", bundle.runner, bundle.image)); + } + fs::write(&marker, release.tag.as_bytes()).map_err(|e| format!("{marker}: {e}")) + }; + let github = zed::github_release_by_tag_name(resolve::REPOSITORY, &release.tag).and_then(|found| { + let asset = found + .assets + .iter() + .find(|a| a.name == release.asset) + .ok_or_else(|| format!("the release has no {}", release.asset))?; + fetch(&asset.download_url) + }); + if let Err(from_github) = github { + if let Err(from_mirror) = fetch(&resolve::mirror_url(&release)) { + let message = resolve::download_failed(&release, &from_github, &from_mirror); + zed::set_language_server_installation_status(id, &LanguageServerInstallationStatus::Failed(message.clone())); + return Err(message); + } + } + // The backends of earlier series are not needed again. + if let Ok(entries) = fs::read_dir(".") { + for entry in entries.flatten() { + if let Some(name) = entry.file_name().to_str() { + if resolve::is_stale(name, &release.directory) { + fs::remove_dir_all(entry.path()).ok(); + } + } + } + } + } + zed::set_language_server_installation_status(id, &LanguageServerInstallationStatus::None); + // The backend runs in the worktree, not in the work directory, so it is given absolute paths. + let work = std::env::current_dir().map_err(|e| format!("the extension's work directory: {e}"))?; + let absolute = |relative: &str| work.join(relative).to_string_lossy().into_owned(); + Ok(Launch { command: absolute(&bundle.runner), args: vec![absolute(&bundle.image), "serve".to_string()] }) + } +} + +impl zed::Extension for McppIde { + fn new() -> Self { + Self + } + + fn language_server_command(&mut self, id: &LanguageServerId, worktree: &zed::Worktree) -> Result { + let mut env = worktree.shell_env(); + let binary = LspSettings::for_worktree(SERVER, worktree).ok().and_then(|s| s.binary); + if let Some(extra) = binary.as_ref().and_then(|b| b.env.clone()) { + env.extend(extra); + } + let setting = binary.and_then(|b| b.path.map(|path| (path, b.arguments))); + let Launch { command, args } = match choose(setting) { + Source::Command(launch) => launch, + Source::Release => self.downloaded_backend(id)?, + }; + // The backend finds mcpp itself (the project's pin, mcpp.path, PATH), so the worktree's + // environment is passed as it is. + Ok(zed::Command { command, args, env }) + } + + fn language_server_initialization_options( + &mut self, + _id: &LanguageServerId, + worktree: &zed::Worktree, + ) -> Result> { + let settings = LspSettings::for_worktree(SERVER, worktree).ok(); + let (user, values) = match settings { + Some(s) => (s.initialization_options, s.settings), + None => (None, None), + }; + Ok(Some(initialization_options(user, values))) + } +} + +zed::register_extension!(McppIde); diff --git a/mide-plugins/zed/src/resolve.rs b/mide-plugins/zed/src/resolve.rs new file mode 100644 index 0000000..78524d7 --- /dev/null +++ b/mide-plugins/zed/src/resolve.rs @@ -0,0 +1,252 @@ +// Which backend the extension starts, and how. This file names no Zed type, so `cargo test` runs it +// on the host as well as compiling it for wasm32-wasip2. + +/// The operating system Zed runs on; `lib.rs` maps Zed's enum onto it. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Platform { + Linux, + Mac, + Windows, +} + +/// The machine's architecture, as the bundle names its runners and images. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Arch { + X86_64, + Aarch64, + /// One the bundle has no image for (32-bit x86). + Other, +} + +/// What Zed is asked to run. +#[derive(Debug, PartialEq, Eq)] +pub struct Launch { + pub command: String, + pub args: Vec, +} + +/// This extension's version: its crate's, which .github/scripts/release-plan.sh holds to +/// extension.toml's and to the series. +pub const PLUGIN_VERSION: &str = env!("CARGO_PKG_VERSION"); + +/// The repository whose releases carry the backend. +pub const REPOSITORY: &str = "mcpp-community/mcpp-ide"; + +/// The GitCode mirror of the release's files, tried when GitHub cannot be reached. +pub const MIRROR: &str = "https://gitcode.com/xlings-res/mcpp-ide/releases/download"; + +/// Where the backend comes from: the command `lsp.mcpp-ide.binary.path` names in Zed's settings (Zed +/// itself starts that one with its `arguments` alone, and `serve` is the default only where the +/// extension is asked), else the backend of this extension's series, +/// which `lib.rs` downloads into the extension's work directory. A `mcpp-ide` on PATH is not +/// started: the extension cannot read the series a backend answers, so it could not refuse one of +/// another series as the other plugins do. +#[derive(Debug, PartialEq, Eq)] +pub enum Source { + Command(Launch), + Release, +} + +pub fn choose(setting: Option<(String, Option>)>) -> Source { + match setting { + Some((command, args)) => Source::Command(Launch { command, args: args.unwrap_or_else(|| vec!["serve".to_string()]) }), + None => Source::Release, + } +} + +/// `X.Y` of an `X.Y.Z`. +pub fn series(version: &str) -> &str { + match version.rmatch_indices('.').next() { + Some((at, _)) => &version[..at], + None => version, + } +} + +/// The release that carries this series' backend, `vX.Y.0`: the backend is always its series' X.Y.0. +#[derive(Debug, PartialEq, Eq)] +pub struct Release { + pub tag: String, + pub asset: String, + /// The directory of the work directory the archive is unpacked into. + pub directory: String, + /// The archive's own top directory. + pub top: String, +} + +pub fn release() -> Release { + let version = format!("{}.0", series(PLUGIN_VERSION)); + let top = format!("mcpp-ide-{version}-openkal-bundle-all"); + Release { + tag: format!("v{version}"), + asset: format!("{top}.tar.gz"), + directory: format!("mcpp-ide-{version}"), + top, + } +} + +/// The file written once a bundle is unpacked and checked; a directory without it is downloaded again +/// (an unpacking cut short can leave a runner that exists but is not whole). +pub fn marker(release: &Release) -> String { + format!("{}/.complete", release.directory) +} + +pub fn mirror_url(release: &Release) -> String { + format!("{MIRROR}/{}/{}", release.tag, release.asset) +} + +/// The bundle's backend for this machine, relative to the work directory: this system's runner, +/// `libexec/okrun/-/okrun`, starting the image of this architecture, +/// `lib//mcpp-ide.oke` (the bundle's mcpp-package.json, `launch`). The bundle has a runner for +/// linux-x86_64, linux-aarch64, macos-aarch64 and windows-x86_64. +#[derive(Debug, PartialEq, Eq)] +pub struct Bundle { + pub runner: String, + pub image: String, +} + +pub fn bundle(release: &Release, platform: Platform, arch: Arch) -> Result { + let (system, arch_name) = match (platform, arch) { + (Platform::Linux, Arch::X86_64) => ("linux-x86_64", "x86_64"), + (Platform::Linux, Arch::Aarch64) => ("linux-aarch64", "aarch64"), + (Platform::Mac, Arch::Aarch64) => ("macos-aarch64", "aarch64"), + (Platform::Windows, Arch::X86_64) => ("windows-x86_64", "x86_64"), + _ => return Err(unsupported(platform, arch)), + }; + let exe = if platform == Platform::Windows { ".exe" } else { "" }; + let root = format!("{}/{}", release.directory, release.top); + Ok(Bundle { + runner: format!("{root}/libexec/okrun/{system}/okrun{exe}"), + image: format!("{root}/lib/{arch_name}/mcpp-ide.oke"), + }) +} + +fn unsupported(platform: Platform, arch: Arch) -> String { + format!( + "mcpp-ide's release has no backend for {platform:?} {arch:?}: it has one for Linux x86_64 and aarch64, \ + macOS aarch64 and Windows x86_64. Name a backend you built in lsp.mcpp-ide.binary.path." + ) +} + +/// What the user is told when neither GitHub nor the mirror gave the bundle. +pub fn download_failed(release: &Release, github: &str, mirror: &str) -> String { + format!( + "mcpp-ide {} could not be downloaded ({}): from github.com/{REPOSITORY}: {github}; from {}: {mirror}. \ + Name a backend in lsp.mcpp-ide.binary.path (`xlings install mcpp-ide` installs one).", + release.tag, + release.asset, + mirror_url(release) + ) +} + +/// The initialization options the backend receives (src/server.cppm, `initialize`): this editor, the +/// worktree trusted (Zed starts a language server only in a worktree it trusts), and the user's +/// settings (`lsp.mcpp-ide.settings`) over the user's own initialization options. +pub fn initialization_options( + user: Option, + settings: Option, +) -> zed_extension_api::serde_json::Value { + use zed_extension_api::serde_json::{json, Value}; + let mut options = match user { + Some(Value::Object(map)) => Value::Object(map), + _ => json!({}), + }; + options["editor"] = json!("zed"); + options["trusted"] = json!(true); + if let Some(settings @ Value::Object(_)) = settings { + options["settings"] = settings; + } + options +} + +/// A work directory's entry that an earlier series left: a backend directory other than `keep`. +pub fn is_stale(entry: &str, keep: &str) -> bool { + entry.starts_with("mcpp-ide-") && entry != keep +} + +#[cfg(test)] +mod tests { + use super::*; + use zed_extension_api::serde_json::json; + + #[test] + fn the_constant_is_the_extensions_version() { + let manifest = include_str!("../extension.toml"); + let line = manifest.lines().find(|l| l.starts_with("version = ")).unwrap(); + assert_eq!(line, format!("version = \"{PLUGIN_VERSION}\"")); + } + + #[test] + fn the_settings_name_the_backend_else_the_release_is_started() { + assert_eq!( + choose(Some(("/opt/mcpp-ide/bin/mcpp-ide".into(), None))), + Source::Command(Launch { command: "/opt/mcpp-ide/bin/mcpp-ide".into(), args: vec!["serve".into()] }) + ); + assert_eq!( + choose(Some(("/b/okrun".into(), Some(vec!["/b/mcpp-ide.oke".into(), "serve".into()])))), + Source::Command(Launch { command: "/b/okrun".into(), args: vec!["/b/mcpp-ide.oke".into(), "serve".into()] }) + ); + assert_eq!(choose(None), Source::Release); + } + + #[test] + fn the_release_is_the_series_own() { + assert_eq!(series("1.6.2"), "1.6"); + let r = release(); + let v = format!("{}.0", series(PLUGIN_VERSION)); + assert_eq!(r.tag, format!("v{v}")); + assert_eq!(r.asset, format!("mcpp-ide-{v}-openkal-bundle-all.tar.gz")); + assert_eq!(r.directory, format!("mcpp-ide-{v}")); + assert_eq!(marker(&r), format!("mcpp-ide-{v}/.complete")); + assert_eq!(mirror_url(&r), format!("https://gitcode.com/xlings-res/mcpp-ide/releases/download/v{v}/mcpp-ide-{v}-openkal-bundle-all.tar.gz")); + } + + #[test] + fn each_platform_takes_its_runner_and_its_architectures_image() { + let r = release(); + let root = format!("{}/{}", r.directory, r.top); + let b = bundle(&r, Platform::Linux, Arch::X86_64).unwrap(); + assert_eq!(b.runner, format!("{root}/libexec/okrun/linux-x86_64/okrun")); + assert_eq!(b.image, format!("{root}/lib/x86_64/mcpp-ide.oke")); + let b = bundle(&r, Platform::Linux, Arch::Aarch64).unwrap(); + assert_eq!(b.runner, format!("{root}/libexec/okrun/linux-aarch64/okrun")); + assert_eq!(b.image, format!("{root}/lib/aarch64/mcpp-ide.oke")); + assert_eq!(bundle(&r, Platform::Mac, Arch::Aarch64).unwrap().runner, format!("{root}/libexec/okrun/macos-aarch64/okrun")); + assert_eq!(bundle(&r, Platform::Windows, Arch::X86_64).unwrap().runner, format!("{root}/libexec/okrun/windows-x86_64/okrun.exe")); + } + + #[test] + fn a_platform_without_a_backend_names_the_ones_there_are() { + for (platform, arch) in [(Platform::Mac, Arch::X86_64), (Platform::Windows, Arch::Aarch64), (Platform::Linux, Arch::Other)] { + let error = bundle(&release(), platform, arch).unwrap_err(); + assert!(error.contains("macOS aarch64"), "{error}"); + assert!(error.contains("lsp.mcpp-ide.binary.path"), "{error}"); + } + } + + #[test] + fn a_failed_download_names_both_places_and_the_remedy() { + let message = download_failed(&release(), "timed out", "404"); + assert!(message.contains("timed out") && message.contains("404")); + assert!(message.contains(&mirror_url(&release()))); + assert!(message.contains("xlings install mcpp-ide")); + } + + #[test] + fn the_options_name_zed_trust_and_the_settings() { + let options = initialization_options(Some(json!({ "locale": "zh-CN" })), Some(json!({ "mcpp.path": "/x/mcpp" }))); + assert_eq!(options["editor"], "zed"); + assert_eq!(options["trusted"], true); + assert_eq!(options["locale"], "zh-CN"); + assert_eq!(options["settings"]["mcpp.path"], "/x/mcpp"); + let bare = initialization_options(None, None); + assert_eq!(bare["editor"], "zed"); + assert!(bare.get("settings").is_none()); + } + + #[test] + fn only_another_series_backend_is_stale() { + assert!(is_stale("mcpp-ide-1.5.0", "mcpp-ide-1.6.0")); + assert!(!is_stale("mcpp-ide-1.6.0", "mcpp-ide-1.6.0")); + assert!(!is_stale("other", "mcpp-ide-1.6.0")); + } +} diff --git a/protocol/protocol.schema.json b/protocol/protocol.schema.json index 2ae2f27..f4e295c 100644 --- a/protocol/protocol.schema.json +++ b/protocol/protocol.schema.json @@ -19,7 +19,7 @@ "initializationOptions": { "type": "object", "properties": { - "editor": { "enum": ["vscode", "jetbrains", "nvim", "cli"], "description": "The adapter: mcpp-vscode, mcpp-clion (the IntelliJ platform's id), mcpp-nvim, or an agent" }, + "editor": { "enum": ["vscode", "jetbrains", "nvim", "zed", "cli"], "description": "The adapter: mcpp-vscode, mcpp-clion (the IntelliJ platform's id), mcpp-nvim, mcpp-zed, or an agent" }, "locale": { "type": "string", "description": "The editor's display language, `auto` resolved by the adapter" }, "trusted": { "type": "boolean" }, "settings": { "$ref": "#/$defs/settingValues" }, @@ -74,7 +74,7 @@ }, "mcpp-ide/commands/list": { "description": "The command table (spec/commands.json) for one editor, with titles in the session's language and each command's subcommand.", - "params": { "type": "object", "properties": { "editor": { "enum": ["vscode", "jetbrains", "nvim", "cli"] } } }, + "params": { "type": "object", "properties": { "editor": { "enum": ["vscode", "jetbrains", "nvim", "zed", "cli"] } } }, "result": { "type": "object", "required": ["commands"], "properties": { "commands": { "type": "array", "items": { "$ref": "#/$defs/command" } } } } }, "mcpp-ide/menu/quick": { diff --git a/src/server.cppm b/src/server.cppm index a4e9fb6..bdae88c 100644 --- a/src/server.cppm +++ b/src/server.cppm @@ -35,13 +35,13 @@ export namespace mcppide::server { using Json = nlohmann::json; -inline constexpr std::string_view kVersion = "1.6.0"; +inline constexpr std::string_view kVersion = "1.7.0"; // THE SERIES (mcpp design 2026-11-07, D15): `X.Y` of `X.Y.Z`, shared by the backend and every editor // plugin; components of one series work together. A plugin refuses a backend of another series, // naming both versions. The backend is always `X.Y.0`: the VS Code and CLion packages carry it, so a // change of the backend is a change of every package, and it begins a series (1.3.0). `Z` is an // editor plugin's own patch. -inline constexpr std::string_view kSeries = "1.6"; +inline constexpr std::string_view kSeries = "1.7"; static_assert(kVersion.starts_with(kSeries) && kVersion.size() == kSeries.size() + 2 && kVersion.ends_with(".0")); inline constexpr int kProtocol = 2;