fix: conflict mapping with refresh and repomap (#740)

This commit is contained in:
Aaron Pham 2024-10-20 22:45:53 -04:00 committed by GitHub
parent bf366f1b73
commit bbfc315eed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 9 deletions

View File

@ -150,7 +150,7 @@ Respect and use existing conventions, libraries, etc that are already present in
debug = "<leader>ad", debug = "<leader>ad",
hint = "<leader>ah", hint = "<leader>ah",
suggestion = "<leader>as", suggestion = "<leader>as",
repomap = "<leader>ar", repomap = "<leader>aR",
}, },
sidebar = { sidebar = {
apply_all = "A", apply_all = "A",

View File

@ -38,12 +38,8 @@ function RepoMap.get_filetype(filepath)
-- https://github.com/neovim/neovim/issues/27265 -- https://github.com/neovim/neovim/issues/27265
if not filetype then if not filetype then
local ext = fn.fnamemodify(filepath, ":e") local ext = fn.fnamemodify(filepath, ":e")
if ext == "tsx" then if ext == "tsx" then filetype = "typescriptreact" end
filetype = "typescriptreact" if ext == "ts" then filetype = "typescript" end
end
if ext == "ts" then
filetype = "typescript"
end
end end
return filetype return filetype
end end
@ -60,8 +56,9 @@ function RepoMap._build_repo_map(project_root, file_ext)
return return
end end
local filetype = RepoMap.get_ts_lang(filepath) local filetype = RepoMap.get_ts_lang(filepath)
local definitions = filetype and local definitions = filetype
repo_map_lib.stringify_definitions(filetype, Utils.file.read_content(filepath) or "") or "" and repo_map_lib.stringify_definitions(filetype, Utils.file.read_content(filepath) or "")
or ""
if definitions == "" then return end if definitions == "" then return end
table.insert(output, { table.insert(output, {
path = Utils.relative_path(filepath), path = Utils.relative_path(filepath),