Skip to content

Improve handling of copilot_node_command - #552

Merged
AntoineGS merged 7 commits into
zbirenbaum:masterfrom
timhugh:timheuett/nodejs-commands
Aug 29, 2025
Merged

Improve handling of copilot_node_command#552
AntoineGS merged 7 commits into
zbirenbaum:masterfrom
timhugh:timheuett/nodejs-commands

Conversation

@timhugh

@timhugh timhugh commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

A little history:

  1. Support list/non-executable for copilot_node_command #498 identified that commands like "mise x node@lts -- node" could not be used for the copilot_node_command config because of excessive validation. This was resolved in Relax validation for copilot_node_command #527
  2. Naturally, this broke a different use case identified in Could not determine Node.js version #538 -- now paths to node including a space no longer worked due to the use of vim.split. This was resolved in Fixes regression where node_command contained spaces #541

Unfortunately, that fix undid the previous fix, so this PR aims to resolve both:

  1. I added tests for the get_execute_command and get_node_version functions of the nodejs module to prevent regression
  2. copilot_node_command can now be configured two ways:
    • as a string: copilot_node_command = "/path to/node"
    • as a table: copilot_node_command = { "mise", "x", "node@lts", "--", "node" }

@AntoineGS

Copy link
Copy Markdown
Collaborator

Very happy with this initiative, I agree tests will be quite beneficial seeing the back and forth on this issue too.

@timhugh
timhugh force-pushed the timheuett/nodejs-commands branch from ba8438e to b7365f3 Compare August 28, 2025 05:45
@timhugh
timhugh marked this pull request as ready for review August 28, 2025 05:52
@timhugh

timhugh commented Aug 28, 2025

Copy link
Copy Markdown
Contributor Author

Okay, great! I did some test cleanup.

I'm pretty new to mini.test and I suspect there might be a more idiomatic way to structure the tests (maybe using sets and stubbing in the pre/post hooks instead of the stub methods?), but at least this covers a lot of cases

@AntoineGS

Copy link
Copy Markdown
Collaborator

Looks good, but I have a ton of failing tests which I do not think were caused by this but something on the LSP-side.
I'll wait until I've figured that out before merging just to have less code movement while I figure that out.

@AntoineGS

Copy link
Copy Markdown
Collaborator

Ok the issue resolved itself, all green!

@AntoineGS
AntoineGS merged commit 46a97dc into zbirenbaum:master Aug 29, 2025
1 check passed
@timhugh
timhugh deleted the timheuett/nodejs-commands branch August 30, 2025 03:18
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.

2 participants