mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 10:35:08 +02:00
[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
This commit is contained in:
parent
9b36872d88
commit
ae1dea8b64
4 changed files with 34 additions and 1 deletions
2
init.lua
2
init.lua
|
@ -58,7 +58,7 @@ require("lsp").config()
|
|||
local null_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if null_status_ok then
|
||||
null_ls.config {}
|
||||
require("lspconfig")["null-ls"].setup {}
|
||||
require("lspconfig")["null-ls"].setup(lvim.lsp.null_ls.setup)
|
||||
end
|
||||
|
||||
local lsp_settings_status_ok, lsp_settings = pcall(require, "nlspsettings")
|
||||
|
|
|
@ -104,6 +104,9 @@ lvim = {
|
|||
on_init_callback = nil,
|
||||
---@usage query the project directory from the language server and use it to set the CWD
|
||||
smart_cwd = true,
|
||||
null_ls = {
|
||||
setup = {},
|
||||
},
|
||||
},
|
||||
|
||||
plugins = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue