Problem:
- remote_ssh.sh detects ssh disconnect by writing a heartbeat every 1s,
which the local side buffers for the whole session.
- The server's stdout (e.g. `io.write()` from a random plugin) writes to
the tunnel, which in theory may contain a bogus "NVIM_READY".
- A nightly install is never updated on the remote.
Solution:
- Supervise the server in `vim.net._ssh.serve()` (Lua). It detects
disconnect via stdin EOF and discards server stdout. The script only
finds or installs `nvim`.
- Also a step toward Windows remotes.
- User may choose "Update Nvim" to reinstall the nightly.
Problem:
- vim.uri.parse() not fully baked, it does not structure some parts of its result (esp. `query`).
- The scheme is not lowercased, which violates the RFC.
- No "constructor" for vim.Uri.
- tostring(vim.Uri) is not fully driven by the vim.Uri fields.
Solution:
- Structure `authority`, `query`.
- Lowercase the scheme.
- Drop `_parse_ssh_uri()`.
- Add `vim.uri.new()`.
- Fix tostring(vim.Uri).
- Validation.
Problem:
Can't easily wait on the streamed output of a long-lived process (e.g.
`ssh -L`). remote-ssh used a private `run_wait()` util.
Solution:
Add `cond` to `SystemObj:wait()`: return early (process keeps running)
when `cond(stdout, stderr)` is true. Drop `run_wait()`.
- SshHost fields: follow ssh's "first wins" rule, so e.g. a later User
line in the same block no longer overrides an earlier one.
- Local server now exits on its own when the remote session ends.
- Before auto-install, try existing `nvim` found in remote `$PATH`.
- Combine the remote_ssh_x.sh scripts into one remote_ssh.sh script.
- Ignore `RemoteCommand` from ssh_config, which made ssh refuse our command.
- Don't accumulate the remote heartbeat in memory for the whole session:
`run_wait()` captures output only until it returns.
- Before detaching the UI, check that the remote Nvim answers through the
forward: sshd may refuse the forward, but still run the script.
- Stop the session (tunnel, remote Nvim) if any connect step fails, or if
the UI detached meanwhile.
- Run `ssh -G` once per session, instead of for every ssh command.
- Remote script handles signals at once, instead of after the heartbeat's
- Error if :restart is attempted.
FUTURE: Remote :restart prints a marker, with its [command], on
stdout. It also sends the TUI a restart event pointing at the LOCAL
server. The TUI reattaches there. Local server repeats the remote-ssh
connect steps, and sends the TUI a connect event for the new forwarded
socket. Then it runs [command] (e.g. session restore) on the new
remote over RPC.
Problem:
- :connect does not support ssh:// URLs.
- ssh:// support is "owned" by netrw in an ad-hoc fashion.
Solution:
- Implement ssh config parsing.
- Implement remote-ssh `:connect` support:
- Detect remote OS/architecture via uname.
- Bootstrap Nvim binary on remote (`~/.local/share/nvim-remote`).
- Start headless, "isolated" Nvim with `NVIM_APPNAME=nvim-remote`.
- Forward remote Unix socket via SSH -L tunnel.
- Use SSH ControlMaster multiplexing for connection reuse.
- Teardown: kill remote process + SSH mux, preserve data dir.
Signed-off-by: Szymon Wilczek <swilczek.lx@gmail.com>
Problem:
`parse_ssh_config()` compares tables against a freshly allocated empty
table.
- In `parse_multiple_values()`, the guard which avoids flushing an empty
accumulator never applies. Runs of separators and trailing whitespace
push empty strings into the results, and `is_valid()` does not filter
them. `Host alpha beta ` parses as `{ 'alpha', '', 'beta' }`.
- In `parse_value()`, the condition reduces to `chr == '"' and quoted`.
`quoted` starts false and only that branch sets it, so it can never
become true: quotes are never recognised and are inserted literally,
and the unterminated-quote check is unreachable.
Solution:
Compare `#val` instead. Add a test for repeated and trailing separators.
AI-assisted
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.
- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
"know" about the various magic symbols.
So they harm DX, which means they serve no purpose at all.
Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
`t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.