Skip to content
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

feat(channels): introduce v:parent #18561

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

justinmk
Copy link
Member

@justinmk justinmk commented May 13, 2022

followup to #11009

@@ -120,7 +119,30 @@ function vim._os_proc_children(ppid)
return children
end

-- TODO(ZyX-I): Create compatibility layer.
-- Initializes v:parent (from server.c).
function vim._server_init()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Experimenting with defining core logic in Lua instead of C.

Will need to think more about where this kind of code lives, as we accumulate more of it.

'nvim-child',
api['version'],
'remote', -- TODO: do we want a "child" or "nvim" client type?
vim.empty_dict(), -- TODO: Need api.functions dict (not list): https://github.com/neovim/neovim/pull/12040
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#12040 will help bring some consistency with the structure of api_info() and nvim_set_client_info which currently have some questionable incompatibilities.


it('creates v:parent channel from $NVIM', function()
local nrchans = #meths.list_chans()
exec_lua([[return vim.fn.jobstart({ vim.v.progpath }, vim.empty_dict())]])
Copy link
Member Author

@justinmk justinmk May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we had a convenience in the bridge where an empty {} was acceptable for a Dict param. Is it intentional / desired that vim.empty_dict() is required here? @bfredl

:lua lua =vim.fn.jobstart({ vim.v.progpath }, {})

E5108: Error executing lua Vim:E475: Invalid argument: expected dictionary
stack traceback:                                                                                                                     
        [C]: in function 'jobstart'
        [string ":lua"]:1: in main chunk

Explicitly closing the parent channel was an attempt to avoid noise in
the logs. But the channels should already be cleared by Nvim
event_teardown() and server_teardown() happens too late.

Need to find another way to avoid log noise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants