summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
commit977990584331307dd5e71ebbbbd6b45b9c961996 (patch)
treea8b3d78e80f586da192a576dd678e2fbc8ac8e00
parent99d00f47fe780dbb021149db2f93d202a2b8b025 (diff)
Updates to nvim lsp
-rw-r--r--.config/nvim/.stylua.toml6
-rw-r--r--.config/nvim/README.md4
-rw-r--r--.config/nvim/config.lua33
-rw-r--r--.config/nvim/lua/core/autocmds.lua4
-rw-r--r--.config/nvim/lua/core/compe.lua20
-rw-r--r--.config/nvim/lua/core/dashboard.lua40
-rw-r--r--.config/nvim/lua/core/galaxyline.lua24
-rw-r--r--.config/nvim/lua/core/info.lua46
-rw-r--r--.config/nvim/lua/core/log.lua6
-rw-r--r--.config/nvim/lua/core/nvimtree.lua10
-rw-r--r--.config/nvim/lua/core/telescope.lua3
-rw-r--r--.config/nvim/lua/core/terminal.lua6
-rw-r--r--.config/nvim/lua/core/which-key.lua15
-rw-r--r--.config/nvim/lua/default-config.lua550
-rw-r--r--.config/nvim/lua/extra/json_schemas.lua15
-rw-r--r--.config/nvim/lua/extra/octo.lua2
-rw-r--r--.config/nvim/lua/keymappings.lua32
-rw-r--r--.config/nvim/lua/lsp/handlers.lua86
-rw-r--r--.config/nvim/lua/lsp/init.lua28
-rw-r--r--.config/nvim/lua/lsp/null-ls.lua141
-rw-r--r--.config/nvim/lua/lsp/null-ls/formatters.lua77
-rw-r--r--.config/nvim/lua/lsp/null-ls/init.lua44
-rw-r--r--.config/nvim/lua/lsp/null-ls/linters.lua77
-rw-r--r--.config/nvim/lua/lsp/null-ls/services.lua55
-rw-r--r--.config/nvim/lua/lsp/peek.lua24
-rw-r--r--.config/nvim/lua/lsp/utils.lua27
-rw-r--r--.config/nvim/lua/plugin-loader.lua2
-rw-r--r--.config/nvim/lua/plugins.lua1
-rw-r--r--.config/nvim/lua/utils/init.lua50
29 files changed, 838 insertions, 590 deletions
diff --git a/.config/nvim/.stylua.toml b/.config/nvim/.stylua.toml
new file mode 100644
index 0000000..4c56db7
--- /dev/null
+++ b/.config/nvim/.stylua.toml
@@ -0,0 +1,6 @@
+column_width = 88
+line_endings = "Unix"
+indent_type = "Spaces"
+indent_width = 2
+quote_style = "AutoPreferDouble"
+no_call_parentheses = true
diff --git a/.config/nvim/README.md b/.config/nvim/README.md
index d524a20..91bb34c 100644
--- a/.config/nvim/README.md
+++ b/.config/nvim/README.md
@@ -34,6 +34,4 @@ flake8
TODO:
-
-- [] FIX ftplugin
- - [ ] fix formatters and linters!
+- Fix null-ls an all that jazz
diff --git a/.config/nvim/config.lua b/.config/nvim/config.lua
index 0805ca0..0bfee43 100644
--- a/.config/nvim/config.lua
+++ b/.config/nvim/config.lua
@@ -1,6 +1,6 @@
-- general
options.format_on_save = true
-options.colorscheme = 'dark'
+options.colorscheme = "dark"
vim.opt.wrap = false
-- Keymappings
@@ -16,30 +16,42 @@ require("extra.json_schemas").setup()
options.builtin.dashboard.active = true
options.builtin.terminal.active = true
options.builtin.rooter.active = true
-options.builtin.bufferline.active = true
+options.builtin.bufferline.active = false
options.builtin.nvimtree.active = true
-- Whichkey
options.builtin.which_key.mappings.l.d = { "<cmd>TroubleToggle<cr>", "Diagnostics" }
-options.builtin.which_key.mappings.l.R = { "<cmd>TroubleToggle lsp_references<cr>", "References" }
+options.builtin.which_key.mappings.l.R = {
+ "<cmd>TroubleToggle lsp_references<cr>",
+ "References",
+}
options.builtin.which_key.mappings.l.o = { "<cmd>SymbolsOutline<cr>", "Outline" }
-options.builtin.which_key.mappings.T.h = { "<cmd>TSHighlightCapturesUnderCursor<cr>", "Highlight" }
+options.builtin.which_key.mappings.T.h = {
+ "<cmd>TSHighlightCapturesUnderCursor<cr>",
+ "Highlight",
+}
options.builtin.which_key.mappings.T.p = { "<cmd>TSPlaygroundToggle<cr>", "Playground" }
options.builtin.which_key.mappings["z"] = { "<cmd>ZenMode<cr>", "Zen" }
options.builtin.which_key.mappings["r"] = {
name = "Replace",
r = { "<cmd>lua require('spectre').open()<cr>", "Replace" },
- w = { "<cmd>lua require('spectre').open_visual({select_word=true})<cr>", "Replace Word" },
+ w = {
+ "<cmd>lua require('spectre').open_visual({select_word=true})<cr>",
+ "Replace Word",
+ },
f = { "<cmd>lua require('spectre').open_file_search()<cr>", "Replace Buffer" },
}
-options.builtin.which_key.mappings.f = { "<cmd>lua require('lir.float').toggle()<cr>", "Files" }
+options.builtin.which_key.mappings.f = {
+ "<cmd>lua require('lir.float').toggle()<cr>",
+ "Files",
+}
options.builtin.nvimtree.auto_open = 0
-- Treesitter
options.builtin.treesitter.ensure_installed = "maintained"
-options.builtin.treesitter.autotag.enable = true
-options.builtin.treesitter.playground.enable = true
+options.builtin.treesitter.autotag.enable = false
+options.builtin.treesitter.playground.enable = false
-- Formatters
-- python
@@ -57,11 +69,12 @@ options.lang.python.linters = {
},
}
+options.lang.python.lsp.on_attach = nil
+
-- lua
options.lang.lua.formatters = {
{
exe = "stylua",
- args = {},
},
}
@@ -73,7 +86,6 @@ options.lang.json.formatters = {
},
}
-
options.plugins = {
{
"folke/trouble.nvim",
@@ -180,5 +192,4 @@ options.plugins = {
"sindrets/diffview.nvim",
event = "BufRead",
},
-
}
diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua
index 959ae15..33dea53 100644
--- a/.config/nvim/lua/core/autocmds.lua
+++ b/.config/nvim/lua/core/autocmds.lua
@@ -56,6 +56,10 @@ options.autocommands = {
-- {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'},
-- {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'}
-- },
+ _git = {
+ { "FileType", "gitcommit", "setlocal wrap" },
+ { "FileType", "gitcommit", "setlocal spell" },
+ },
_markdown = {
{ "FileType", "markdown", "setlocal wrap" },
{ "FileType", "markdown", "setlocal spell" },
diff --git a/.config/nvim/lua/core/compe.lua b/.config/nvim/lua/core/compe.lua
index 3291918..14fba1a 100644
--- a/.config/nvim/lua/core/compe.lua
+++ b/.config/nvim/lua/core/compe.lua
@@ -45,10 +45,22 @@ M.config = function()
insert_mode = {
-- ["<Tab>"] = { 'pumvisible() ? "<C-n>" : "<Tab>"', { silent = true, noremap = true, expr = true } },
-- ["<S-Tab>"] = { 'pumvisible() ? "<C-p>" : "<S-Tab>"', { silent = true, noremap = true, expr = true } },
- ["<C-Space>"] = { "compe#complete()", { silent = true, noremap = true, expr = true } },
- ["<C-e>"] = { "compe#close('<C-e>')", { silent = true, noremap = true, expr = true } },
- ["<C-f>"] = { "compe#scroll({ 'delta': +4 })", { silent = true, noremap = true, expr = true } },
- ["<C-d>"] = { "compe#scroll({ 'delta': -4 })", { silent = true, noremap = true, expr = true } },
+ ["<C-Space>"] = {
+ "compe#complete()",
+ { silent = true, noremap = true, expr = true },
+ },
+ ["<C-e>"] = {
+ "compe#close('<C-e>')",
+ { silent = true, noremap = true, expr = true },
+ },
+ ["<C-f>"] = {
+ "compe#scroll({ 'delta': +4 })",
+ { silent = true, noremap = true, expr = true },
+ },
+ ["<C-d>"] = {
+ "compe#scroll({ 'delta': -4 })",
+ { silent = true, noremap = true, expr = true },
+ },
},
},
opts = {
diff --git a/.config/nvim/lua/core/dashboard.lua b/.config/nvim/lua/core/dashboard.lua
index c868540..efbb790 100644
--- a/.config/nvim/lua/core/dashboard.lua
+++ b/.config/nvim/lua/core/dashboard.lua
@@ -4,24 +4,24 @@ M.config = function()
active = false,
search_handler = "telescope",
custom_header = {
- ' ##############..... ############## ',
- ' ##############......############## ',
- ' ##########..........########## ',
- ' ##########........########## ',
- ' ##########.......########## ',
- ' ##########.....##########.. ',
- ' ##########....##########..... ',
- ' ..##########..##########......... ',
- ' ....##########.#########............. ',
- ' ..################JJJ............ ',
- ' ################............. ',
- ' ##############.JJJ.JJJJJJJJJJ ',
- ' ############...JJ...JJ..JJ JJ ',
- ' ##########....JJ...JJ..JJ JJ ',
- ' ########......JJJ..JJJ JJJ JJJ ',
- ' ###### ......... ',
- ' ..... ',
- ' . ',
+ " ##############..... ############## ",
+ " ##############......############## ",
+ " ##########..........########## ",
+ " ##########........########## ",
+ " ##########.......########## ",
+ " ##########.....##########.. ",
+ " ##########....##########..... ",
+ " ..##########..##########......... ",
+ " ....##########.#########............. ",
+ " ..################JJJ............ ",
+ " ################............. ",
+ " ##############.JJJ.JJJJJJJJJJ ",
+ " ############...JJ...JJ..JJ JJ ",
+ " ##########....JJ...JJ..JJ JJ ",
+ " ########......JJJ..JJJ JJJ JJJ ",
+ " ###### ......... ",
+ " ..... ",
+ " . ",
},
custom_section = {
@@ -42,7 +42,6 @@ M.config = function()
command = ":e ~/.config/nvim/config.lua",
},
},
-
}
end
@@ -88,7 +87,8 @@ M.setup = function()
{
"FileType",
"dashboard",
- "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=" .. vim.opt.showtabline._value,
+ "set showtabline=0 | autocmd BufLeave <buffer> set showtabline="
+ .. vim.opt.showtabline._value,
},
{ "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
},
diff --git a/.config/nvim/lua/core/galaxyline.lua b/.config/nvim/lua/core/galaxyline.lua
index ff8c59a..f7fa8c9 100644
--- a/.config/nvim/lua/core/galaxyline.lua
+++ b/.config/nvim/lua/core/galaxyline.lua
@@ -22,19 +22,19 @@ table.insert(gls.left, {
ViMode = {
provider = function()
local alias = {
- n = 'NORMAL',
- i = 'INSERT',
- c = 'COMMAND',
- V = 'VISUAL',
- [''] = 'VISUAL',
- v = 'VISUAL',
- R = 'REPLACE',
+ n = "NORMAL",
+ i = "INSERT",
+ c = "COMMAND",
+ V = "VISUAL",
+ [""] = "VISUAL",
+ v = "VISUAL",
+ R = "REPLACE",
}
local alias_mode = alias[vim.fn.mode()]
if alias_mode == nil then
alias_mode = vim.fn.mode()
end
- return alias_mode..' '
+ return alias_mode .. " "
end,
separator_highlight = { "NONE", colors.alt_bg },
highlight = { colors.grey, colors.alt_bg },
@@ -193,19 +193,23 @@ table.insert(gls.right, {
local function get_attached_provider_name(msg)
msg = msg or "LSP Inactive"
+
local buf_clients = vim.lsp.buf_get_clients()
if next(buf_clients) == nil then
return msg
end
- local buf_ft = vim.bo.filetype
+
local buf_client_names = {}
- local null_ls_providers = require("lsp.null-ls").get_registered_providers_by_filetype(buf_ft)
for _, client in pairs(buf_clients) do
if client.name ~= "null-ls" then
table.insert(buf_client_names, client.name)
end
end
+
+ local null_ls = require "lsp.null-ls"
+ local null_ls_providers = null_ls.list_supported_provider_names(vim.bo.filetype)
vim.list_extend(buf_client_names, null_ls_providers)
+
return table.concat(buf_client_names, ", ")
end
diff --git a/.config/nvim/lua/core/info.lua b/.config/nvim/lua/core/info.lua
index c9d34ce..5b7ef53 100644
--- a/.config/nvim/lua/core/info.lua
+++ b/.config/nvim/lua/core/info.lua
@@ -136,10 +136,20 @@ function M.toggle_popup(ft)
local lsp_info = {
"Associated language-server: " .. client.name,
- indent .. "* Active: " .. tostring(is_client_active) .. ", id: " .. tostring(client.id),
- indent .. "* Formatting support: " .. tostring(client.resolved_capabilities.document_formatting),
- indent .. "* Capabilities list: " .. table.concat(vim.list_slice(client_enabled_caps, 1, num_caps / 2), ", "),
- indent .. indent .. indent .. table.concat(vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)), ", "),
+ indent .. "* Active: " .. tostring(is_client_active) .. ", id: " .. tostring(
+ client.id
+ ),
+ indent .. "* Formatting support: " .. tostring(
+ client.resolved_capabilities.document_formatting
+ ),
+ indent .. "* Capabilities list: " .. table.concat(
+ vim.list_slice(client_enabled_caps, 1, num_caps / 2),
+ ", "
+ ),
+ indent .. indent .. indent .. table.concat(
+ vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)),
+ ", "
+ ),
"",
}
vim.list_extend(buf_lines, lsp_info)
@@ -152,13 +162,19 @@ function M.toggle_popup(ft)
local missing_formatters_status
if vim.tbl_count(missing_formatters) > 0 then
- missing_formatters_status = { "Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ", "" }
+ missing_formatters_status = {
+ "Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ",
+ "",
+ }
vim.list_extend(buf_lines, missing_formatters_status)
end
local missing_linters_status
if vim.tbl_count(missing_linters) > 0 then
- missing_linters_status = { "Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ", "" }
+ missing_linters_status = {
+ "Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ",
+ "",
+ }
vim.list_extend(buf_lines, missing_linters_status)
end
@@ -170,9 +186,21 @@ function M.toggle_popup(ft)
--TODO: highlighting is either inconsistent or not working :\
vim.cmd("syntax match Identifier /filetype is: .*\\zs\\<" .. ft .. "\\>/")
vim.cmd("syntax match Identifier /server: .*\\zs\\<" .. client.name .. "\\>/")
- vim.cmd("syntax match Identifier /providers: .*\\zs\\<" .. table.concat(null_ls_providers, ", ") .. "\\>/")
- vim.cmd("syntax match Identifier /formatters: .*\\zs\\<" .. table.concat(missing_formatters, ", ") .. "\\>/")
- vim.cmd("syntax match Identifier /linters: .*\\zs\\<" .. table.concat(missing_linters, ", ") .. "\\>/")
+ vim.cmd(
+ "syntax match Identifier /providers: .*\\zs\\<"
+ .. table.concat(null_ls_providers, ", ")
+ .. "\\>/"
+ )
+ vim.cmd(
+ "syntax match Identifier /formatters: .*\\zs\\<"
+ .. table.concat(missing_formatters, ", ")
+ .. "\\>/"
+ )
+ vim.cmd(
+ "syntax match Identifier /linters: .*\\zs\\<"
+ .. table.concat(missing_linters, ", ")
+ .. "\\>/"
+ )
end
return M.create_simple_popup(buf_lines, set_syntax_hl)
diff --git a/.config/nvim/lua/core/log.lua b/.config/nvim/lua/core/log.lua
index d364ffb..e6f7afe 100644
--- a/.config/nvim/lua/core/log.lua
+++ b/.config/nvim/lua/core/log.lua
@@ -10,7 +10,11 @@ function Log:new(opts)
end
local obj = require("plenary.log").new(opts)
- local path = string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "cache" }), opts.plugin)
+ local path = string.format(
+ "%s/%s.log",
+ vim.api.nvim_call_function("stdpath", { "cache" }),
+ opts.plugin
+ )
obj.get_path = function()
return path
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
index 698bd6e..376ae56 100644
--- a/.config/nvim/lua/core/nvimtree.lua
+++ b/.config/nvim/lua/core/nvimtree.lua
@@ -66,6 +66,8 @@ M.setup = function()
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
{ key = "h", cb = tree_cb "close_node" },
{ key = "v", cb = tree_cb "vsplit" },
+
+ { key = "q", cb = ":lua require('core.nvimtree').toggle_tree()<cr>" },
}
end
end
@@ -93,7 +95,9 @@ M.focus_or_close = function()
end
else
view.open()
- if package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left" then
+ if
+ package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left"
+ then
require("bufferline.state").set_offset(options.builtin.nvimtree.width + 1, "")
end
end
@@ -110,7 +114,9 @@ M.toggle_tree = function()
require("bufferline.state").set_offset(0)
end
else
- if package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left" then
+ if
+ package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left"
+ then
require("bufferline.state").set_offset(options.builtin.nvimtree.width + 1, "")
end
require("nvim-tree").toggle()
diff --git a/.config/nvim/lua/core/telescope.lua b/.config/nvim/lua/core/telescope.lua
index 2b0a013..513665e 100644
--- a/.config/nvim/lua/core/telescope.lua
+++ b/.config/nvim/lua/core/telescope.lua
@@ -34,7 +34,7 @@ M.config = function()
file_sorter = require("telescope.sorters").get_fzy_sorter,
file_ignore_patterns = {},
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
- path_display = {"shorten"},
+ path_display = { "shorten" },
winblend = 0,
border = {},
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
@@ -45,7 +45,6 @@ M.config = function()
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-
-- Developer configurations: Not meant for general override
-- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
diff --git a/.config/nvim/lua/core/terminal.lua b/.config/nvim/lua/core/terminal.lua
index 2793da2..ff3f95e 100644
--- a/.config/nvim/lua/core/terminal.lua
+++ b/.config/nvim/lua/core/terminal.lua
@@ -86,7 +86,11 @@ end
M._exec_toggle = function(exec)
local binary = M._split(exec)[1]
if is_installed(binary) ~= true then
- print("Please install executable " .. binary .. ". Check documentation for more information")
+ print(
+ "Please install executable "
+ .. binary
+ .. ". Check documentation for more information"
+ )
return
end
local Terminal = require("toggleterm.terminal").Terminal
diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua
index 6227a8e..775ea67 100644
--- a/.config/nvim/lua/core/which-key.lua
+++ b/.config/nvim/lua/core/which-key.lua
@@ -156,8 +156,14 @@ M.config = function()
p = {
name = "Peek",
d = { "<cmd>lua require('lsp.peek').Peek('definition')<cr>", "Definition" },
- t = { "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>", "Type Definition" },
- i = { "<cmd>lua require('lsp.peek').Peek('implementation')<cr>", "Implementation" },
+ t = {
+ "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>",
+ "Type Definition",
+ },
+ i = {
+ "<cmd>lua require('lsp.peek').Peek('implementation')<cr>",
+ "Implementation",
+ },
},
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
@@ -169,7 +175,10 @@ M.config = function()
},
I = {
name = "+nvim",
- k = { "<cmd>lua require('keymappings').print()<cr>", "View nvim's default keymappings" },
+ k = {
+ "<cmd>lua require('keymappings').print()<cr>",
+ "View nvim's default keymappings",
+ },
i = {
"<cmd>lua require('core.info').toggle_popup(vim.bo.filetype)<cr>",
"Toggle nvim Info",
diff --git a/.config/nvim/lua/default-config.lua b/.config/nvim/lua/default-config.lua
index e906da1..6f396ba 100644
--- a/.config/nvim/lua/default-config.lua
+++ b/.config/nvim/lua/default-config.lua
@@ -127,11 +127,10 @@ end
options.lang = {
asm = {
formatters = {
- {
- -- @usage can be asmfmt
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "asmfmt",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -141,11 +140,10 @@ options.lang = {
},
beancount = {
formatters = {
- {
- -- @usage can be bean_format
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "bean_format",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -160,12 +158,14 @@ options.lang = {
},
c = {
formatters = {
- {
- -- @usage can be clang_format or uncrustify
- exe = "",
- args = {},
- stdin = true,
- },
+ -- {
+ -- exe = "clang_format",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "uncrustify",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -187,12 +187,14 @@ options.lang = {
},
cpp = {
formatters = {
- {
- -- @usage can be clang_format or uncrustify
- exe = "",
- args = {},
- stdin = true,
- },
+ -- {
+ -- exe = "clang_format",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "uncrustify",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -214,11 +216,10 @@ options.lang = {
},
crystal = {
formatters = {
- {
- -- @usage can be crystal_format
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "crystal_format",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -233,11 +234,14 @@ options.lang = {
},
cs = {
formatters = {
- {
- -- @usage can be clang_format or uncrustify
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "clang_format ",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "uncrustify",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -257,11 +261,10 @@ options.lang = {
},
cmake = {
formatters = {
- {
- -- @usage can be cmake_format
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "cmake_format",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -269,7 +272,6 @@ options.lang = {
setup = {
cmd = {
DATA_PATH .. "/lspinstall/cmake/venv/bin/cmake-language-server",
- "--stdio",
},
on_attach = common_on_attach,
on_init = common_on_init,
@@ -278,10 +280,7 @@ options.lang = {
},
},
clojure = {
- formatters = { {
- exe = "",
- args = {},
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "clojure_lsp",
@@ -298,11 +297,14 @@ options.lang = {
},
css = {
formatters = {
- {
- -- @usage can be prettier or prettierd
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -310,7 +312,8 @@ options.lang = {
setup = {
cmd = {
"node",
- DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
+ DATA_PATH
+ .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
"--stdio",
},
on_attach = common_on_attach,
@@ -321,11 +324,14 @@ options.lang = {
},
less = {
formatters = {
- {
- -- @usage can be prettier or prettierd
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -333,7 +339,8 @@ options.lang = {
setup = {
cmd = {
"node",
- DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
+ DATA_PATH
+ .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
"--stdio",
},
on_attach = common_on_attach,
@@ -344,11 +351,10 @@ options.lang = {
},
d = {
formatters = {
- {
- -- @usage can be dfmt
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "dfmt",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -363,12 +369,10 @@ options.lang = {
},
dart = {
formatters = {
- {
- -- @usage can be dart_format
- exe = "",
- args = {},
- stdin = true,
- },
+ -- {
+ -- exe = "dart_format",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -386,13 +390,7 @@ options.lang = {
},
},
docker = {
- formatters = {
- {
- exe = "",
- args = {},
- },
- -- @usage can be {"hadolint"}
- },
+ formatters = {},
linters = {},
lsp = {
provider = "dockerls",
@@ -409,12 +407,10 @@ options.lang = {
},
elixir = {
formatters = {
- {
- -- @usage can be mix
- exe = "",
- args = {},
- stdin = true,
- },
+ -- {
+ -- exe = "mix",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -431,12 +427,10 @@ options.lang = {
},
elm = {
formatters = {
- {
- -- @usage can be elm_format
- exe = "",
- args = {},
- stdin = true,
- },
+ -- {
+ -- exe = "elm_format",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -458,11 +452,10 @@ options.lang = {
},
erlang = {
formatters = {
- {
- -- @usage can be erlfmt
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "erlfmt",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -480,11 +473,10 @@ options.lang = {
emmet = { active = false },
fish = {
formatters = {
- {
- -- @usage can be fish_indent
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "fish_indent",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -498,12 +490,18 @@ options.lang = {
},
go = {
formatters = {
- {
- -- @usage can be gofmt or goimports or gofumpt
- exe = "",
- args = {},
- stdin = true,
- },
+ -- {
+ -- exe = "gofmt",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "goimports",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "gofumpt",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -519,10 +517,7 @@ options.lang = {
},
},
graphql = {
- formatters = { {
- exe = "",
- args = {},
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "graphql",
@@ -540,10 +535,7 @@ options.lang = {
},
},
haskell = {
- formatters = { {
- exe = "",
- args = {},
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "hls",
@@ -557,11 +549,14 @@ options.lang = {
},
html = {
formatters = {
- {
- -- @usage can be prettier or prettierd
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -569,7 +564,8 @@ options.lang = {
setup = {
cmd = {
"node",
- DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
+ DATA_PATH
+ .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
"--stdio",
},
on_attach = common_on_attach,
@@ -580,11 +576,14 @@ options.lang = {
},
java = {
formatters = {
- {
- -- @usage can be clang_format or uncrustify
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "clang_format",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "uncrustify",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -599,12 +598,18 @@ options.lang = {
},
json = {
formatters = {
- {
- -- @usage can be json_tool or prettier or prettierd
- exe = "",
- args = {},
- stdin = true,
- },
+ -- {
+ -- exe = "json_tool",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -612,7 +617,8 @@ options.lang = {
setup = {
cmd = {
"node",
- DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
+ DATA_PATH
+ .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
"--stdio",
},
on_attach = common_on_attach,
@@ -640,10 +646,7 @@ options.lang = {
},
},
julia = {
- formatters = { {
- exe = "",
- args = {},
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "julials",
@@ -662,10 +665,7 @@ options.lang = {
},
},
kotlin = {
- formatters = { {
- exe = "",
- args = {},
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "kotlin_language_server",
@@ -689,18 +689,22 @@ options.lang = {
"build.gradle", -- Gradle
"build.gradle.kts", -- Gradle
}
- return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
+ return util.root_pattern(unpack(root_files))(fname)
+ or util.root_pattern(unpack(fallback_root_files))(fname)
end,
},
},
},
lua = {
formatters = {
- {
- -- @usage can be stylua or lua_format
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "stylua",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "lua_format",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -728,11 +732,11 @@ options.lang = {
},
workspace = {
-- Make the server aware of Neovim runtime files
- library = {
- [vim.fn.expand "~/.config/nvim/lua"] = true,
- [vim.fn.expand "$VIMRUNTIME/lua"] = true,
- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
- },
+ -- library = {
+ -- [vim.fn.expand "~/.local/share/lunarvim/options/lua"] = true,
+ -- [vim.fn.expand "$VIMRUNTIME/lua"] = true,
+ -- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
+ --},
maxPreload = 100000,
preloadFileSize = 1000,
},
@@ -743,25 +747,23 @@ options.lang = {
},
nginx = {
formatters = {
- {
- -- @usage can be nginx_beautifier
- exe = "",
- args = {
- provider = "",
- setup = {},
- },
- },
+ -- {
+ -- exe = "nginx_beautifier",
+ -- args = {
+ -- provider = "",
+ -- setup = {},
+ -- },
+ -- },
},
linters = {},
lsp = {},
},
perl = {
formatters = {
- {
- -- @usage can be perltidy
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "perltidy",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -771,11 +773,10 @@ options.lang = {
},
sql = {
formatters = {
- {
- -- @usage can be sqlformat
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "sqlformat",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -787,11 +788,10 @@ options.lang = {
},
php = {
formatters = {
- {
- -- @usage can be phpcbf
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "phpcbf",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -815,14 +815,15 @@ options.lang = {
},
},
puppet = {
- formatters = { {
- exe = "",
- args = {},
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "puppet",
setup = {
+ cmd = {
+ DATA_PATH .. "/lspinstall/puppet/puppet-editor-services/puppet-languageserver",
+ "--stdio",
+ },
on_attach = common_on_attach,
on_init = common_on_init,
capabilities = common_capabilities,
@@ -830,12 +831,19 @@ options.lang = {
},
},
javascript = {
- -- @usage can be prettier or prettier_d_slim or prettierd
formatters = {
- {
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettier_d_slim",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
},
-- @usage can be {"eslint"} or {"eslint_d"}
linters = {},
@@ -855,13 +863,19 @@ options.lang = {
},
javascriptreact = {
formatters = {
- {
- -- @usage can be prettier or prettier_d_slim or prettierd
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettier_d_slim",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
},
- -- @usage can be {"eslint"} or {"eslint_d"}
linters = {},
lsp = {
provider = "tsserver",
@@ -879,11 +893,14 @@ options.lang = {
},
python = {
formatters = {
- {
- -- @usage can be black or yapf or isort
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "yapf",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "isort",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -903,11 +920,10 @@ options.lang = {
-- R -e 'install.packages("readr",repos = "http://cran.us.r-project.org")'
r = {
formatters = {
- {
- -- @usage can be format_r
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "format_r",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -927,11 +943,10 @@ options.lang = {
},
ruby = {
formatters = {
- {
- -- @usage can be rufo
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "rufo",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -962,11 +977,10 @@ options.lang = {
},
rust = {
formatters = {
- {
- -- @usage can be rustfmt
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "rustfmt",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -983,11 +997,10 @@ options.lang = {
},
scala = {
formatters = {
- {
- -- @usage can be scalafmt
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "scalafmt",
+ -- args = {},
+ -- },
},
linters = { "" },
lsp = {
@@ -1001,11 +1014,10 @@ options.lang = {
},
sh = {
formatters = {
- {
- -- @usage can be shfmt
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "shfmt",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -1022,10 +1034,7 @@ options.lang = {
},
},
svelte = {
- formatters = { {
- exe = "",
- args = {},
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "svelte",
@@ -1042,11 +1051,10 @@ options.lang = {
},
swift = {
formatters = {
- {
- -- @usage can be swiftformat
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "swiftformat",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -1076,11 +1084,10 @@ options.lang = {
},
terraform = {
formatters = {
- {
- -- @usage can be terraform_fmt
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "terraform_fmt",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -1097,14 +1104,7 @@ options.lang = {
},
},
tex = {
- formatters = {
- {
- exe = "",
- args = {},
- stdin = false,
- },
- -- @usage can be chktex or vale
- },
+ formatters = {},
linters = {},
lsp = {
provider = "texlab",
@@ -1118,12 +1118,18 @@ options.lang = {
},
typescript = {
formatters = {
- {
- -- @usage can be prettier or prettierd or prettier_d_slim
- exe = "",
- args = {},
- },
- -- @usage can be {"eslint"} or {"eslint_d"}
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettier_d_slim",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -1142,11 +1148,18 @@ options.lang = {
},
typescriptreact = {
formatters = {
- {
- -- @usage can be prettier or prettierd or prettier_d_slim
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettier_d_slim",
+ -- args = {},
+ -- },
},
-- @usage can be {"eslint"} or {"eslint_d"}
linters = {},
@@ -1165,13 +1178,7 @@ options.lang = {
},
},
vim = {
- formatters = {
- {
- exe = "",
- args = {},
- },
- },
- -- @usage can be {"vint"}
+ formatters = {},
linters = { "" },
lsp = {
provider = "vimls",
@@ -1188,13 +1195,19 @@ options.lang = {
},
vue = {
formatters = {
- {
- -- @usage can be prettier or prettierd or prettier_d_slim
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettier_d_slim",
+ -- args = {},
+ -- },
},
- -- @usage can be {"eslint"} or {"eslint_d"}
linters = {},
lsp = {
provider = "vuels",
@@ -1210,11 +1223,14 @@ options.lang = {
},
yaml = {
formatters = {
- {
- -- @usage can be prettier or prettierd
- exe = "",
- args = {},
- },
+ -- {
+ -- exe = "prettier",
+ -- args = {},
+ -- },
+ -- {
+ -- exe = "prettierd",
+ -- args = {},
+ -- },
},
linters = {},
lsp = {
@@ -1231,11 +1247,7 @@ options.lang = {
},
},
zig = {
- formatters = { {
- exe = "",
- args = {},
- stdin = false,
- } },
+ formatters = {},
linters = {},
lsp = {
provider = "zls",
diff --git a/.config/nvim/lua/extra/json_schemas.lua b/.config/nvim/lua/extra/json_schemas.lua
index 590547b..926de45 100644
--- a/.config/nvim/lua/extra/json_schemas.lua
+++ b/.config/nvim/lua/extra/json_schemas.lua
@@ -52,31 +52,31 @@ M.setup = function()
name = "Helm Chart.yaml",
description = "The Chart.lock file locks dependencies from Chart.yaml",
fileMatch = { "Chart.lock" },
- url = "https://json.schemastore.org/chart-lock.json"
+ url = "https://json.schemastore.org/chart-lock.json",
},
{
name = "CircleCI config.yml",
description = "Schema for CircleCI 2.0 config files",
fileMatch = { ".circleci/config.yml" },
- url = "https://json.schemastore.org/circleciconfig.json"
+ url = "https://json.schemastore.org/circleciconfig.json",
},
{
name = "yamllint",
description = "yamllint uses a set of rules to check source files for problems",
fileMatch = { "**/.yamllint", "**/.yamllint.yaml", "**/.yamllint.yml" },
- url = "https://json.schemastore.org/yamllint.json"
+ url = "https://json.schemastore.org/yamllint.json",
},
{
name = "Hadolint",
description = "A smarter Dockerfile linter that helps you build best practice Docker images.",
fileMatch = { ".hadolint.yaml", "hadolint.yaml", ".hadolint.yml", "hadolint.yml" },
- url = "https://raw.githubusercontent.com/hadolint/hadolint/master/contrib/hadolint.json"
+ url = "https://raw.githubusercontent.com/hadolint/hadolint/master/contrib/hadolint.json",
},
{
name = "kustomization.yaml",
description = "Kubernetes native configuration management",
fileMatch = { "kustomization.yaml", "kustomization.yml" },
- url = "https://json.schemastore.org/kustomization.json"
+ url = "https://json.schemastore.org/kustomization.json",
},
}
@@ -87,7 +87,10 @@ M.setup = function()
return tab1
end
- local extended_schemas = extend(schemas, require("nlspsettings.jsonls").get_default_schemas())
+ local extended_schemas = extend(
+ schemas,
+ require("nlspsettings.jsonls").get_default_schemas()
+ )
options.lang.json.lsp.setup.settings = {
json = {
diff --git a/.config/nvim/lua/extra/octo.lua b/.config/nvim/lua/extra/octo.lua
index 5a110df..f4d177c 100644
--- a/.config/nvim/lua/extra/octo.lua
+++ b/.config/nvim/lua/extra/octo.lua
@@ -21,7 +21,7 @@ M.config = function()
snippet_context_lines = 4, -- number or lines around commented lines
file_panel = {
size = 10, -- changed files panel rows
- use_icons = true, -- use web-devicons in file panel
+ use_icons = true, -- use web-devicons in file panel
},
mappings = {
issue = {
diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua
index c76d0e8..60069d8 100644
--- a/.config/nvim/lua/keymappings.lua
+++ b/.config/nvim/lua/keymappings.lua
@@ -16,6 +16,7 @@ local mode_adapters = {
term_mode = "t",
visual_mode = "v",
visual_block_mode = "x",
+ command_mode = "c",
}
-- Append key mappings to lunarvim's defaults for a given mode
@@ -80,8 +81,14 @@ function M.config()
["<A-Right>"] = "<C-\\><C-N><C-w>l",
-- navigate tab completion with <c-j> and <c-k>
-- runs conditionally
- ["<C-j>"] = { 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', { expr = true, noremap = true } },
- ["<C-k>"] = { 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', { expr = true, noremap = true } },
+ ["<C-j>"] = {
+ 'pumvisible() ? "\\<C-n>" : "\\<C-j>"',
+ { expr = true, noremap = true },
+ },
+ ["<C-k>"] = {
+ 'pumvisible() ? "\\<C-p>" : "\\<C-k>"',
+ { expr = true, noremap = true },
+ },
},
---@usage change or add keymappings for normal mode
@@ -141,13 +148,26 @@ function M.config()
["<A-j>"] = ":m '>+1<CR>gv-gv",
["<A-k>"] = ":m '<-2<CR>gv-gv",
},
+ ---@usage change or add keymappings for command mode
+ command_mode = {
+ -- navigate tab completion with <c-j> and <c-k>
+ -- runs conditionally
+ ["<C-j>"] = {
+ 'pumvisible() ? "\\<C-n>" : "\\<C-j>"',
+ { expr = true, noremap = true },
+ },
+ ["<C-k>"] = {
+ 'pumvisible() ? "\\<C-p>" : "\\<C-k>"',
+ { expr = true, noremap = true },
+ },
+ },
}
if vim.fn.has "mac" == 1 then
- lvim.keys.normal_mode["<A-Up>"] = lvim.keys.normal_mode["<C-Up>"]
- lvim.keys.normal_mode["<A-Down>"] = lvim.keys.normal_mode["<C-Down>"]
- lvim.keys.normal_mode["<A-Left>"] = lvim.keys.normal_mode["<C-Left>"]
- lvim.keys.normal_mode["<A-Right>"] = lvim.keys.normal_mode["<C-Right>"]
+ options.keys.normal_mode["<A-Up>"] = options.keys.normal_mode["<C-Up>"]
+ options.keys.normal_mode["<A-Down>"] = options.keys.normal_mode["<C-Down>"]
+ options.keys.normal_mode["<A-Left>"] = options.keys.normal_mode["<C-Left>"]
+ options.keys.normal_mode["<A-Right>"] = options.keys.normal_mode["<C-Right>"]
if Log:get_default() then
Log:get_default().info "Activated mac keymappings"
end
diff --git a/.config/nvim/lua/lsp/handlers.lua b/.config/nvim/lua/lsp/handlers.lua
index c869d79..e273261 100644
--- a/.config/nvim/lua/lsp/handlers.lua
+++ b/.config/nvim/lua/lsp/handlers.lua
@@ -3,61 +3,69 @@
local M = {}
function M.setup()
- vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = options.lsp.diagnostics.virtual_text,
- signs = options.lsp.diagnostics.signs.active,
- underline = options.lsp.document_highlight,
- })
-
- vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, _, params, client_id, _)
- local config = { -- your config
+ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
+ vim.lsp.diagnostic.on_publish_diagnostics,
+ {
virtual_text = options.lsp.diagnostics.virtual_text,
- signs = options.lsp.diagnostics.signs,
- underline = options.lsp.diagnostics.underline,
- update_in_insert = options.lsp.diagnostics.update_in_insert,
- severity_sort = options.lsp.diagnostics.severity_sort,
+ signs = options.lsp.diagnostics.signs.active,
+ underline = options.lsp.document_highlight,
}
- local uri = params.uri
- local bufnr = vim.uri_to_bufnr(uri)
+ )
- if not bufnr then
- return
- end
+ vim.lsp.handlers["textDocument/publishDiagnostics"] =
+ function(_, _, params, client_id, _)
+ local config = { -- your config
+ virtual_text = options.lsp.diagnostics.virtual_text,
+ signs = options.lsp.diagnostics.signs,
+ underline = options.lsp.diagnostics.underline,
+ update_in_insert = options.lsp.diagnostics.update_in_insert,
+ severity_sort = options.lsp.diagnostics.severity_sort,
+ }
+ local uri = params.uri
+ local bufnr = vim.uri_to_bufnr(uri)
- local diagnostics = params.diagnostics
+ if not bufnr then
+ return
+ end
- for i, v in ipairs(diagnostics) do
- local source = v.source
- if source then
- if string.find(source, "/") then
- source = string.sub(v.source, string.find(v.source, "([%w-_]+)$"))
+ local diagnostics = params.diagnostics
+
+ for i, v in ipairs(diagnostics) do
+ local source = v.source
+ if source then
+ if string.find(source, "/") then
+ source = string.sub(v.source, string.find(v.source, "([%w-_]+)$"))
+ end
+ diagnostics[i].message = string.format("%s: %s", source, v.message)
+ else
+ diagnostics[i].message = string.format("%s", v.message)
end
- diagnostics[i].message = string.format("%s: %s", source, v.message)
- else
- diagnostics[i].message = string.format("%s", v.message)
- end
- if vim.tbl_contains(vim.tbl_keys(v), "code") then
- diagnostics[i].message = diagnostics[i].message .. string.format(" [%s]", v.code)
+ if vim.tbl_contains(vim.tbl_keys(v), "code") then
+ diagnostics[i].message = diagnostics[i].message
+ .. string.format(" [%s]", v.code)
+ end
end
- end
- vim.lsp.diagnostic.save(diagnostics, bufnr, client_id)
+ vim.lsp.diagnostic.save(diagnostics, bufnr, client_id)
- if not vim.api.nvim_buf_is_loaded(bufnr) then
- return
- end
+ if not vim.api.nvim_buf_is_loaded(bufnr) then
+ return
+ end
- vim.lsp.diagnostic.display(diagnostics, bufnr, client_id, config)
- end
+ vim.lsp.diagnostic.display(diagnostics, bufnr, client_id, config)
+ end
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = options.lsp.popup_border,
})
- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
- border = options.lsp.popup_border,
- })
+ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
+ vim.lsp.handlers.signature_help,
+ {
+ border = options.lsp.popup_border,
+ }
+ )
end
return M
diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua
index 0c830f5..067375f 100644
--- a/.config/nvim/lua/lsp/init.lua
+++ b/.config/nvim/lua/lsp/init.lua
@@ -1,10 +1,14 @@
local M = {}
local Log = require "core.log"
+
function M.config()
vim.lsp.protocol.CompletionItemKind = options.lsp.completion.item_kind
for _, sign in ipairs(options.lsp.diagnostics.signs.values) do
- vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
+ vim.fn.sign_define(
+ sign.name,
+ { texthl = sign.name, text = sign.text, numhl = sign.name }
+ )
end
require("lsp.handlers").setup()
@@ -107,10 +111,18 @@ function M.common_on_init(client, bufnr)
end
local formatters = options.lang[vim.bo.filetype].formatters
- if not vim.tbl_isempty(formatters) and formatters[1]["exe"] ~= nil and formatters[1].exe ~= "" then
+ if
+ not vim.tbl_isempty(formatters)
+ and formatters[1]["exe"] ~= nil
+ and formatters[1].exe ~= ""
+ then
client.resolved_capabilities.document_formatting = false
Log:get_default().info(
- string.format("Overriding language server [%s] with format provider [%s]", client.name, formatters[1].exe)
+ string.format(
+ "Overriding language server [%s] with format provider [%s]",
+ client.name,
+ formatters[1].exe
+ )
)
end
end
@@ -127,21 +139,23 @@ function M.common_on_attach(client, bufnr)
end
function M.setup(lang)
+ local lsp_utils = require "lsp.utils"
local lsp = options.lang[lang].lsp
- if require("utils").check_lsp_client_active(lsp.provider) then
+ if lsp_utils.is_client_active(lsp.provider) then
return
end
local overrides = options.lsp.override
-
if type(overrides) == "table" then
if vim.tbl_contains(overrides, lang) then
return
end
end
- local lspconfig = require "lspconfig"
- lspconfig[lsp.provider].setup(lsp.setup)
+ if lsp.provider ~= nil and lsp.provider ~= "" then
+ local lspconfig = require "lspconfig"
+ lspconfig[lsp.provider].setup(lsp.setup)
+ end
end
return M
diff --git a/.config/nvim/lua/lsp/null-ls.lua b/.config/nvim/lua/lsp/null-ls.lua
deleted file mode 100644
index 81c6648..0000000
--- a/.config/nvim/lua/lsp/null-ls.lua
+++ /dev/null
@@ -1,141 +0,0 @@
-local M = {}
-local Log = require "core.log"
-
-local null_ls = require "null-ls"
-
-local nodejs_local_providers = { "prettier", "prettierd", "prettier_d_slim", "eslint_d", "eslint" }
-
-M.requested_providers = {}
-
-function M.get_registered_providers_by_filetype(ft)
- local matches = {}
- for _, provider in pairs(M.requested_providers) do
- if vim.tbl_contains(provider.filetypes, ft) then
- local provider_name = provider.name
- -- special case: show "eslint_d" instead of eslint
- -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/9b8458bd1648e84169a7e8638091ba15c2f20fc0/doc/BUILTINS.md#eslint
- if string.find(provider._opts.command, "eslint_d") then
- provider_name = "eslint_d"
- end
- table.insert(matches, provider_name)
- end
- end
-
- return matches
-end
-
-function M.get_missing_providers_by_filetype(ft)
- local matches = {}
- for _, provider in pairs(M.requested_providers) do
- if vim.tbl_contains(provider.filetypes, ft) then
- local provider_name = provider.name
-
- table.insert(matches, provider_name)
- end
- end
-
- return matches
-end
-
-local function register_failed_request(ft, provider, operation)
- if not options.lang[ft][operation]._failed_requests then
- options.lang[ft][operation]._failed_requests = {}
- end
- table.insert(options.lang[ft][operation]._failed_requests, provider)
-end
-
-local function validate_nodejs_provider(provider)
- local command_path
- local root_dir
- if options.builtin.rooter.active then
- --- use vim-rooter to set root_dir
- vim.cmd "let root_dir = FindRootDirectory()"
- root_dir = vim.api.nvim_get_var "root_dir"
- else
- --- use LSP to set root_dir
- local ts_client = require("utils").get_active_client_by_ft "typescript"
- if ts_client == nil then
- Log:get_default().error "Unable to determine root directory since tsserver didn't start correctly"
- return
- end
- root_dir = ts_client.config.root_dir
- end
- local local_nodejs_command = root_dir .. "/node_modules/.bin/" .. provider._opts.command
- Log:get_default().debug("checking for local node module: ", vim.inspect(provider))
-
- if vim.fn.executable(local_nodejs_command) == 1 then
- command_path = local_nodejs_command
- elseif vim.fn.executable(provider._opts.command) == 1 then
- Log:get_default().debug("checking in global path instead for node module", provider._opts.command)
- command_path = provider._opts.command
- else
- Log:get_default().debug("Unable to find node module", provider._opts.command)
- end
- return command_path
-end
-
-local function validate_provider_request(provider)
- if provider == "" or provider == nil then
- return
- end
- -- NOTE: we can't use provider.name because eslint_d uses eslint name
- if vim.tbl_contains(nodejs_local_providers, provider._opts.command) then
- return validate_nodejs_provider(provider)
- end
- if vim.fn.executable(provider._opts.command) ~= 1 then
- Log:get_default().warn("Unable to find the path for", vim.inspect(provider))
- return
- end
- return provider._opts.command
-end
-
--- TODO: for linters and formatters with spaces and '-' replace with '_'
-function M.setup(filetype)
- for _, formatter in pairs(options.lang[filetype].formatters) do
- Log:get_default().debug("validating format provider: ", formatter.exe)
- local builtin_formatter = null_ls.builtins.formatting[formatter.exe]
- if not vim.tbl_contains(M.requested_providers, builtin_formatter) then
- -- FIXME: why doesn't this work?
- -- builtin_formatter._opts.args = formatter.args or builtin_formatter._opts.args
- -- builtin_formatter._opts.to_stdin = formatter.stdin or builtin_formatter._opts.to_stdin
- local resolved_path = validate_provider_request(builtin_formatter)
- if resolved_path then
- builtin_formatter._opts.command = resolved_path
- table.insert(M.requested_providers, builtin_formatter)
- Log:get_default().info("Using format provider", builtin_formatter.name)
- else
- -- mark it here to avoid re-doing the lookup again
- register_failed_request(filetype, formatter.exe, "formatters")
- end
- end
- end
-
- for _, linter in pairs(options.lang[filetype].linters) do
- local builtin_diagnoser = null_ls.builtins.diagnostics[linter.exe]
- Log:get_default().debug("validating lint provider: ", linter.exe)
- -- special case: fallback to "eslint"
- -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/9b8458bd1648e84169a7e8638091ba15c2f20fc0/doc/BUILTINS.md#eslint
- -- if provider.exe
- if linter.exe == "eslint_d" then
- builtin_diagnoser = null_ls.builtins.diagnostics.eslint.with { command = "eslint_d" }
- end
- if not vim.tbl_contains(M.requested_providers, builtin_diagnoser) then
- -- FIXME: why doesn't this work?
- -- builtin_diagnoser._opts.args = linter.args or builtin_diagnoser._opts.args
- -- builtin_diagnoser._opts.to_stdin = linter.stdin or builtin_diagnoser._opts.to_stdin
- local resolved_path = validate_provider_request(builtin_diagnoser)
- if resolved_path then
- builtin_diagnoser._opts.command = resolved_path
- table.insert(M.requested_providers, builtin_diagnoser)
- Log:get_default().info("Using linter provider", builtin_diagnoser.name)
- else
- -- mark it here to avoid re-doing the lookup again
- register_failed_request(filetype, linter.exe, "linters")
- end
- end
- end
-
- null_ls.register { sources = M.requested_providers }
-end
-
-return M
diff --git a/.config/nvim/lua/lsp/null-ls/formatters.lua b/.config/nvim/lua/lsp/null-ls/formatters.lua
new file mode 100644
index 0000000..e69c824
--- /dev/null
+++ b/.config/nvim/lua/lsp/null-ls/formatters.lua
@@ -0,0 +1,77 @@
+local M = {}
+local formatters_by_ft = {}
+
+local null_ls = require "null-ls"
+local services = require "lsp.null-ls.services"
+local logger = require("core.log"):get_default()
+
+local function list_names(formatters, option)
+ option = option or {}
+ local filter = option.filter or "supported"
+
+ return vim.tbl_keys(formatters[filter])
+end
+
+function M.list_supported_names(filetype)
+ if not formatters_by_ft[filetype] then
+ return {}
+ end
+ return list_names(formatters_by_ft[filetype], { filter = "supported" })
+end
+
+function M.list_unsupported_names(filetype)
+ if not formatters_by_ft[filetype] then
+ return {}
+ end
+ return list_names(formatters_by_ft[filetype], { filter = "unsupported" })
+end
+
+function M.list_available(filetype)
+ local formatters = {}
+ for _, provider in pairs(null_ls.builtins.formatting) do
+ -- TODO: Add support for wildcard filetypes
+ if vim.tbl_contains(provider.filetypes or {}, filetype) then
+ table.insert(formatters, provider.name)
+ end
+ end
+
+ return formatters
+end
+
+function M.list_configured(formatter_configs)
+ local formatters, errors = {}, {}
+
+ for _, fmt_config in ipairs(formatter_configs) do
+ local formatter = null_ls.builtins.formatting[fmt_config.exe]
+
+ if not formatter then
+ logger.error("Not a valid formatter:", fmt_config.exe)
+ errors[fmt_config.exe] = {} -- Add data here when necessary
+ else
+ local formatter_cmd = services.find_command(formatter._opts.command)
+ if not formatter_cmd then
+ logger.warn("Not found:", formatter._opts.command)
+ errors[fmt_config.exe] = {} -- Add data here when necessary
+ else
+ logger.info("Using formatter:", formatter_cmd)
+ formatters[fmt_config.exe] = formatter.with {
+ command = formatter_cmd,
+ extra_args = fmt_config.args,
+ }
+ end
+ end
+ end
+
+ return { supported = formatters, unsupported = errors }
+end
+
+function M.setup(filetype, option)
+ if formatters_by_ft[filetype] and not option.force_reload then
+ return
+ end
+
+ formatters_by_ft[filetype] = M.list_configured(options.lang[filetype].formatters)
+ null_ls.register { sources = formatters_by_ft[filetype].supported }
+end
+
+return M
diff --git a/.config/nvim/lua/lsp/null-ls/init.lua b/.config/nvim/lua/lsp/null-ls/init.lua
new file mode 100644
index 0000000..f2b1042
--- /dev/null
+++ b/.config/nvim/lua/lsp/null-ls/init.lua
@@ -0,0 +1,44 @@
+local M = {}
+
+function M.list_supported_provider_names(filetype)
+ local names = {}
+
+ local formatters = require "lsp.null-ls.formatters"
+ local linters = require "lsp.null-ls.linters"
+
+ vim.list_extend(names, formatters.list_supported_names(filetype))
+ vim.list_extend(names, linters.list_supported_names(filetype))
+
+ return names
+end
+
+function M.list_unsupported_provider_names(filetype)
+ local names = {}
+
+ local formatters = require "lsp.null-ls.formatters"
+ local linters = require "lsp.null-ls.linters"
+
+ vim.list_extend(names, formatters.list_unsupported_names(filetype))
+ vim.list_extend(names, linters.list_unsupported_names(filetype))
+
+ return names
+end
+
+-- TODO: for linters and formatters with spaces and '-' replace with '_'
+function M.setup(filetype, option)
+ option = option or {}
+
+ local ok, _ = pcall(require, "null-ls")
+ if not ok then
+ require("core.log"):get_default().error "Missing null-ls dependency"
+ return
+ end
+
+ local formatters = require "lsp.null-ls.formatters"
+ local linters = require "lsp.null-ls.linters"
+
+ formatters.setup(filetype, option)
+ linters.setup(filetype, option)
+end
+
+return M
diff --git a/.config/nvim/lua/lsp/null-ls/linters.lua b/.config/nvim/lua/lsp/null-ls/linters.lua
new file mode 100644
index 0000000..a0675a7
--- /dev/null
+++ b/.config/nvim/lua/lsp/null-ls/linters.lua
@@ -0,0 +1,77 @@
+local M = {}
+local linters_by_ft = {}
+
+local null_ls = require "null-ls"
+local services = require "lsp.null-ls.services"
+local logger = require("core.log"):get_default()
+
+local function list_names(linters, option)
+ option = option or {}
+ local filter = option.filter or "supported"
+
+ return vim.tbl_keys(linters[filter])
+end
+
+function M.list_supported_names(filetype)
+ if not linters_by_ft[filetype] then
+ return {}
+ end
+ return list_names(linters_by_ft[filetype], { filter = "supported" })
+end
+
+function M.list_unsupported_names(filetype)
+ if not linters_by_ft[filetype] then
+ return {}
+ end
+ return list_names(linters_by_ft[filetype], { filter = "unsupported" })
+end
+
+function M.list_available(filetype)
+ local linters = {}
+ for _, provider in pairs(null_ls.builtins.diagnostics) do
+ -- TODO: Add support for wildcard filetypes
+ if vim.tbl_contains(provider.filetypes or {}, filetype) then
+ table.insert(linters, provider.name)
+ end
+ end
+
+ return linters
+end
+
+function M.list_configured(linter_configs)
+ local linters, errors = {}, {}
+
+ for _, lnt_config in pairs(linter_configs) do
+ local linter = null_ls.builtins.diagnostics[lnt_config.exe]
+
+ if not linter then
+ logger.error("Not a valid linter:", lnt_config.exe)
+ errors[lnt_config.exe] = {} -- Add data here when necessary
+ else
+ local linter_cmd = services.find_command(linter._opts.command)
+ if not linter_cmd then
+ logger.warn("Not found:", linter._opts.command)
+ errors[lnt_config.exe] = {} -- Add data here when necessary
+ else
+ logger.info("Using linter:", linter_cmd)
+ linters[lnt_config.exe] = linter.with {
+ command = linter_cmd,
+ extra_args = lnt_config.args,
+ }
+ end
+ end
+ end
+
+ return { supported = linters, unsupported = errors }
+end
+
+function M.setup(filetype, option)
+ if linters_by_ft[filetype] and not option.force_reload then
+ return
+ end
+
+ linters_by_ft[filetype] = M.list_configured(options.lang[filetype].linters)
+ null_ls.register { sources = linters_by_ft[filetype].supported }
+end
+
+return M
diff --git a/.config/nvim/lua/lsp/null-ls/services.lua b/.config/nvim/lua/lsp/null-ls/services.lua
new file mode 100644
index 0000000..80bf66e
--- /dev/null
+++ b/.config/nvim/lua/lsp/null-ls/services.lua
@@ -0,0 +1,55 @@
+local M = {}
+
+local logger = require("core.log"):get_default()
+
+local function find_root_dir()
+ if options.builtin.rooter.active then
+ --- use vim-rooter to set root_dir
+ vim.cmd "let root_dir = FindRootDirectory()"
+ return vim.api.nvim_get_var "root_dir"
+ end
+
+ -- TODO: Rework this to not make it javascript specific
+ --- use LSP to set root_dir
+ local lsp_utils = require "lsp.utils"
+ local ts_client = lsp_utils.get_active_client_by_ft "typescript"
+ if ts_client == nil then
+ logger.error "Unable to determine root directory since tsserver didn't start correctly"
+ return nil
+ end
+
+ return ts_client.config.root_dir
+end
+
+local function from_node_modules(command)
+ local root_dir = find_root_dir()
+ if not root_dir then
+ return nil
+ end
+
+ return root_dir .. "/node_modules/.bin/" .. command
+end
+
+local local_providers = {
+ prettier = { find = from_node_modules },
+ prettierd = { find = from_node_modules },
+ prettier_d_slim = { find = from_node_modules },
+ eslint_d = { find = from_node_modules },
+ eslint = { find = from_node_modules },
+}
+
+function M.find_command(command)
+ if local_providers[command] then
+ local local_command = local_providers[command].find(command)
+ if local_command and vim.fn.executable(local_command) == 1 then
+ return local_command
+ end
+ end
+
+ if vim.fn.executable(command) == 1 then
+ return command
+ end
+ return nil
+end
+
+return M
diff --git a/.config/nvim/lua/lsp/peek.lua b/.config/nvim/lua/lsp/peek.lua
index cc8e57a..e4f4e1e 100644
--- a/.config/nvim/lua/lsp/peek.lua
+++ b/.config/nvim/lua/lsp/peek.lua
@@ -12,7 +12,8 @@ local function create_floating_file(location, opts)
-- Set some defaults
opts = opts or {}
- local close_events = opts.close_events or { "CursorMoved", "CursorMovedI", "BufHidden", "InsertCharPre" }
+ local close_events = opts.close_events
+ or { "CursorMoved", "CursorMovedI", "BufHidden", "InsertCharPre" }
-- location may be LocationLink or Location
local uri = location.targetUri or location.uri
@@ -29,7 +30,10 @@ local function create_floating_file(location, opts)
local contents = vim.api.nvim_buf_get_lines(
bufnr,
range.start.line,
- math.min(range["end"].line + 1 + (opts.context or 10), range.start.line + (opts.max_height or 15)), -- Don't let the window be more that 15 lines long(height)
+ math.min(
+ range["end"].line + 1 + (opts.context or 10),
+ range.start.line + (opts.max_height or 15)
+ ), -- Don't let the window be more that 15 lines long(height)
false
)
local width, height = vim.lsp.util._make_floating_popup_size(contents, opts)
@@ -46,7 +50,9 @@ local function create_floating_file(location, opts)
-- Set some autocmds to close the window
vim.api.nvim_command(
- "autocmd QuitPre <buffer> ++nested ++once lua pcall(vim.api.nvim_win_close, " .. winnr .. ", true)"
+ "autocmd QuitPre <buffer> ++nested ++once lua pcall(vim.api.nvim_win_close, "
+ .. winnr
+ .. ", true)"
)
vim.lsp.util.close_preview_autocmd(close_events, winnr)
@@ -128,10 +134,18 @@ function M.Peek(what)
else
-- Make a new request and then create the new window in the callback
local params = vim.lsp.util.make_position_params()
- local success, _ = pcall(vim.lsp.buf_request, 0, "textDocument/" .. what, params, preview_location_callback)
+ local success, _ = pcall(
+ vim.lsp.buf_request,
+ 0,
+ "textDocument/" .. what,
+ params,
+ preview_location_callback
+ )
if not success then
print(
- 'peek: Error calling LSP method "textDocument/' .. what .. '". The current language lsp might not support it.'
+ 'peek: Error calling LSP method "textDocument/'
+ .. what
+ .. '". The current language lsp might not support it.'
)
end
end
diff --git a/.config/nvim/lua/lsp/utils.lua b/.config/nvim/lua/lsp/utils.lua
new file mode 100644
index 0000000..af265de
--- /dev/null
+++ b/.config/nvim/lua/lsp/utils.lua
@@ -0,0 +1,27 @@
+local M = {}
+
+function M.is_client_active(name)
+ local clients = vim.lsp.get_active_clients()
+ for _, client in pairs(clients) do
+ if client.name == name then
+ return true
+ end
+ end
+ return false
+end
+
+function M.get_active_client_by_ft(filetype)
+ if not options.lang[filetype] or not options.lang[filetype].lsp then
+ return nil
+ end
+
+ local clients = vim.lsp.get_active_clients()
+ for _, client in pairs(clients) do
+ if client.name == options.lang[filetype].lsp.provider then
+ return client
+ end
+ end
+ return nil
+end
+
+return M
diff --git a/.config/nvim/lua/plugin-loader.lua b/.config/nvim/lua/plugin-loader.lua
index 4cf72c8..cbe849b 100644
--- a/.config/nvim/lua/plugin-loader.lua
+++ b/.config/nvim/lua/plugin-loader.lua
@@ -23,7 +23,7 @@ function plugin_loader:init()
git = { clone_timeout = 300 },
display = {
open_fn = function()
- return util.float { border = "single" }
+ return util.float { border = "rounded" }
end,
},
}
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 14960ee..ded8fe6 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -18,7 +18,6 @@ return {
{ "nvim-lua/popup.nvim" },
{ "nvim-lua/plenary.nvim" },
- { "tjdevries/astronauta.nvim" },
-- Telescope
{
diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua
index 1176e3b..3cea053 100644
--- a/.config/nvim/lua/utils/init.lua
+++ b/.config/nvim/lua/utils/init.lua
@@ -99,57 +99,11 @@ function utils.reload_config()
vim.cmd ":PackerCompile"
vim.cmd ":PackerInstall"
-- vim.cmd ":PackerClean"
+ local null_ls = require "lsp.null-ls"
+ null_ls.setup(vim.bo.filetype, { force_reload = true })
Log:get_default().info "Reloaded configuration"
end
-function utils.check_lsp_client_active(name)
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- if client.name == name then
- return true
- end
- end
- return false
-end
-
-function utils.get_active_client_by_ft(filetype)
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- if client.name == options.lang[filetype].lsp.provider then
- return client
- end
- end
- return nil
-end
-
--- TODO: consider porting this logic to null-ls instead
-function utils.get_supported_linters_by_filetype(filetype)
- local null_ls = require "null-ls"
- local matches = {}
- for _, provider in pairs(null_ls.builtins.diagnostics) do
- if vim.tbl_contains(provider.filetypes, filetype) then
- local provider_name = provider.name
-
- table.insert(matches, provider_name)
- end
- end
-
- return matches
-end
-
-function utils.get_supported_formatters_by_filetype(filetype)
- local null_ls = require "null-ls"
- local matches = {}
- for _, provider in pairs(null_ls.builtins.formatting) do
- if provider.filetypes and vim.tbl_contains(provider.filetypes, filetype) then
- -- table.insert(matches, { provider.name, ft })
- table.insert(matches, provider.name)
- end
- end
-
- return matches
-end
-
function utils.unrequire(m)
package.loaded[m] = nil
_G[m] = nil