feat: claude text editor tool (#1631)
This commit is contained in:
@@ -916,6 +916,8 @@ function M.get_mentions()
|
||||
}
|
||||
end
|
||||
|
||||
---@param filepath string
|
||||
---@return integer|nil bufnr
|
||||
local function get_opened_buffer_by_filepath(filepath)
|
||||
local project_root = M.get_project_root()
|
||||
local absolute_path = M.join_paths(project_root, filepath)
|
||||
@@ -925,10 +927,16 @@ local function get_opened_buffer_by_filepath(filepath)
|
||||
return nil
|
||||
end
|
||||
|
||||
---@param filepath string
|
||||
---@return integer bufnr
|
||||
function M.get_or_create_buffer_with_filepath(filepath)
|
||||
-- Check if a buffer with this filepath already exists
|
||||
local existing_buf = get_opened_buffer_by_filepath(filepath)
|
||||
if existing_buf then return existing_buf end
|
||||
if existing_buf then
|
||||
-- goto this buffer
|
||||
api.nvim_set_current_buf(existing_buf)
|
||||
return existing_buf
|
||||
end
|
||||
|
||||
-- Create a new buffer without setting its name
|
||||
local buf = api.nvim_create_buf(true, false)
|
||||
|
||||
Reference in New Issue
Block a user