Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>xnes — Next Edit SuggestionsNew to Visual Studio Code? Get it now.
xnes — Next Edit Suggestions

xnes — Next Edit Suggestions

ali50m

|
10 installs
| (0) | Free
Next edit suggestions powered by your own OpenAI-compatible endpoint.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

xnes

Next Edit Suggestions for VS Code, powered by any OpenAI-compatible /chat/completions endpoint.

This extension uses the proposed inlineCompletionsAdditions API. Marketplace may reject proposed-API extensions; Open VSX and supported VS Code hosts can still use the VSIX.

Requires VS Code 1.128 or newer. The full feature set is validated on VS Code 1.143.1; Cursor 3.25.6 (VS Code 1.128.0) can run the basic inline-edit path with reduced lifecycle features.

Features

  • Cursor-local next edit suggestions rendered as VS Code inline edits or ghost text.
  • Streaming <EDIT> / <INSERT> / <NO_CHANGE> protocol with truncation protection.
  • Response hardening: preserves blank lines, strips echoed prompt markers, aligns whole-file replies to the edit window, and does not delete trailing lines the model omitted.
  • Blank-line tolerance: restores leading blank lines a model trims and keeps trailing ones, so an otherwise correct edit is not discarded as an omission.
  • Response alignment checks several consecutive lines before trimming a prefix. Models often echo from an earlier line such as a JSON [; matching only the first line used to discard an otherwise correct edit.
  • Predictions away from the cursor are rendered where they belong: showRange is widened to cover the cursor, so a change a few lines below is visible without moving there first.
  • Thinking switch (xnes.model.disableThinking): sends enable_thinking: false for hybrid-reasoning models. On measured endpoints this drops "time to complete a suggestion" from ~5s to ~0.5s; the flag is dropped automatically if the endpoint rejects it.
  • Assistant prefill (xnes.model.prefill, off by default): continues the assistant turn after a fixed prefix, so the reply must open with a protocol tag instead of prose. prefix for DeepSeek, partial for Qwen/Bailian.
  • Continuous-tab cache: after accepting one edit, subsequent edits are served from the same model response without another request, even after small unrelated edits in between.
  • Automatic continuation protects the last accepted edit from being rewritten again. Typing, undo, rejection, navigation and model changes stop pending jumps or speculative requests; safe cached edits remain available after small unrelated changes.
  • File-switch trigger: switching files shortly after accepting a suggestion asks for a new one; ordinary file switches do not.
  • Adaptive end-of-line debounce for slower typing (xnes.debounce.adaptive).
  • Partial accept continues the cached sequence for inserts and replacements when the resulting document state matches; ambiguous states are discarded.
  • XNES: 试运行 runs the production pipeline and logs the result without showing a suggestion or modifying the document.
  • Experimental searchReplace response format (xnes.model.responseFormat): the SEARCH fragment must occur once in the edit window, and truncated streams are discarded.
  • Experimental codeBlock response format: a fenced window that reuses the streaming diff and truncation protection.
  • Experimental next-cursor jump (xnes.experimental.nextCursorJump): after accepting an edit, move the cursor to the next edit predicted in the same response. Off by default.
  • Experimental speculative prefetch (xnes.experimental.prefetchAfterAccept): after accepting an edit, warm the cache for the next position in the background when no follow-up edit is cached. Off by default and consumes extra API quota.
  • Experimental cross-file prefetch (xnes.experimental.crossFilePrefetch): after accepting an edit, pre-warm a suggestion for the most recently edited other open file (up to crossFilePrefetchMax). When you switch there, the cached suggestion is labeled with its origin through the proposed displayLocation API; a transient status-bar hint links to the target file. Off by default.
  • Per-endpoint API keys in SecretStorage; endpoints and model names in globalState.
  • Parameter fallbacks are persisted per endpoint, and diagnostics reports p50/p90 latency from a rolling sample buffer.
  • Webview settings panel with model discovery, a production-pipeline speed test, and advanced thinking / output-token / temperature / edit-window / debounce / response-format / recent-file / next-cursor / prefetch / cross-file controls. The panel separates editing an endpoint from making it active, keeps drafts and caret position across updates, shows inline validation, and groups advanced options into collapsible sections.
  • Status bar uses one icon; hover to see the full active model, session shown/accepted counts, acceptance rate and current state. Clicking it opens settings, model selection, per-workspace / global enable toggles, logs and diagnostics.
  • Speed test covers five cases and reports separate cold/warm medians.
  • Privacy filters: workspace trust, .env/keys/lockfiles, size limits, binary files.
  • Recent-file context from other edited files, bounded by token and file caps.
  • Proxy support through VS Code http.proxy / http.proxyStrictSSL and http.noProxy, falling back to HTTP(S)_PROXY / NO_PROXY.
  • Request cancellation, deduplication, minimum interval and per-minute rate limits. Debounce cancellations and waiting do not consume engine-start slots; attempts cancelled after the engine starts still count. Request IDs link model, cache, display and acceptance events; outcome codes explain missing suggestions.

Install

Store installs (VS Code Marketplace, Open VSX, Cursor) work out of the box: settings, model selection, diagnostics, dry run and inline suggestions are registered. Because a store install is not listed in the host's product.json#extensionEnabledApiProposals, the host silently drops the extension's enabledApiProposals and the proposed inline-completion lifecycle is limited (no continuous-tab acceptance, cross-file labels or next-cursor jump, and classic ghost text cannot rewrite text before the cursor).

Run XNES: 启用完整内联建议(写入 argv.json) from the command palette to grant the proposal; the command patches argv.json and asks for a full restart. The same can be done manually:

  • VS Code: ~/.vscode/argv.json (Insiders: ~/.vscode-insiders/argv.json)
  • Cursor: ~/.cursor/argv.json
{
  "enable-proposed-api": ["ali50m.xnes"]
}

Then restart the editor and disable Copilot NES if both extensions are installed.

Install from a VSIX (local)

code --install-extension xnes-1.0.16.vsix

Cursor 3.25.6

Cursor 3.25.6 embeds VS Code 1.128.0. ~/.cursor/argv.json (on Windows: C:\Users\<user>\.cursor\argv.json) grants the proposal as shown above. Then restart Cursor and disable Cursor's own Tab/NES if both are active.

On 1.128, basic inline edits work, but the host does not provide handleEndOfLifetime, handleListEndOfLifetime, displayLocation or jumpToPosition. Continuous-tab acceptance, cross-file labels, next-cursor jump and accepted-count metrics are therefore degraded; the tooltip may show accepted counts as 0. VS Code 1.143+ keeps the full behavior.

Commands

Command Description
XNES: 打开设置 Endpoint, key, model, speed test
XNES: 选择模型 Model QuickPick / open settings
XNES: 立即请求建议 Explicit trigger
XNES: 试运行(不显示建议) Run the pipeline and log the result without changing the editor
XNES: 诊断 Proposed API, Copilot conflicts, proxy, metrics
XNES: 在此工作区启用/禁用 Per-workspace kill switch
XNES: 全局启用/禁用 Global xnes.enabled switch
XNES: 显示日志 Output channel
XNES: 启用完整内联建议(写入 argv.json) Grant the proposed API without editing argv.json by hand

Development

npm install
npm run check        # tsc --noEmit
npm test             # vitest unit tests
npm run build        # dist/extension.js + dist/webview
npm run test:integration        # extension development host, proposed API enabled
npm run test:integration:store  # same suite without --enable-proposed-api
npm run package

Integration tests download VS Code 1.143.1 into .vscode-test/ and run against a local mock OpenAI server. test:integration:store reproduces a store install by using a temporary copy with enabledApiProposals removed, matching the store-filtered runtime manifest. This prevents a grant in the developer's argv.json from accidentally enabling the full API during the test; the suite asserts that the lifecycle is limited. Keep both modes green: activation and every command must work in store mode.

Publishing

.github/workflows/publish.yml publishes the same VSIX to the VS Code Marketplace and Open VSX. It runs manually or on a v* tag, and expects the VSCE_PAT and OVSX_TOKEN repository secrets. See docs/publishing.md.

Offline evaluation

Use any OpenAI-compatible endpoint. The API key can come from XNES_API_KEY instead of the command line so it does not end up in shell history:

$env:XNES_BASE_URL = "https://api.example.com/v1"
$env:XNES_MODEL = "my-model"
$env:XNES_API_KEY = "sk-..."

node test/eval/run.mjs

Or keep the values in a local, gitignored file so a new shell or the agent can read them without exporting anything (see test/eval/env.example):

# test/eval/.env.local
XNES_BASE_URL=https://api.example.com/v1
XNES_MODEL=my-model
XNES_API_KEY=sk-...

The runner reads test/eval/.env.local by default; use --env-file <path> for another location. Command-line flags win over process environment, which wins over the file.

Or pass everything explicitly:

node test/eval/run.mjs --base-url https://api.example.com/v1 --api-key $env:KEY --model my-model --format unifiedXml

--format also accepts searchReplace and codeBlock. Single-file cases live in test/eval/cases/; results are written to test/eval/.results/latest.json.

Cross-file cases live in test/eval/cross-file-cases/. They seed history with a source-file edit, run the normal pipeline on a target file, and compare the result with a hand-written expected target:

node test/eval/run.mjs --cross-file --runs 3

--runs repeats each case to estimate a stable hit rate; each run is a real model request. Results are written to test/eval/.results/latest-cross-file.json. Add --cross-file-only to skip the single-file suite while tuning cross-file behavior. Use --case <name> to run one case.

Useful tuning flags (both modes):

node test/eval/run.mjs --cross-file-only --runs 5 --recent-files 5 --recent-tokens 2000 --temperature 0 --max-output-tokens 512

The runner reports strict exact and semantic matches. semantic ignores blank-line and trailing-whitespace differences, which distinguishes formatting drift from wrong code. latest.json and latest-cross-file.json also include the raw response and edit details for each attempt.

  • --recent-files / --recent-tokens change how much other-file context the prompt carries; for cross-file cases these are the main knobs.
  • --temperature defaults to 0 for reproducible evaluation.
  • --max-output-tokens defaults to 512.
  • --param "enable_thinking=false" injects provider-specific request fields (also via XNES_PARAM in the env file). This is how you turn off reasoning on hybrid models; --reasoning-effort is ignored by some gateways. --no-param cancels a value inherited from the env file.
  • --prefill "<" --prefill-mode prefix|partial enables assistant-turn prefill.

Measured on 2026-10-25 with SiliconFlow, unifiedXml, temperature 0, 16 rows (12 original single-file cases + two 85-line files + a two-step chained case):

Model Result
Qwen/Qwen3.6-35B-A3B + enable_thinking=false exact 100% (16/16) in 3/3 runs, format 100%, no-change 100%, destructive 0, TTFE 448–484 ms
Qwen/Qwen3-Coder-30B-A3B-Instruct exact 14/16 in 3/3 runs (misses long-file-rename-py and rename-import-ts)
DeepSeek-V4.1-Flash + enable_thinking=false exact 100% (12/12 on the original set), TTFE ~580 ms
GLM-5.3 / GLM-5.3-Flash / Kimi-K2.7-Code / Hy4-preview thinking cannot be disabled: TTFE 1.6–5.3 s, Hy4 also hits the 45 s timeout

Cases live in test/eval/cases/; a case directory may add step2/, step3/ … (cursor.json + expected.<ext>) for chained edits, where the harness applies the expected result of the previous step and records it in the edit history before asking again. Every fixture must be inferable: content the expected file introduces has to exist in the input, otherwise the case is ungradable — a unit test enforces this.

For a quick mock smoke test, point --base-url at any local SSE server that returns <NO_CHANGE> or a valid <EDIT>; the runner does not require a real provider.

The runner entry is test/eval/runner.ts; CLI/env parsing, fixtures, scoring, engine setup, and result writing live in separate modules, and the single-file and cross-file suites are under test/eval/suites/.

Live multi-file smoke test

With a real endpoint in test/eval/.env.local, run the extension inside a real VS Code test host:

npm run test:live

This opens copies of the repo's rename-export-ts cross-file fixture, renames the source export, runs the real cross-file prefetch, and verifies that the target suggestion is served from cache with the Cross-file next edit displayLocation label. It does not modify tracked files.

A rename on arbitrary src/ files is also possible, but the current model returned no suggestion for the applyEdits and CrossFileStore.remember experiments; use the manual checklist for those larger, intent-driven changes.

Real-file edit-chain test

With the real endpoint configured in test/eval/.env.local, run:

npm run test:chain -- "C:\path\to\Ads.template.jsonc"

This test expects the safety-door sequence on lines 369 and 373. It opens full-file temporary copies in VS Code 1.143.1, types the change, accepts the first suggestion through the editor, then verifies five successive jumps and acceptances on lines 373/377/381/385/389 (safety doors 12 through 16). Four scenarios cover the string separator, closing quote and character-by-character input. After the fifth follow-up it waits for the next prediction and verifies that another accept command leaves the next category unchanged. It also verifies unrelated lines and the original file hash remain unchanged. Results are saved to test/eval/.results/chain-latest.json. Each scenario makes real model requests.

Architecture

See dev.md (Chinese) for the full contract. The short version:

provider.ts (VS Code adapter)
  → requestCoordinator (policy, debounce, dedupe, cancel, rate limit, cache)
  → nextEditEngine (prompt → SSE → parser → streaming diff → filters)
  → vendor/vs (ported edit algebra for safe offset mapping)

Core modules under src/core/ never import vscode.

Privacy

The prompt contains only the cursor-local current-file excerpt, recent edit diffs, the surrounding code window with a relative path, and short excerpts around recent edits in up to five other files (set xnes.prompt.recentFilesMax to 0 to disable the last part). Only relative paths are sent; excluded files never enter history or the prompt. Endpoints, model names and keys cannot be changed from settings.json or a workspace's .vscode/settings.json; they are only written by the settings webview. Only the user/machine http.proxy value is honored; workspace proxy overrides are ignored. Prompt logging is off by default (xnes.log.includePrompt). Speculative prefetch is off by default; when enabled it sends the same bounded prompt after you accept a suggestion. With next-cursor jump also enabled, newly prefetched suggestions can be focused and displayed. Cross-file prefetch is also off by default and only targets files that already passed the history/privacy filters.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft