feat(command): add model command to get/set the model #643
+278
−2
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.
Hi, currently it's not possible to get what is the current model in-use (which is quite opaque). This PR add new commands to get/set/select the model at runtime and view the available model(s).
For now, there is only one model available which is GPT-4.1 Copilot.
Catches up with what has been done in copilot.vim side github/copilot.vim#139 (comment)
Summary
Add a new
:Copilot modelcommand that allows users to view and switch between available Copilot completion models at runtime.Changes
modelsubcommand with the following actions:select- Interactive model picker usingvim.ui.select*list- Display all available completion modelsget- Show the currently active modelset <model-id>- Set a specific model by IDcopilot_modelis configured, it's validated against available models and a warning is shown if invalidcopilot/modelsrequest to fetch available models from the Copilot serverFor
selectif there is only one available model (mostly the case) and the current in-use does not match, it is automatically selected.Files Changed
lua/copilot/model.lualua/copilot/api/init.luaget_modelsAPI functionlua/copilot/client/config.lualua/copilot/client/utils.luaplugin/copilot.luamodelcommand with completions