zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.43k stars 65 forks source link

Feature Request: Healthcheck #232

Closed maverick1872 closed 7 months ago

maverick1872 commented 8 months ago

Problem

Spent some time diagnosing an issue today. Come to find out it was just due to an unsupported node version in a project that caused copilot.lua to fail to startup. This failure was not immediately recognizable unfortunately.

Desire

Introduction of some health checks that could be surfaced via :checkhealth Copilot to do some sane precondition checks to validate environment is healthy for Copilot's use.

MunifTanjim commented 8 months ago

Did you try :Copilot status?

maverick1872 commented 8 months ago

Unfortunately from what I can tell that's only useful in the situation where Copilot is successfully started. In this instance I have a project that's on Node 14.x and so when loading nvim it's the nvm node binary that is found first. Of course this is a version of node that's not supported. As such Copilot would not start at all. To resolve I had to explicitly tell copilot (thanks for callout in readme btw) via it's setup configuration to use my system node binary via the following:

require('copilot').setup {
  copilot_node_command = os.getenv 'SYSTEM_NODE_PATH',
}

The above scenario should be reproducible just by setting node version to something <18 and attempting to start Copilot I'd imagine.

MunifTanjim commented 7 months ago

Should be fixed with https://github.com/zbirenbaum/copilot.lua/commit/3665ed0f3ef3ad68673df7195789d134d0d1fdb0