diff options
author | dklymenk <[email protected]> | 2021-08-16 16:31:03 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-16 15:31:03 +0200 |
commit | ae1dea8b6499afbc35d3386654f9d0d8d208d342 (patch) | |
tree | dcd8c9b603be157f95ecb339ccb8511965b77338 /utils/installer | |
parent | 9b36872d886c632ca93479321cde1e0f00629e3c (diff) |
[Feature] Expose null ls setup to user config (#1323)
* expose null_ls setup to user config
* add new config to example configs
* fix tabs with stylua
* change else statement in the example
Diffstat (limited to 'utils/installer')
-rw-r--r-- | utils/installer/config.example-no-ts.lua | 15 | ||||
-rw-r--r-- | utils/installer/config.example.lua | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/utils/installer/config.example-no-ts.lua b/utils/installer/config.example-no-ts.lua index b0de00f0..e5c24274 100644 --- a/utils/installer/config.example-no-ts.lua +++ b/utils/installer/config.example-no-ts.lua @@ -61,6 +61,21 @@ lvim.builtin.treesitter.highlight.enabled = true -- --Enable completion triggered by <c-x><c-o> -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- end +-- you can overwrite the null_ls setup table (useful for setting the root_dir function) +-- lvim.lsp.null_ls.setup = { +-- root_dir = require("lspconfig").util.root_pattern("Makefile", ".git", "node_modules"), +-- } +-- or if you need something more advanced +-- lvim.lsp.null_ls.setup.root_dir = function(fname) +-- if vim.bo.filetype == "javascript" then +-- return require("lspconfig/util").root_pattern("Makefile", ".git", "node_modules")(fname) +-- or require("lspconfig/util").path.dirname(fname) +-- elseif vim.bo.filetype == "php" then +-- return require("lspconfig/util").root_pattern("Makefile", ".git", "composer.json")(fname) or vim.fn.getcwd() +-- else +-- return require("lspconfig/util").root_pattern("Makefile", ".git")(fname) or require("lspconfig/util").path.dirname(fname) +-- end +-- end -- set a formatter if you want to override the default lsp one (if it exists) -- lvim.lang.python.formatters = { diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 1c39a571..2f8984bb 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -70,6 +70,21 @@ lvim.builtin.treesitter.highlight.enabled = true -- --Enable completion triggered by <c-x><c-o> -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- end +-- you can overwrite the null_ls setup table (useful for setting the root_dir function) +-- lvim.lsp.null_ls.setup = { +-- root_dir = require("lspconfig").util.root_pattern("Makefile", ".git", "node_modules"), +-- } +-- or if you need something more advanced +-- lvim.lsp.null_ls.setup.root_dir = function(fname) +-- if vim.bo.filetype == "javascript" then +-- return require("lspconfig/util").root_pattern("Makefile", ".git", "node_modules")(fname) +-- or require("lspconfig/util").path.dirname(fname) +-- elseif vim.bo.filetype == "php" then +-- return require("lspconfig/util").root_pattern("Makefile", ".git", "composer.json")(fname) or vim.fn.getcwd() +-- else +-- return require("lspconfig/util").root_pattern("Makefile", ".git")(fname) or require("lspconfig/util").path.dirname(fname) +-- end +-- end -- set a formatter if you want to override the default lsp one (if it exists) -- lvim.lang.python.formatters = { |