import{_ as i,c as e,o as a,ae as n}from"./chunks/framework.l7bN90nj.js";const r=JSON.parse('{"title":"Extension","description":"","frontmatter":{},"headers":[],"relativePath":"zh/dev/extension.md","filePath":"zh/dev/extension.md"}'),t={name:"zh/dev/extension.md"};function l(p,s,d,o,h,c){return a(),e("div",null,[...s[0]||(s[0]=[n(`<h1 id="extension" tabindex="-1">Extension <a class="header-anchor" href="#extension" aria-label="Permalink to &quot;Extension&quot;">​</a></h1><p>本节汇总各编辑器插件的开发与发布流程。目前包含 VSCode / Neovim / Zed。</p><h2 id="vscode" tabindex="-1">VSCode <a class="header-anchor" href="#vscode" aria-label="Permalink to &quot;VSCode&quot;">​</a></h2><p>VSCode 插件使用 Node/PNPM/VSCE 链路。推荐在 pixi 的 <code>node</code> 环境下操作以获得一致的工具链版本。</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 准备环境（先安装 pixi）</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pixi</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> shell</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -e</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> node</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 安装依赖（基于 pnpm-lock）</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pixi</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install-vscode</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 打包扩展，产物位于 editors/vscode/*.vsix</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pixi</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build-vscode</span></span></code></pre></div><p>发布到 VSCode Marketplace（需要 <code>VSCE_PAT</code> 环境变量）：</p><div class="language-shell vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pixi</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> publish-vscode</span></span></code></pre></div><div class="tip custom-block github-alert"><p class="custom-block-title">TIP</p><p>若已编译 clice，本地调试时可在 VSCode 设置中填写 <code>clice.executable</code>，使扩展指向你的自定义构建。</p></div><p>开发与调试：</p><ol><li><code>pixi shell -e node</code></li><li>在 <code>editors/vscode</code> 下运行 <code>pnpm run watch</code>（增量构建）</li><li>VSCode 中使用 “Run Extension/Launch Extension” 调试配置，或执行 <code>code --extensionDevelopmentPath=$(pwd)/editors/vscode</code></li></ol><p>常用脚本（在 <code>pixi shell -e node</code> 下）：</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pnpm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> package</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 等价于 pixi run build-vscode</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pnpm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> publish</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 等价于 pixi run publish-vscode</span></span></code></pre></div><p>如果不使用 pixi，请自行准备 node.js &gt;= 20、pnpm，然后在 <code>editors/vscode</code> 目录执行：</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pnpm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pnpm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> package</span></span></code></pre></div><h2 id="neovim" tabindex="-1">Neovim <a class="header-anchor" href="#neovim" aria-label="Permalink to &quot;Neovim&quot;">​</a></h2><p>Neovim 插件位于 <code>editors/nvim</code>，使用 Lua 编写。目前功能仍在演进中。</p><ul><li>将仓库路径加入 <code>runtimepath</code>，例如：<code>set rtp+=/path/to/clice/editors/nvim</code></li><li>或在本地创建软链接：<code>~/.config/nvim/pack/clice/start/clice</code> -&gt; <code>&lt;repo&gt;/editors/nvim</code></li><li>需要 <code>clice</code> 可执行文件可在 <code>$PATH</code> 中被找到</li></ul><p>开发提示：代码量较小，可直接在 Neovim 中加载并通过 <code>:messages</code>/LSP 日志观察效果；格式化可使用 <code>stylua</code>（仓库中已提供 <code>stylua.toml</code>）。</p><h2 id="zed" tabindex="-1">Zed <a class="header-anchor" href="#zed" aria-label="Permalink to &quot;Zed&quot;">​</a></h2><p>Zed 插件位于 <code>editors/zed</code>，使用 Rust 和 <code>zed_extension_api</code>。</p><p>建议的本地验证流程：</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> editors/zed</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cargo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --release</span></span></code></pre></div><p>随后按 Zed 官方指南加载本地扩展（需安装 Zed CLI），在启动前确保 <code>clice</code> 已在 PATH 中。发布时同样遵循 Zed 扩展发布流程。</p>`,23)])])}const F=i(t,[["render",l]]);export{r as __pageData,F as default};
