-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
introduce $NVIM, unset $NVIM_LISTEN_ADDRESS #11009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@justinmk Is there anything blocking this from being merged? I think we should move forward on the connection code quite soon, including the first remote TUI step, which is quite low-risk. (though a quite relative "soon", I will fix outstanding extmark bugs before focusing on this. But I think others might be interested in working on it). |
|
@justinmk why do not jut keep |
- Modify s:preventNestedNeovim() in Neovim configuration so that it checks both the $NVIM (planned) and $NVIM_LISTEN_ADDRESS (deprecated) for the address of a parent Neovim session, if any. See neovim/neovim#11009 for details.
- Some details around implementation of $NVIM environment variable in neovim/neovim#11009 are still not finalized. Wait for finalization before changing function.
- Some details around implementation of $NVIM environment variable in neovim/neovim#11009 are still not finalized. Wait for finalization before changing function.
- Some details around implementation of $NVIM environment variable in neovim/neovim#11009 are still not finalized. Wait for finalization before changing function.
|
@justinmk can you confirm that NVIM_LISTEN_ADDRESS will not be removed until NVIM is available (that is, that there won't be a point where functionality (2) - Expose the server address of the current Nvim - is lost)? |
Use $NVIM with Nvim 0.8+. Since neovim/neovim#11009 (Nvim 0.8+) the correct way to detect a "host" or "parent" Nvim is to check for $NVIM env var: this means node is a child of that process. The old $NVIM_LISTEN_ADDRESS env var had conflicting purposes as both a parameter ("set --listen to this address") and a descriptor ("the current process is a child of this address").
Use $NVIM with Nvim 0.8+. Since neovim/neovim#11009 (Nvim 0.8+) the correct way to detect a "host" or "parent" Nvim is to check for $NVIM env var: this means node is a child of that process. The old $NVIM_LISTEN_ADDRESS env var had conflicting purposes as both a parameter ("set --listen to this address") and a descriptor ("the current process is a child of this address").
Use $NVIM with Nvim 0.8+. Since neovim/neovim#11009 (Nvim 0.8+) Nvim does _not_ pass $NVIM_LISTEN_ADDRESS to child processes. The correct way to detect a "host" or "parent" Nvim is to check for $NVIM env var: this means the current process is a child of Nvim. The old $NVIM_LISTEN_ADDRESS env var had conflicting purposes as both a parameter ("the current process should _listen on_ this address") and a descriptor ("the current process is a _child of_ this address").
f9d8c8e to
86d12e0
Compare
PROBLEM
------------------------------------------------------------------------
$NVIM_LISTEN_ADDRESS has conflicting purposes as both a parameter ("the
current process should listen on this address") and a descriptor ("the
current process is a child of this address").
This contradiction means the presence of NVIM_LISTEN_ADDRESS is
ambiguous, so child Nvim always tries to listen on its _parent's_
socket. This is the cause of lots of "Failed to start server" spam in
our test/CI logs:
WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-4480-0
WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-2168-0
SOLUTION
------------------------------------------------------------------------
1. Set $NVIM to the parent v:servername, *only* in child processes.
- Now the correct way to detect a "parent" Nvim is to check for $NVIM.
2. Do NOT set $NVIM_LISTEN_ADDRESS in child processes.
3. On startup if $NVIM_LISTEN_ADDRESS exists, unset it immediately after
server init.
4. Open a channel to parent automatically, expose it as v:parent.
Fixes neovim#3118
Fixes neovim#6764
Fixes neovim#9336
Ref neovim#8247 (comment)
Ref neovim#8696
|
Merging this and will continue the remaining items in other PRs. (The freebsd failure looks unrelated and similar to other PRs).
Confirmed, $NVIM is available to all child processes of Nvim started by |
$NVIM_LISTEN_ADDRESShas two conflicting purposes:To fix that,
$NVIM_LISTEN_ADDRESSwas deprecated, and--listenwas introduced.The next step is to introduce
$NVIMwhich only exposes the address of the current Nvim. This gives:terminalchildren a way to communicate with the parent (again,$NVIM_LISTEN_ADDRESScannot be used for that because that conflicts with existing usages of it to set the server at startup).$NVIMinjobstart()and:terminaljobs$NVIM_LISTEN_ADDRESSafter startup, so that:terminaldoes not see it accidentally$NVIMinsystem()and shell (:!) jobs? feat(channels): introduce v:parent #18561open channel to parent automatically? Expose its channel-id asfeat(channels): introduce v:parent #18561v:parent, forrpcrequest(v:parent, ...)?This also fixes the "Failed to start server" spam that was in our test logs:
Fixes #3118
Fixes #6764
Fixes #9336
See also: