Skip to content

Commit

Permalink
Merge pull request #33 from rizkyilhampra/main
Browse files Browse the repository at this point in the history
feat(config): add include_routes option to control completion scope
  • Loading branch information
RicardoRamirezR authored Nov 22, 2024
2 parents 3db8376 + 19bfb5c commit 5229189
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ vim.g.blade_nav = {
}
```

If you want to disable routes completion, you can set the `include_routes` option to `false`.

```lua
vim.g.blade_nav = {
include_routes = false
}
```

See `:h VIMINIT`

## Customization with nvim-cmp
Expand Down
7 changes: 7 additions & 0 deletions lua/blade-nav/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ local function check_setup()
.. '"'
)
end

if vim.g.blade_nav and vim.g.blade_nav.include_routes then
if type(vim.g.blade_nav.include_routes) ~= "boolean" then
warn("Include routes should be boolean")
end
ok("Include routes: " .. (vim.g.blade_nav.include_routes and "true" or "false"))
end
end

M.check = function()
Expand Down
7 changes: 7 additions & 0 deletions lua/blade-nav/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ M.get_keyword_pattern = function()
"View::make",
"Route::view",
}

if vim.g.blade_nav and not vim.g.blade_nav.include_routes then
functions_keywords = vim.tbl_filter(function(keyword)
return not M.in_table(keyword, { "route", "to_route" })
end, functions_keywords)
end

local functions_pattern = [[\(]] .. table.concat(functions_keywords, "\\|") .. [[\)\(('\)*\w*]]
local components_pattern = [[\(]] .. table.concat(components_keywords, "\\|") .. [[\)\w*]]

Expand Down

0 comments on commit 5229189

Please sign in to comment.