Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(configs): fix disabled filenames/workspaces filter #35

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions lua/gentags/dispatcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,43 @@
if tbl.list_contains(cfg.disabled_filetypes, filetype) then
return false
end
if tbl.list_contains(cfg.disabled_filenames, filename) then

local normalized_filename =
path.normalize(filename, { expand = true, double_backslash = true })
if
not tbl.List
:copy(cfg.disabled_filenames)
:filter(function(f)
return path.normalize(f, { expand = true, double_backslash = true })
== normalized_filename

Check warning on line 101 in lua/gentags/dispatcher.lua

View check run for this annotation

Codecov / codecov/patch

lua/gentags/dispatcher.lua#L100-L101

Added lines #L100 - L101 were not covered by tests
end)
:empty()
then
return false
end

local filedir = nil
if str.not_empty(filename) then
filedir = path.parent(filename)
end

local workspace = utils.get_workspace(filedir)
if tbl.list_contains(cfg.disabled_workspaces, workspace) then

local normalized_workspace = str.not_empty(workspace)
and path.normalize(
workspace --[[@as string]],
{ expand = true, double_backslash = true }
)
or nil
if
not tbl.List
:copy(cfg.disabled_workspaces)
:filter(function(w)
return path.normalize(w, { expand = true, double_backslash = true })
== normalized_workspace

Check warning on line 126 in lua/gentags/dispatcher.lua

View check run for this annotation

Codecov / codecov/patch

lua/gentags/dispatcher.lua#L125-L126

Added lines #L125 - L126 were not covered by tests
end)
:empty()
then
return false
end

Expand Down
Loading