fix: mkdir for new file (#1257)

This commit is contained in:
yetone 2025-02-12 22:02:12 +08:00 committed by GitHub
parent 4f0bf40a9d
commit 3a7277386f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -820,6 +820,8 @@ function Sidebar:apply(current_cursor)
api.nvim_set_current_win(self.code.winid) api.nvim_set_current_win(self.code.winid)
for filepath, snippets in pairs(selected_snippets_map) do for filepath, snippets in pairs(selected_snippets_map) do
local bufnr = Utils.get_or_create_buffer_with_filepath(filepath) local bufnr = Utils.get_or_create_buffer_with_filepath(filepath)
local path_ = PPath:new(filepath)
path_:parent():mkdir({ parents = true, exists_ok = true })
insert_conflict_contents(bufnr, snippets) insert_conflict_contents(bufnr, snippets)
local process = function(winid) local process = function(winid)
api.nvim_set_current_win(winid) api.nvim_set_current_win(winid)