Skip to content

Support list/non-executable for copilot_node_command #498

Description

@chancez

I'm using https://mise.jdx.dev/ to manage my node versions, and this results in situations where it uses a different node version in different projects. Sometimes this means when I change to a directory using an older node version, copilot LSP fails to start because the node version is too old. To fix this, I can specify copilot_node_command to use a specific node version so it's not changing the node used for copilot LSP. However in copilot.lua thecopilot_node_command setting only supports using a string, and it validates the string points to an executable. This causes me some trouble because I'd like to set copilot_node_command to something like mise exec node@lts -- node. This doesn't work because of the vim.fn.executable(M.node_command) check here

local cmd_output_table = vim.fn.executable(M.node_command) == 1 and vim.fn.systemlist(cmd, nil, 0) or { "" }
. As a work-around I've made a node-lts-wrapper.sh script in my $PATH that just calls mise exec node@lts -- node, but ideally I wouldn't need it.

Since there's already a check for the node version, could the logic to check that node_command is an executable be relaxed? Or could there be an option to specify a list, and then only the first arg to the list be validated to be executable? Thanks.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions