fix: set buffer name when attaching

This commit is contained in:
əlemi 2024-09-06 19:40:52 +02:00
parent 6e817b3e6d
commit 4cfa7baa28
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -19,12 +19,11 @@ local function attach(name, buffer, content, nowait)
error("already attached to buffer " .. name) error("already attached to buffer " .. name)
end end
if buffer == nil then if buffer == nil then
buffer = vim.api.nvim_create_buf(true, true) buffer = vim.api.nvim_create_buf(true, false)
vim.api.nvim_set_option_value('fileformat', 'unix', { buf = buffer })
-- vim.api.nvim_buf_set_option(buffer, 'filetype', 'codemp') -- TODO get from codemp?
vim.api.nvim_buf_set_name(buffer, name)
vim.api.nvim_set_current_buf(buffer) vim.api.nvim_set_current_buf(buffer)
end end
vim.api.nvim_set_option_value('fileformat', 'unix', { buf = buffer })
vim.api.nvim_buf_set_name(buffer, name)
local controller = session.workspace:attach_buffer(name):await() local controller = session.workspace:attach_buffer(name):await()
if not nowait then if not nowait then
controller:poll():await() -- wait for current state to get synched controller:poll():await() -- wait for current state to get synched