Report the in-use language-server version in copilot-installed-version - #511
Open
stfl wants to merge 1 commit into
Open
Report the in-use language-server version in copilot-installed-version#511stfl wants to merge 1 commit into
stfl wants to merge 1 commit into
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
copilot-installed-versiononly read the package metadata undercopilot-install-dir, so it reported the version of a server installed viacopilot-install-server— even whencopilot-server-executablepoints somewhere else.Users who run a
copilot-language-serverprovided by their system package manager (Nix, Homebrew, distro package, …) therefore got a stale ornilversion. Two things break as a result:copilot-nes-modewarnsNES requires copilot-language-server >= 1.434.0, but <old> is installedeven though the server actually in use is new enough (or no install-dir copy exists at all).copilot--start-serveremits 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-versionruns the resolvedcopilot-server-executablewith--version, parses the semantic version, and caches it per executable path (cleared bycopilot-uninstall-server).package.jsonlogic moves verbatim tocopilot--install-dir-version.copilot-installed-versionnow returns the executable version, falling back to the install-dir metadata when the executable can't be queried, andnilwhen 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