Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements asynchronous server downloading and startup functionality for the ECA server. The changes move from synchronous path finding to an asynchronous approach that uses a separate Neovim process to handle server path resolution and downloading.
- Replaces synchronous server path finding with asynchronous path resolution using a separate Neovim process
- Adds proper waiting mechanisms in tests to handle the asynchronous server startup
- Changes default server auto-start behavior to false and adds conditional startup logic
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_server_integration.lua | Adds vim.wait calls to handle asynchronous server startup in tests |
| scripts/server_path.lua | New script that handles server path finding in a separate Neovim process |
| lua/eca/server.lua | Refactors server startup to use async path resolution via external script |
| lua/eca/path_finder.lua | Updates path finder to support custom paths and improves error handling |
| lua/eca/init.lua | Makes server auto-start conditional based on configuration |
| lua/eca/config.lua | Changes default auto_start_server setting to false |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| local lua_cmd = string.format("lua ServerPath.run(%s)", Config.server_path or "") | ||
|
|
There was a problem hiding this comment.
The Config.server_path value is not properly quoted for shell execution. If the path contains spaces or special characters, this will cause command execution failures.
| local lua_cmd = string.format("lua ServerPath.run(%s)", Config.server_path or "") | |
| local function lua_quote(str) | |
| -- Escape backslashes and double quotes for Lua string literal | |
| return '"' .. tostring(str):gsub('\\', '\\\\'):gsub('"', '\\"') .. '"' | |
| end | |
| local lua_cmd = string.format("lua ServerPath.run(%s)", lua_quote(Config.server_path or "")) |
There was a problem hiding this comment.
This makes sense, I added this to utils.lua
|
|
||
| -- Make executable (if not Windows) | ||
| if not vim.loop.os_uname().sysname:lower():match("windows") then | ||
| if not uv.os_uname().sysname:lower():match("windows") then |
There was a problem hiding this comment.
Direct use of 'uv' global may not be available in all Neovim versions. Consider using 'vim.uv' or 'vim.loop' for better compatibility.
There was a problem hiding this comment.
uv is defined as local uv = vim.uv or vim.loop in the first line of the file
| _G.ServerPath = ServerPath | ||
|
|
There was a problem hiding this comment.
Setting globals in a script can lead to namespace pollution. Consider using a local approach or checking if the global already exists before setting it.
| _G.ServerPath = ServerPath |
There was a problem hiding this comment.
It was moved to a condition that consider the --headless execution of neovim, it should make sense now.
solves #21