fix: check for clipboard path locally to avoid recursion (#330)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
cadee677ba
commit
46a621e9de
@ -241,6 +241,7 @@ We would like to express our heartfelt gratitude to the contributors of the foll
|
|||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| [git-conflict.nvim](https://github.com/akinsho/git-conflict.nvim) | No License | Diff comparison functionality | https://github.com/yetone/avante.nvim/blob/main/lua/avante/diff.lua |
|
| [git-conflict.nvim](https://github.com/akinsho/git-conflict.nvim) | No License | Diff comparison functionality | https://github.com/yetone/avante.nvim/blob/main/lua/avante/diff.lua |
|
||||||
| [ChatGPT.nvim](https://github.com/jackMort/ChatGPT.nvim) | Apache 2.0 License | Calculation of tokens count | https://github.com/yetone/avante.nvim/blob/main/lua/avante/utils/tokens.lua |
|
| [ChatGPT.nvim](https://github.com/jackMort/ChatGPT.nvim) | Apache 2.0 License | Calculation of tokens count | https://github.com/yetone/avante.nvim/blob/main/lua/avante/utils/tokens.lua |
|
||||||
|
| [img-clip.nvim](https://github.com/HakonHarnes/img-clip.nvim) | MIT License | Clipboard image support | https://github.com/yetone/avante.nvim/blob/main/lua/avante/clipboard/init.lua |
|
||||||
|
|
||||||
The high quality and ingenuity of these projects' source code have been immensely beneficial throughout our development process. We extend our sincere thanks and respect to the authors and contributors of these projects. It is the selfless dedication of the open-source community that drives projects like avante.nvim forward.
|
The high quality and ingenuity of these projects' source code have been immensely beneficial throughout our development process. We extend our sincere thanks and respect to the authors and contributors of these projects. It is the selfless dedication of the open-source community that drives projects like avante.nvim forward.
|
||||||
|
|
||||||
|
@ -15,11 +15,23 @@ local Config = require("avante.config")
|
|||||||
---@class avante.Clipboard: AvanteClipboard
|
---@class avante.Clipboard: AvanteClipboard
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.paste_directory = Path:new(Config.history.storage_path):joinpath("pasted_images")
|
---@type Path
|
||||||
|
local paste_directory = nil
|
||||||
|
|
||||||
|
---@return Path
|
||||||
|
local function get_paste_directory()
|
||||||
|
if paste_directory then
|
||||||
|
return paste_directory
|
||||||
|
end
|
||||||
|
paste_directory = Path:new(Config.history.storage_path):joinpath("pasted_images")
|
||||||
|
return paste_directory
|
||||||
|
end
|
||||||
|
|
||||||
M.setup = function()
|
M.setup = function()
|
||||||
if not M.paste_directory:exists() then
|
get_paste_directory()
|
||||||
M.paste_directory:mkdir({ parent = true })
|
|
||||||
|
if not paste_directory:exists() then
|
||||||
|
paste_directory:mkdir({ parent = true })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -30,10 +42,7 @@ return setmetatable(M, {
|
|||||||
local impl = require("avante.clipboard." .. os_mapping)
|
local impl = require("avante.clipboard." .. os_mapping)
|
||||||
if impl[k] ~= nil then
|
if impl[k] ~= nil then
|
||||||
return impl[k]
|
return impl[k]
|
||||||
elseif t[k] ~= nil then
|
|
||||||
return t[k]
|
|
||||||
else
|
|
||||||
error("Failed to find clipboard implementation for " .. os_mapping)
|
|
||||||
end
|
end
|
||||||
|
return t[k]
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user