Skip to content

Commit

Permalink
fix: ignore node_modules in searching translation file (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabekou29 authored Dec 21, 2024
1 parent 18bb7d8 commit c1ffe81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/js-i18n/reference_table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function ReferenceTable:load_all()
end
return entry:match("%.jsx?$") or entry:match("%.tsx?$")
end,
respect_gitignore = true,
on_insert = function(path)
self:load_path(path)
end,
Expand Down
9 changes: 8 additions & 1 deletion lua/js-i18n/translation_source.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ function M.get_translation_files(dir)
local regexps = get_translation_source_regex()

scan.scan_dir(dir, {
search_pattern = "%.json$",
search_pattern = function(entry)
if entry:match("node_modules") then
return false
end
return entry:match("%.json$")
end,
respect_gitignore = true,
on_insert = function(path)
for _, regexp in ipairs(regexps) do
local match_s = regexp:match_str(path)
Expand All @@ -39,6 +45,7 @@ function M.get_translation_files(dir)
end
end,
})

return result
end

Expand Down

0 comments on commit c1ffe81

Please sign in to comment.