diff --git a/README.md b/README.md index 6e992d4..8209d15 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lua/blade-nav/health.lua b/lua/blade-nav/health.lua index d090fed..8bff743 100644 --- a/lua/blade-nav/health.lua +++ b/lua/blade-nav/health.lua @@ -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() diff --git a/lua/blade-nav/utils.lua b/lua/blade-nav/utils.lua index ca286b5..88105ce 100644 --- a/lua/blade-nav/utils.lua +++ b/lua/blade-nav/utils.lua @@ -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*]]