Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate: from efm to null-ls ( #500 #504 ) #513

Merged
merged 27 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8c2205c
migrate: from `efm` to `null-ls`
CharlesChiuGit Feb 12, 2023
6de17c3
sync: use `nvim_buf_set_keymap` for filetype
CharlesChiuGit Feb 12, 2023
85cd6fc
clean up
CharlesChiuGit Feb 12, 2023
d5b6137
sync: rename `sumneko_lua` to `lua_ls`
CharlesChiuGit Feb 13, 2023
4e8e9ea
clean up
CharlesChiuGit Feb 13, 2023
dbd6a9d
chore: move `html_ls` to `mason_lspconfig.setup`
CharlesChiuGit Feb 13, 2023
12db5af
chore: move formatter argss to `null-ls.lua`
CharlesChiuGit Feb 13, 2023
e3a8ea9
sync(lua_ls): disable server-side formatting, use null-ls instead
CharlesChiuGit Feb 13, 2023
1b9d180
clean up
CharlesChiuGit Feb 13, 2023
35881ef
feat(mason-tool-installer): add notify after mason installation finished
CharlesChiuGit Feb 13, 2023
4b4ac04
chore(mason-tool-installer): set `run_on_start` to false
CharlesChiuGit Feb 13, 2023
438168f
chore(mason-lspconfig): add mason-lspconfig mapping list url
CharlesChiuGit Feb 13, 2023
7d7881b
chore: remove unnecessary part for `prettierd`
CharlesChiuGit Feb 14, 2023
76e93aa
migrate: from `mason-tool-installer` to `mason-null-ls`
CharlesChiuGit Feb 14, 2023
590b9f5
feat: add `jq` for json formatting
CharlesChiuGit Feb 14, 2023
156893a
clean up
CharlesChiuGit Feb 14, 2023
2c0185d
sync: add/replace plugins ( #514 )
CharlesChiuGit Feb 14, 2023
49a12a6
merge: `aya/main` to `migrate/null-ls`
CharlesChiuGit Feb 14, 2023
8f67bc9
Merge branch 'main' into migrate/null-ls
CharlesChiuGit Feb 16, 2023
67e98be
chore(clang-format): remove extra args
CharlesChiuGit Feb 16, 2023
ef974bf
revert: add `formatting.lua` back
CharlesChiuGit Feb 16, 2023
2ff5d96
refactor: move `lsp` and `null-ls` sources to `core/settings.lua`
CharlesChiuGit Feb 16, 2023
961f8a6
chore(mason-null-ls): use auto-`setup_handlers` for default config
CharlesChiuGit Feb 17, 2023
930d3ca
perf: use only `mason-null-ls` to setup sources to prevent overwrite.
CharlesChiuGit Feb 17, 2023
867422b
chore(null-ls): better diagnostics_format
CharlesChiuGit Feb 17, 2023
8fbf3c3
typo
CharlesChiuGit Feb 17, 2023
9a7f480
Merge branch 'main' into migrate/null-ls
CharlesChiuGit Feb 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lua/modules/configs/completion/efm/formatters/clangfmt.lua

This file was deleted.

1 change: 0 additions & 1 deletion lua/modules/configs/completion/efm/formatters/rustfmt.lua

This file was deleted.

182 changes: 0 additions & 182 deletions lua/modules/configs/completion/formatting.lua

This file was deleted.

84 changes: 10 additions & 74 deletions lua/modules/configs/completion/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
return function()
local formatting = require("completion.formatting")

local nvim_lsp = require("lspconfig")
local mason = require("mason")
local mason_lspconfig = require("mason-lspconfig")
Expand Down Expand Up @@ -33,13 +31,15 @@ return function()
},
})
mason_lspconfig.setup({
-- NOTE: use the lsp names in nvim-lspconfig
-- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/lua/mason-lspconfig/mappings/server.lua
ensure_installed = {
"bashls",
"clangd",
"efm",
"gopls",
"pyright",
"html",
"lua_ls",
"pyright",
},
})

Expand Down Expand Up @@ -85,16 +85,18 @@ return function()
nvim_lsp.clangd.setup(final_opts)
end,

efm = function()
-- Do not setup efm
end,

gopls = function()
local _opts = require("completion.servers.gopls")
local final_opts = vim.tbl_deep_extend("keep", _opts, opts)
nvim_lsp.gopls.setup(final_opts)
end,

html = function()
local _opts = require("completion.servers.html")
local final_opts = vim.tbl_deep_extend("keep", _opts, opts)
nvim_lsp.html.setup(final_opts)
end,

jsonls = function()
local _opts = require("completion.servers.jsonls")
local final_opts = vim.tbl_deep_extend("keep", _opts, opts)
Expand All @@ -107,70 +109,4 @@ return function()
nvim_lsp.lua_ls.setup(final_opts)
end,
})

if vim.fn.executable("html-languageserver") then
local _opts = require("completion.servers.html")
local final_opts = vim.tbl_deep_extend("keep", _opts, opts)
nvim_lsp.html.setup(final_opts)
end

local efmls = require("efmls-configs")

-- Init `efm-langserver` here.

efmls.init({
on_attach = opts.on_attach,
capabilities = capabilities,
init_options = { documentFormatting = true, codeAction = true },
})

-- Require `efmls-configs-nvim`'s config here

local vint = require("efmls-configs.linters.vint")
local eslint = require("efmls-configs.linters.eslint")
local flake8 = require("efmls-configs.linters.flake8")

local black = require("efmls-configs.formatters.black")
local stylua = require("efmls-configs.formatters.stylua")
local prettier = require("efmls-configs.formatters.prettier")
local shfmt = require("efmls-configs.formatters.shfmt")

-- Add your own config for formatter and linter here

-- local rustfmt = require("completion.efm.formatters.rustfmt")
local clangfmt = require("completion.efm.formatters.clangfmt")

-- Override default config here

flake8 = vim.tbl_extend("force", flake8, {
prefix = "flake8: max-line-length=160, ignore F403 and F405",
lintStdin = true,
lintIgnoreExitCode = true,
lintFormats = { "%f:%l:%c: %t%n%n%n %m" },
lintCommand = "flake8 --max-line-length 160 --extend-ignore F403,F405 --format '%(path)s:%(row)d:%(col)d: %(code)s %(code)s %(text)s' --stdin-display-name ${INPUT} -",
})

-- Setup formatter and linter for efmls here

efmls.setup({
vim = { formatter = vint },
lua = { formatter = stylua },
c = { formatter = clangfmt },
cpp = { formatter = clangfmt },
python = { formatter = black },
vue = { formatter = prettier },
typescript = { formatter = prettier, linter = eslint },
javascript = { formatter = prettier, linter = eslint },
typescriptreact = { formatter = prettier, linter = eslint },
javascriptreact = { formatter = prettier, linter = eslint },
yaml = { formatter = prettier },
html = { formatter = prettier },
css = { formatter = prettier },
scss = { formatter = prettier },
sh = { formatter = shfmt },
markdown = { formatter = prettier },
-- rust = {formatter = rustfmt},
})

formatting.configure_format_on_save()
end
32 changes: 0 additions & 32 deletions lua/modules/configs/completion/mason-tool-installer.lua

This file was deleted.

Loading