Skip to content

Report the in-use language-server version in copilot-installed-version - #511

Open
stfl wants to merge 1 commit into
copilot-emacs:mainfrom
stfl:fix-installed-version-respects-executable
Open

Report the in-use language-server version in copilot-installed-version#511
stfl wants to merge 1 commit into
copilot-emacs:mainfrom
stfl:fix-installed-version-respects-executable

Conversation

@stfl

@stfl stfl commented Jul 1, 2026

Copy link
Copy Markdown

Problem

copilot-installed-version only read the package metadata under copilot-install-dir, so it reported the version of a server installed via copilot-install-server — even when copilot-server-executable points somewhere else.

Users who run a copilot-language-server provided by their system package manager (Nix, Homebrew, distro package, …) therefore got a stale or nil version. Two things break as a result:

  • copilot-nes-mode warns NES requires copilot-language-server >= 1.434.0, but <old> is installed even though the server actually in use is new enough (or no install-dir copy exists at all).
  • copilot--start-server emits a misleading "tested for version X but Y detected" warning.

Both compare against a server that is not the one being launched.

Fix

Report the version of the server copilot.el will actually run:

  • copilot--executable-version runs the resolved copilot-server-executable with --version, parses the semantic version, and caches it per executable path (cleared by copilot-uninstall-server).
  • The previous package.json logic moves verbatim to copilot--install-dir-version.
  • copilot-installed-version now returns the executable version, falling back to the install-dir metadata when the executable can't be queried, and nil when neither is available.

This corrects both warnings for anyone whose server lives outside copilot-install-dir, while keeping the existing behavior when the bundled installer is used.

Testing

  • eask compile — clean (no new warnings)
  • eask test buttercup — 408 specs, 0 failed (adds coverage for the executable probe, its caching, and the fallback ordering)
  • eask lint checkdoc — no new findings

`copilot-installed-version' only read the package metadata under
`copilot-install-dir', so it reported the version of a server installed
via `copilot-install-server' even when `copilot-server-executable'
points elsewhere. Users who run a copilot-language-server provided by
their system package manager got a stale (or nil) version, which made
`copilot-nes-mode' warn that the server was too old for NES and made
`copilot--start-server' emit a misleading "tested for version X"
warning -- both comparing against a server that was not the one in use.

Query the resolved `copilot-server-executable' with `--version' first,
parsing the reported semantic version and caching it per executable
path (cleared on `copilot-uninstall-server'). Fall back to the
`copilot-install-dir' package metadata when the executable cannot be
queried. The package.json logic moves to `copilot--install-dir-version'.

Add Buttercup coverage for the executable probe, its caching, and the
fallback ordering, and note the fix in the changelog.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant