From e79b6bf8aa2226785bc2db9561a4385ea595a2c9 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 6 Nov 2021 09:23:59 +0100 Subject: refactor: deprecate lvim.lang.FOO (#1913) Consolidate configuration styles for linters and formatters Fixes #1756 --- README.md | 2 +- lua/lvim/config/init.lua | 4 ++-- lua/lvim/lsp/null-ls/init.lua | 16 ---------------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index f9fff01b..469ebf7b 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ lvim.plugins = { ## Breaking changes -- `lvim.lang.FOO.lsp` is no longer supported after #1584. +- `lvim.lang.FOO` is no longer supported. Refer to for up-to-date instructions. ## Resources diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index 1dc83c1e..783fb2be 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -63,9 +63,9 @@ local function handle_deprecated_settings() ---lvim.lang.FOO.lsp for lang, entry in pairs(lvim.lang) do - local deprecated_config = entry["lsp"] or {} + local deprecated_config = entry.formatters or entry.linters or {} if not vim.tbl_isempty(deprecated_config) then - deprecation_notice(string.format("lvim.lang.%s.lsp", lang)) + deprecation_notice(string.format("lvim.lang.%s", lang)) end end end diff --git a/lua/lvim/lsp/null-ls/init.lua b/lua/lvim/lsp/null-ls/init.lua index ef4a1844..5e8c6b11 100644 --- a/lua/lvim/lsp/null-ls/init.lua +++ b/lua/lvim/lsp/null-ls/init.lua @@ -1,8 +1,6 @@ local M = {} local Log = require "lvim.core.log" -local formatters = require "lvim.lsp.null-ls.formatters" -local linters = require "lvim.lsp.null-ls.linters" function M:setup() local status_ok, null_ls = pcall(require, "null-ls") @@ -19,20 +17,6 @@ function M:setup() end require("lspconfig")["null-ls"].setup(lvim.lsp.null_ls.setup) - for filetype, config in pairs(lvim.lang) do - if not vim.tbl_isempty(config.formatters) then - vim.tbl_map(function(c) - c.filetypes = { filetype } - end, config.formatters) - formatters.setup(config.formatters) - end - if not vim.tbl_isempty(config.linters) then - vim.tbl_map(function(c) - c.filetypes = { filetype } - end, config.formatters) - linters.setup(config.linters) - end - end end return M -- cgit v1.2.3 From 32cabcde9f17c7f2b4f086cbf8bda08388c9e124 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 6 Nov 2021 09:24:05 +0100 Subject: fix: use the logger for the deprecation message --- lua/lvim/config/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index 783fb2be..c932c456 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -57,7 +57,7 @@ local function handle_deprecated_settings() setting ) vim.schedule(function() - vim.notify(msg, vim.log.levels.WARN) + Log:warn(msg) end) end -- cgit v1.2.3 From 4207e6764045efdf725d2c3befef9a8adc5322e1 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 6 Nov 2021 13:18:59 +0100 Subject: chore: sort supported providers alphabetically (#1916) --- lua/lvim/lsp/null-ls/formatters.lua | 1 + lua/lvim/lsp/null-ls/linters.lua | 2 +- utils/installer/config.example.lua | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lua/lvim/lsp/null-ls/formatters.lua b/lua/lvim/lsp/null-ls/formatters.lua index 87583abd..20939039 100644 --- a/lua/lvim/lsp/null-ls/formatters.lua +++ b/lua/lvim/lsp/null-ls/formatters.lua @@ -22,6 +22,7 @@ function M.list_available(filetype) end end + table.sort(formatters) return formatters end diff --git a/lua/lvim/lsp/null-ls/linters.lua b/lua/lvim/lsp/null-ls/linters.lua index 1069ac58..ced4bf34 100644 --- a/lua/lvim/lsp/null-ls/linters.lua +++ b/lua/lvim/lsp/null-ls/linters.lua @@ -21,7 +21,7 @@ function M.list_available(filetype) table.insert(linters, provider.name) end end - + table.sort(linters) return linters end diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 5f516f2f..8f124ad3 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -118,9 +118,13 @@ lvim.builtin.treesitter.highlight.enabled = true -- -- set a formatter, this will override the language server formatting capabilities (if it exists) -- local formatters = require "lvim.lsp.null-ls.formatters" -- formatters.setup { --- { exe = "black" }, +-- { exe = "black", filetypes = { "python" } }, +-- { exe = "isort", filetypes = { "python" } }, -- { -- exe = "prettier", +-- ---@usage arguments to pass to the formatter +-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` +-- args = { "--print-with", "100" }, -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. -- filetypes = { "typescript", "typescriptreact" }, -- }, @@ -129,11 +133,17 @@ lvim.builtin.treesitter.highlight.enabled = true -- -- set additional linters -- local linters = require "lvim.lsp.null-ls.linters" -- linters.setup { --- { exe = "black" }, +-- { exe = "flake8", filetypes = { "python" } }, -- { --- exe = "eslint_d", +-- exe = "shellcheck", +-- ---@usage arguments to pass to the formatter +-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` +-- args = { "--severity", "warning" }, +-- }, +-- { +-- exe = "codespell", -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. --- filetypes = { "javascript", "javascriptreact" }, +-- filetypes = { "javascript", "python" }, -- }, -- } -- cgit v1.2.3 From 1c38d7d10b29618588b6394e9681cfccd8b2a705 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Sat, 6 Nov 2021 14:19:35 -0400 Subject: chore: pin cmp packages --- lua/lvim/plugins.lua | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 0974d9b6..6531c04a 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -27,6 +27,12 @@ local commit = { dap = "dd778f65dc95323f781f291fb7c5bf3c17d057b1", dap_install = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", toggleterm = "5f9ba91157a25be5ee7395fbc11b1a8f25938365", + luasnip = "bab7cc2c32fba00776d2f2fc4704bed4eee2d082", + cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d", + cmp_buffer = "d1ca295ce584ec80763a6dc043080874b57ccffc", + cmp_nvim_lsp = "accbe6d97548d8d3471c04d512d36fa61d0e4be8", + cmp_path = "97661b00232a2fe145fe48e295875bc3299ed1f7", + cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21", } return { @@ -71,14 +77,6 @@ return { config = function() require("lvim.core.cmp").setup() end, - requires = { - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-nvim-lua", - }, run = function() -- cmp's config requires cmp to be installed to run the first time if not lvim.builtin.cmp then @@ -92,6 +90,30 @@ return { -- event = "InsertCharPre", -- disable = not lvim.builtin.compe.active, }, + { + "L3MON4D3/LuaSnip", + commit = commit.luasnip, + }, + { + "saadparwaiz1/cmp_luasnip", + commit = commit.cmp_luasnip, + }, + { + "hrsh7th/cmp-buffer", + commit = commit.cmp_buffer, + }, + { + "hrsh7th/cmp-nvim-lsp", + commit = commit.cmp_nvim_lsp, + }, + { + "hrsh7th/cmp-path", + commit = commit.cmp_path, + }, + { + "hrsh7th/cmp-nvim-lua", + commit = commit.cmp_nvim_lua, + }, -- Autopairs { @@ -125,8 +147,7 @@ return { "kyazdani42/nvim-tree.lua", -- event = "BufWinOpen", -- cmd = "NvimTreeToggle", - -- commit = commit.nvim_tree, - commit = "f92b7e7627c5a36f4af6814c408211539882c4f3", + commit = commit.nvim_tree, config = function() require("lvim.core.nvimtree").setup() end, -- cgit v1.2.3 From 22095542c29dcb71e2be32c77d9340dfc3e88bb2 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Sat, 6 Nov 2021 17:57:40 -0400 Subject: feat: darkplus lualine theme --- lua/lualine/themes/darkplus.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lua/lualine/themes/darkplus.lua diff --git a/lua/lualine/themes/darkplus.lua b/lua/lualine/themes/darkplus.lua new file mode 100644 index 00000000..8e710d1f --- /dev/null +++ b/lua/lualine/themes/darkplus.lua @@ -0,0 +1,31 @@ +local colors = { + blue = "#569cd6", + green = "#6a9955", + purple = "#c586c0", + red = "#d16969", + yellow = "#dcdcaa", + yellow_orange = "#d7ba7d", + orange = "#ce9178", + fg = "#b4b4b4", + bg = "#252525", + gray1 = "#252525", + gray2 = "#252525", + gray3 = "#252525", +} + +return { + normal = { + a = { fg = colors.fg, bg = colors.blue, gui = "bold" }, + b = { fg = colors.fg, bg = colors.bg }, + c = { fg = colors.fg, bg = colors.bg }, + }, + insert = { a = { fg = colors.fg, bg = colors.green, gui = "bold" } }, + visual = { a = { fg = colors.fg, bg = colors.purple, gui = "bold" } }, + command = { a = { fg = colors.fg, bg = colors.cyan, gui = "bold" } }, + replace = { a = { fg = colors.fg, bg = colors.red, gui = "bold" } }, + inactive = { + a = { fg = colors.gray1, bg = colors.bg, gui = "bold" }, + b = { fg = colors.gray1, bg = colors.bg }, + c = { fg = colors.gray1, bg = colors.bg }, + }, +} -- cgit v1.2.3 From 5e9b1c817f68d345f1933b13638b5766709a8b6d Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Sun, 7 Nov 2021 12:13:45 -0500 Subject: fix: dedupe linting messages --- lua/lvim/lsp/handlers.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index ffb7564a..59f15c1c 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -125,7 +125,18 @@ function M.show_line_diagnostics() table.sort(diagnostics, function(a, b) return a.severity < b.severity end) - for i, diagnostic in ipairs(diagnostics) do + + local hash = {} + local diagnostics_no_dupes = {} + for _, v in ipairs(diagnostics) do + if not hash[v["message"]] then + diagnostics_no_dupes[#diagnostics_no_dupes + 1] = v -- you could print here instead of saving to result table if you wanted + hash[v["message"]] = true + end + end + -- print(vim.inspect(diagnostics_no_dupes)) + + for i, diagnostic in ipairs(diagnostics_no_dupes) do local source = diagnostic.source diag_message = diagnostic.message:gsub("[\n\r]", " ") if source then -- cgit v1.2.3