2021-08-18 07:34:26 +02:00
|
|
|
local M = {}
|
2021-08-22 20:03:19 +02:00
|
|
|
|
2021-08-18 07:34:26 +02:00
|
|
|
function M.config()
|
|
|
|
lvim.builtin.project = {
|
|
|
|
---@usage set to false to disable project.nvim.
|
2021-08-22 08:35:50 +02:00
|
|
|
--- This is on by default since it's currently the expected behavior.
|
2021-08-18 07:34:26 +02:00
|
|
|
active = true,
|
|
|
|
|
2021-08-22 20:03:19 +02:00
|
|
|
on_config_done = nil,
|
|
|
|
|
2021-08-22 08:35:50 +02:00
|
|
|
---@usage set to true to disable setting the current-woriking directory
|
|
|
|
--- Manual mode doesn't automatically change your root directory, so you have
|
|
|
|
--- the option to manually do so using `:ProjectRoot` command.
|
2021-08-18 07:34:26 +02:00
|
|
|
manual_mode = false,
|
|
|
|
|
2021-08-22 08:35:50 +02:00
|
|
|
---@usage Methods of detecting the root directory
|
|
|
|
--- Allowed values: **"lsp"** uses the native neovim lsp
|
|
|
|
--- **"pattern"** uses vim-rooter like glob pattern matching. Here
|
|
|
|
--- order matters: if one is not detected, the other is used as fallback. You
|
|
|
|
--- can also delete or rearangne the detection methods.
|
2021-11-18 08:56:48 +01:00
|
|
|
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
|
|
|
|
detection_methods = { "pattern" },
|
2021-08-18 07:34:26 +02:00
|
|
|
|
2023-01-07 16:03:03 +01:00
|
|
|
-- All the patterns used to detect root dir, when **"pattern"** is in
|
|
|
|
-- detection_methods
|
2022-09-19 18:40:01 +02:00
|
|
|
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "pom.xml" },
|
2021-08-18 07:34:26 +02:00
|
|
|
|
2023-01-07 16:03:03 +01:00
|
|
|
-- Table of lsp clients to ignore by name
|
|
|
|
-- eg: { "efm", ... }
|
|
|
|
ignore_lsp = {},
|
|
|
|
|
|
|
|
-- Don't calculate root dir on specific directories
|
|
|
|
-- Ex: { "~/.cargo/*", ... }
|
|
|
|
exclude_dirs = {},
|
|
|
|
|
|
|
|
-- Show hidden files in telescope
|
2021-08-20 21:22:35 +02:00
|
|
|
show_hidden = false,
|
|
|
|
|
2023-01-07 16:03:03 +01:00
|
|
|
-- When set to false, you will get a message when project.nvim changes your
|
|
|
|
-- directory.
|
2021-08-18 07:34:26 +02:00
|
|
|
silent_chdir = true,
|
2021-08-22 08:35:50 +02:00
|
|
|
|
2023-01-07 16:03:03 +01:00
|
|
|
-- What scope to change the directory, valid options are
|
|
|
|
-- * global (default)
|
|
|
|
-- * tab
|
|
|
|
-- * win
|
|
|
|
scope_chdir = "global",
|
2021-08-22 08:35:50 +02:00
|
|
|
|
|
|
|
---@type string
|
|
|
|
---@usage path to store the project history for use in telescope
|
2021-09-13 11:28:15 +02:00
|
|
|
datapath = get_cache_dir(),
|
2021-08-18 07:34:26 +02:00
|
|
|
}
|
|
|
|
end
|
2021-08-22 20:03:19 +02:00
|
|
|
|
2021-08-18 07:34:26 +02:00
|
|
|
function M.setup()
|
2022-07-31 16:57:13 +02:00
|
|
|
local status_ok, project = pcall(require, "project_nvim")
|
|
|
|
if not status_ok then
|
|
|
|
return
|
|
|
|
end
|
2021-08-22 20:03:19 +02:00
|
|
|
|
|
|
|
project.setup(lvim.builtin.project)
|
|
|
|
if lvim.builtin.project.on_config_done then
|
|
|
|
lvim.builtin.project.on_config_done(project)
|
|
|
|
end
|
2021-08-18 07:34:26 +02:00
|
|
|
end
|
2021-08-22 20:03:19 +02:00
|
|
|
|
2021-08-18 07:34:26 +02:00
|
|
|
return M
|