mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-21 02:55:09 +02:00
more language reformat (#949)
This commit is contained in:
parent
2a7b3d4892
commit
e6de44e444
8 changed files with 116 additions and 89 deletions
|
@ -1,10 +1,5 @@
|
||||||
if require("lv-utils").check_lsp_client_active "vuels" then
|
require("lamg.vue").format()
|
||||||
return
|
require("lamg.vue").lint()
|
||||||
end
|
require("lamg.vue").lsp()
|
||||||
|
require("lamg.vue").dap()
|
||||||
|
|
||||||
-- Vue language server configuration (vetur)
|
|
||||||
require("lspconfig").vuels.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
root_dir = require("lspconfig").util.root_pattern(".git", "vue.config.js", "package.json", "yarn.lock"),
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,24 +1,5 @@
|
||||||
O.formatters.filetype["yaml"] = {
|
require("lamg.yaml").format()
|
||||||
function()
|
require("lamg.yaml").lint()
|
||||||
return {
|
require("lamg.yaml").lsp()
|
||||||
exe = O.lang.yaml.formatter.exe,
|
require("lamg.yaml").dap()
|
||||||
args = O.lang.yaml.formatter.args,
|
|
||||||
stdin = not (O.lang.yaml.formatter.stdin ~= nil),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("formatter.config").set_defaults {
|
|
||||||
logging = false,
|
|
||||||
filetype = O.formatters.filetype,
|
|
||||||
}
|
|
||||||
if require("lv-utils").check_lsp_client_active "yamlls" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- npm install -g yaml-language-server
|
|
||||||
require("lspconfig").yamlls.setup {
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio" },
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
}
|
|
||||||
vim.cmd "setl ts=2 sw=2 ts=2 ai et"
|
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
if not require("lv-utils").check_lsp_client_active "zls" then
|
require("lang.zig").format()
|
||||||
-- Because lspinstall don't support zig yet,
|
require("lang.zig").lint()
|
||||||
-- So we need zls preset in global lib
|
require("lang.zig").lsp()
|
||||||
-- Further custom install zls in
|
require("lang.zig").dap()
|
||||||
-- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
|
|
||||||
require("lspconfig").zls.setup {
|
|
||||||
root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
|
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lv-utils").define_augroups {
|
|
||||||
_zig_autoformat = {
|
|
||||||
{ "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
vim.cmd "setl expandtab tabstop=8 softtabstop=4 shiftwidth=4"
|
|
||||||
|
|
|
@ -1,36 +1,4 @@
|
||||||
if not require("lv-utils").check_lsp_client_active "bashls" then
|
require("lang.zsh").format()
|
||||||
-- npm i -g bash-language-server
|
require("lang.zsh").lint()
|
||||||
require("lspconfig").bashls.setup {
|
require("lang.zsh").lsp()
|
||||||
cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
|
require("lang.zsh").dap()
|
||||||
on_attach = require("lsp").common_on_attach,
|
|
||||||
filetypes = { "sh", "zsh" },
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- sh
|
|
||||||
local sh_arguments = {}
|
|
||||||
|
|
||||||
local shellcheck = {
|
|
||||||
LintCommand = "shellcheck -f gcc -x",
|
|
||||||
lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" },
|
|
||||||
}
|
|
||||||
|
|
||||||
if O.lang.sh.linter == "shellcheck" then
|
|
||||||
table.insert(sh_arguments, shellcheck)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not require("lv-utils").check_lsp_client_active "efm" then
|
|
||||||
require("lspconfig").efm.setup {
|
|
||||||
-- init_options = {initializationOptions},
|
|
||||||
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
|
||||||
init_options = { documentFormatting = true, codeAction = false },
|
|
||||||
root_dir = require("lspconfig").util.root_pattern ".git/",
|
|
||||||
filetypes = { "zsh" },
|
|
||||||
settings = {
|
|
||||||
rootMarkers = { ".git/" },
|
|
||||||
languages = {
|
|
||||||
sh = sh_arguments,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
|
@ -15,7 +15,18 @@ M.lint = function()
|
||||||
return "No linters configured!"
|
return "No linters configured!"
|
||||||
end
|
end
|
||||||
|
|
||||||
M.lsp = function() end
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "vuels" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Vue language server configuration (vetur)
|
||||||
|
require("lspconfig").vuels.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls", "--stdio" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
root_dir = require("lspconfig").util.root_pattern(".git", "vue.config.js", "package.json", "yarn.lock"),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
M.dap = function()
|
M.dap = function()
|
||||||
-- TODO: implement dap
|
-- TODO: implement dap
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.config = function()
|
M.config = function()
|
||||||
-- TODO: implement config for language
|
O.formatters.filetype["yaml"] = {
|
||||||
return "No config available!"
|
function()
|
||||||
|
return {
|
||||||
|
exe = O.lang.yaml.formatter.exe,
|
||||||
|
args = O.lang.yaml.formatter.args,
|
||||||
|
stdin = not (O.lang.yaml.formatter.stdin ~= nil),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
require("formatter.config").set_defaults {
|
||||||
|
logging = false,
|
||||||
|
filetype = O.formatters.filetype,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
M.format = function()
|
M.format = function()
|
||||||
|
@ -15,7 +26,17 @@ M.lint = function()
|
||||||
return "No linters configured!"
|
return "No linters configured!"
|
||||||
end
|
end
|
||||||
|
|
||||||
M.lsp = function() end
|
M.lsp = function()
|
||||||
|
if require("lv-utils").check_lsp_client_active "yamlls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- npm install -g yaml-language-server
|
||||||
|
require("lspconfig").yamlls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
M.dap = function()
|
M.dap = function()
|
||||||
-- TODO: implement dap
|
-- TODO: implement dap
|
||||||
|
|
|
@ -15,7 +15,20 @@ M.lint = function()
|
||||||
return "No linters configured!"
|
return "No linters configured!"
|
||||||
end
|
end
|
||||||
|
|
||||||
M.lsp = function() end
|
M.lsp = function()
|
||||||
|
|
||||||
|
if require("lv-utils").check_lsp_client_active "zls" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- Because lspinstall don't support zig yet,
|
||||||
|
-- So we need zls preset in global lib
|
||||||
|
-- Further custom install zls in
|
||||||
|
-- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
|
||||||
|
require("lspconfig").zls.setup {
|
||||||
|
root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
M.dap = function()
|
M.dap = function()
|
||||||
-- TODO: implement dap
|
-- TODO: implement dap
|
||||||
|
|
50
lua/lang/zsh.lua
Normal file
50
lua/lang/zsh.lua
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.config = function()
|
||||||
|
-- TODO: implement config for language
|
||||||
|
return "No config available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.format = function()
|
||||||
|
-- TODO: implement format for language
|
||||||
|
return "No format available!"
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lint = function()
|
||||||
|
-- zsh
|
||||||
|
local zsh_arguments = {}
|
||||||
|
|
||||||
|
if not require("lv-utils").check_lsp_client_active "efm" then
|
||||||
|
require("lspconfig").efm.setup {
|
||||||
|
-- init_options = {initializationOptions},
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
||||||
|
init_options = { documentFormatting = true, codeAction = false },
|
||||||
|
root_dir = require("lspconfig").util.root_pattern ".git/",
|
||||||
|
filetypes = { "zsh" },
|
||||||
|
settings = {
|
||||||
|
rootMarkers = { ".git/" },
|
||||||
|
languages = {
|
||||||
|
zsh = zsh_arguments,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp = function()
|
||||||
|
if not require("lv-utils").check_lsp_client_active "bashls" then
|
||||||
|
-- npm i -g bash-language-server
|
||||||
|
require("lspconfig").bashls.setup {
|
||||||
|
cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
|
||||||
|
on_attach = require("lsp").common_on_attach,
|
||||||
|
filetypes = { "sh", "zsh" },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap = function()
|
||||||
|
-- TODO: implement dap
|
||||||
|
return "No DAP configured!"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Loading…
Reference in a new issue