diff options
-rw-r--r-- | lua/lvim/plugin-loader.lua | 2 | ||||
-rw-r--r-- | tests/specs/lsp_spec.lua | 13 | ||||
-rw-r--r-- | tests/specs/plugins_load_spec.lua | 2 | ||||
-rw-r--r-- | utils/ci/run_test.sh | 6 | ||||
-rw-r--r-- | utils/installer/config.example.lua | 134 | ||||
-rw-r--r-- | utils/installer/config_win.example.lua | 134 |
6 files changed, 149 insertions, 142 deletions
diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index 56021875..19ced1ad 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -46,7 +46,7 @@ function plugin_loader.init(opts) end vim.opt.runtimepath:append(lazy_install_dir) - -- vim.opt.runtimepath:append(join_paths(plugins_dir, "*")) + vim.opt.runtimepath:append(join_paths(plugins_dir, "*")) local lazy_cache = require "lazy.core.cache" lazy_cache.setup { diff --git a/tests/specs/lsp_spec.lua b/tests/specs/lsp_spec.lua index 01e5e1d3..8eacf3c3 100644 --- a/tests/specs/lsp_spec.lua +++ b/tests/specs/lsp_spec.lua @@ -20,7 +20,10 @@ a.describe("lsp workflow", function() assert.True(vim.tbl_isempty(errors)) end) - lvim.lsp.templates_dir = join_paths(get_cache_dir(), "artifacts") + lvim.lsp.on_config = function() + lvim.lsp.templates_dir = join_paths(get_cache_dir(), "artifacts") + end + require("lvim.core.builtins").setup("lsp", "lvim.lsp", lvim.lsp) a.it("should be able to delete ftplugin templates", function() if utils.is_directory(lvim.lsp.templates_dir) then @@ -39,11 +42,9 @@ a.describe("lsp workflow", function() assert.True(utils.is_directory(lvim.lsp.templates_dir)) end) - a.it("should not include blacklisted servers in the generated templates", function() - require("lvim.lsp").setup() - + a.it("should not include skipped_servers in the generated templates", function() for _, file in ipairs(vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1)) do - for _, server_name in ipairs(lvim.lsp.override) do + for _, server_name in ipairs(lvim.lsp.automatic_configuration.skipped_servers) do local setup_cmd = string.format([[require("lvim.lsp.manager").setup(%q)]], server_name) assert.False(helpers.file_contains(file, setup_cmd)) end @@ -51,8 +52,6 @@ a.describe("lsp workflow", function() end) a.it("should only include one server per generated template", function() - require("lvim.lsp").setup() - local allowed_dupes = { "tailwindcss" } for _, file in ipairs(vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1)) do local content = {} diff --git a/tests/specs/plugins_load_spec.lua b/tests/specs/plugins_load_spec.lua index 37294c2e..6332448b 100644 --- a/tests/specs/plugins_load_spec.lua +++ b/tests/specs/plugins_load_spec.lua @@ -24,7 +24,7 @@ a.describe("plugin-loader", function() end) a.it("should be able to load lsp packages without errors", function() - require("lvim.lsp").setup() + require("lvim.core.builtins").setup("lsp", "lvim.lsp", lvim.lsp) local lsp_packages = { "lspconfig", diff --git a/utils/ci/run_test.sh b/utils/ci/run_test.sh index 3e1bcf1b..620dfb6f 100644 --- a/utils/ci/run_test.sh +++ b/utils/ci/run_test.sh @@ -15,11 +15,11 @@ export LUNARVIM_CONFIG_DIR LUNARVIM_CACHE_DIR printf "cache_dir: %s\nconfig_dir: %s\n" "$LUNARVIM_CACHE_DIR" "$LUNARVIM_CONFIG_DIR" lvim() { - nvim -u "$LUNARVIM_BASE_DIR/tests/minimal_init.lua" --cmd "set runtimepath+=$LUNARVIM_BASE_DIR" "$@" + nvim -u "$LUNARVIM_BASE_DIR/tests/minimal_init.lua" --cmd "set runtimepath+=$LUNARVIM_RUNTIME_DIR/site/pack/lazy/opt/*" "$@" } if [ -n "$1" ]; then - lvim --headless -c "lua require('plenary.busted').run('$1')" + lvim --headless -c "lua require('plenary.busted').run('$1')" else - lvim --headless -c "PlenaryBustedDirectory tests/specs { minimal_init = './tests/minimal_init.lua' }" + lvim --headless -c "lua require('plenary')" -c "PlenaryBustedDirectory tests/specs { minimal_init = './tests/minimal_init.lua' }" fi diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index a9a5086b..657b1fba 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -33,76 +33,80 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>" -- -- Change theme settings -- lvim.colorscheme = "lunar" -lvim.builtin.alpha.active = true -lvim.builtin.alpha.mode = "dashboard" -lvim.builtin.terminal.active = true -lvim.builtin.nvimtree.opts.view.side = "left" -lvim.builtin.nvimtree.opts.renderer.icons.show.git = false - --- Automatically install missing parsers when entering buffer -lvim.builtin.treesitter.auto_install = true - --- lvim.builtin.treesitter.ignore_install = { "haskell" } +lvim.builtin.alpha.on_config = function() + lvim.builtin.alpha.opts.active = true + lvim.builtin.alpha.opts.mode = "dashboard" +end + +lvim.builtin.nvimtree.on_config = function() + lvim.builtin.nvimtree.opts.view.side = "left" + lvim.builtin.nvimtree.opts.renderer.icons.show.git = false +end + +-- lvim.builtin.treesitter.on_config = function() +-- lvim.builtin.treesitter.ignore_install = { "haskell" } +-- end -- -- generic LSP settings <https://www.lunarvim.org/docs/languages#lsp-support> - --- --- disable automatic installation of servers --- lvim.lsp.installer.setup.automatic_installation = false - --- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect --- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` --- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) --- local opts = {} -- check the lspconfig documentation for a list of all possible options --- require("lvim.lsp.manager").setup("pyright", opts) - --- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect --- ---`:LvimInfo` lists which server(s) are skipped for the current filetype --- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) --- return server ~= "emmet_ls" --- end, lvim.lsp.automatic_configuration.skipped_servers) - --- -- you can set a custom on_attach function that will be used for all the language servers --- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion> --- lvim.lsp.on_attach_callback = function(client, bufnr) --- local function buf_set_option(...) --- vim.api.nvim_buf_set_option(bufnr, ...) +-- lvim.lsp.on_config = function() +-- --- disable automatic installation of servers +-- lvim.lsp.installer.setup.automatic_installation = false + +-- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect +-- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` +-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) +-- local opts = {} -- check the lspconfig documentation for a list of all possible options +-- require("lvim.lsp.manager").setup("pyright", opts) + +-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect +-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype +-- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) +-- return server ~= "emmet_ls" +-- end, lvim.lsp.automatic_configuration.skipped_servers) + +-- -- you can set a custom on_attach function that will be used for all the language servers +-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion> +-- lvim.lsp.on_attach_callback = function(client, bufnr) +-- local function buf_set_option(...) +-- vim.api.nvim_buf_set_option(bufnr, ...) +-- end +-- --Enable completion triggered by <c-x><c-o> +-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- end --- --Enable completion triggered by <c-x><c-o> --- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") --- end --- -- linters and formatters <https://www.lunarvim.org/docs/languages#lintingformatting> --- local formatters = require "lvim.lsp.null-ls.formatters" --- formatters.setup { --- { command = "stylua" }, --- { --- command = "prettier", --- extra_args = { "--print-width", "100" }, --- filetypes = { "typescript", "typescriptreact" }, --- }, --- } --- local linters = require "lvim.lsp.null-ls.linters" --- linters.setup { --- { command = "flake8", filetypes = { "python" } }, --- { --- command = "shellcheck", --- args = { "--severity", "warning" }, --- }, --- } - --- -- Additional Plugins <https://www.lunarvim.org/docs/plugins#user-plugins> --- lvim.plugins = { +-- -- linters and formatters <https://www.lunarvim.org/docs/languages#lintingformatting> +-- local formatters = require "lvim.lsp.null-ls.formatters" +-- formatters.setup { +-- { command = "stylua" }, +-- { +-- command = "prettier", +-- extra_args = { "--print-width", "100" }, +-- filetypes = { "typescript", "typescriptreact" }, +-- }, +-- } +-- local linters = require "lvim.lsp.null-ls.linters" +-- linters.setup { +-- { command = "flake8", filetypes = { "python" } }, +-- { +-- command = "shellcheck", +-- args = { "--severity", "warning" }, +-- }, +-- } + +-- -- Additional Plugins <https://www.lunarvim.org/docs/plugins#user-plugins> +-- lvim.plugins = { -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", -- }, --- } - --- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html> --- vim.api.nvim_create_autocmd("FileType", { --- pattern = "zsh", --- callback = function() --- -- let treesitter use bash highlight for zsh files as well --- require("nvim-treesitter.highlight").attach(0, "bash") --- end, --- }) +-- } + +-- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html> +-- vim.api.nvim_create_autocmd("FileType", { +-- pattern = "zsh", +-- callback = function() +-- -- let treesitter use bash highlight for zsh files as well +-- require("nvim-treesitter.highlight").attach(0, "bash") +-- end, +-- }) +-- end diff --git a/utils/installer/config_win.example.lua b/utils/installer/config_win.example.lua index 18821d3e..d2a57ab7 100644 --- a/utils/installer/config_win.example.lua +++ b/utils/installer/config_win.example.lua @@ -55,76 +55,80 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>" -- -- Change theme settings -- lvim.colorscheme = "lunar" -lvim.builtin.alpha.active = true -lvim.builtin.alpha.mode = "dashboard" -lvim.builtin.terminal.active = true -lvim.builtin.nvimtree.opts.view.side = "left" -lvim.builtin.nvimtree.opts.renderer.icons.show.git = false - --- Automatically install missing parsers when entering buffer -lvim.builtin.treesitter.auto_install = true - --- lvim.builtin.treesitter.ignore_install = { "haskell" } +lvim.builtin.alpha.on_config = function() + lvim.builtin.alpha.opts.active = true + lvim.builtin.alpha.opts.mode = "dashboard" +end + +lvim.builtin.nvimtree.on_config = function() + lvim.builtin.nvimtree.opts.view.side = "left" + lvim.builtin.nvimtree.opts.renderer.icons.show.git = false +end + +-- lvim.builtin.treesitter.on_config = function() +-- lvim.builtin.treesitter.ignore_install = { "haskell" } +-- end -- -- generic LSP settings <https://www.lunarvim.org/docs/languages#lsp-support> - --- --- disable automatic installation of servers --- lvim.lsp.installer.setup.automatic_installation = false - --- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect --- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` --- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) --- local opts = {} -- check the lspconfig documentation for a list of all possible options --- require("lvim.lsp.manager").setup("pyright", opts) - --- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect --- ---`:LvimInfo` lists which server(s) are skipped for the current filetype --- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) --- return server ~= "emmet_ls" --- end, lvim.lsp.automatic_configuration.skipped_servers) - --- -- you can set a custom on_attach function that will be used for all the language servers --- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion> --- lvim.lsp.on_attach_callback = function(client, bufnr) --- local function buf_set_option(...) --- vim.api.nvim_buf_set_option(bufnr, ...) +-- lvim.lsp.on_config = function() +-- --- disable automatic installation of servers +-- lvim.lsp.installer.setup.automatic_installation = false + +-- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect +-- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` +-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) +-- local opts = {} -- check the lspconfig documentation for a list of all possible options +-- require("lvim.lsp.manager").setup("pyright", opts) + +-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect +-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype +-- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) +-- return server ~= "emmet_ls" +-- end, lvim.lsp.automatic_configuration.skipped_servers) + +-- -- you can set a custom on_attach function that will be used for all the language servers +-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion> +-- lvim.lsp.on_attach_callback = function(client, bufnr) +-- local function buf_set_option(...) +-- vim.api.nvim_buf_set_option(bufnr, ...) +-- end +-- --Enable completion triggered by <c-x><c-o> +-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- end --- --Enable completion triggered by <c-x><c-o> --- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") --- end --- -- linters and formatters <https://www.lunarvim.org/docs/languages#lintingformatting> --- local formatters = require "lvim.lsp.null-ls.formatters" --- formatters.setup { --- { command = "stylua" }, --- { --- command = "prettier", --- extra_args = { "--print-width", "100" }, --- filetypes = { "typescript", "typescriptreact" }, --- }, --- } --- local linters = require "lvim.lsp.null-ls.linters" --- linters.setup { --- { command = "flake8", filetypes = { "python" } }, --- { --- command = "shellcheck", --- args = { "--severity", "warning" }, --- }, --- } - --- -- Additional Plugins <https://www.lunarvim.org/docs/plugins#user-plugins> --- lvim.plugins = { +-- -- linters and formatters <https://www.lunarvim.org/docs/languages#lintingformatting> +-- local formatters = require "lvim.lsp.null-ls.formatters" +-- formatters.setup { +-- { command = "stylua" }, +-- { +-- command = "prettier", +-- extra_args = { "--print-width", "100" }, +-- filetypes = { "typescript", "typescriptreact" }, +-- }, +-- } +-- local linters = require "lvim.lsp.null-ls.linters" +-- linters.setup { +-- { command = "flake8", filetypes = { "python" } }, +-- { +-- command = "shellcheck", +-- args = { "--severity", "warning" }, +-- }, +-- } + +-- -- Additional Plugins <https://www.lunarvim.org/docs/plugins#user-plugins> +-- lvim.plugins = { -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", -- }, --- } - --- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html> --- vim.api.nvim_create_autocmd("FileType", { --- pattern = "zsh", --- callback = function() --- -- let treesitter use bash highlight for zsh files as well --- require("nvim-treesitter.highlight").attach(0, "bash") --- end, --- }) +-- } + +-- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html> +-- vim.api.nvim_create_autocmd("FileType", { +-- pattern = "zsh", +-- callback = function() +-- -- let treesitter use bash highlight for zsh files as well +-- require("nvim-treesitter.highlight").attach(0, "bash") +-- end, +-- }) +-- end |