diff options
author | Abouzar Parvan <[email protected]> | 2021-07-15 05:18:05 +0430 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-14 20:48:05 -0400 |
commit | e6de44e4443042dc14d34e36dd8ee8528f4936f2 (patch) | |
tree | d600f814c33e9154bbb3fdde0dfda6e75b071483 /lua | |
parent | 2a7b3d4892605508d0b0328444d689e1c4922897 (diff) |
more language reformat (#949)
Diffstat (limited to 'lua')
-rw-r--r-- | lua/lang/vue.lua | 13 | ||||
-rw-r--r-- | lua/lang/yaml.lua | 27 | ||||
-rw-r--r-- | lua/lang/zig.lua | 15 | ||||
-rw-r--r-- | lua/lang/zsh.lua | 50 |
4 files changed, 100 insertions, 5 deletions
diff --git a/lua/lang/vue.lua b/lua/lang/vue.lua index 178c6f54..8fd2af7e 100644 --- a/lua/lang/vue.lua +++ b/lua/lang/vue.lua @@ -15,7 +15,18 @@ M.lint = function() return "No linters configured!" 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() -- TODO: implement dap diff --git a/lua/lang/yaml.lua b/lua/lang/yaml.lua index 178c6f54..bedf9af2 100644 --- a/lua/lang/yaml.lua +++ b/lua/lang/yaml.lua @@ -1,8 +1,19 @@ local M = {} M.config = function() - -- TODO: implement config for language - return "No config available!" + O.formatters.filetype["yaml"] = { + 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 M.format = function() @@ -15,7 +26,17 @@ M.lint = function() return "No linters configured!" 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() -- TODO: implement dap diff --git a/lua/lang/zig.lua b/lua/lang/zig.lua index 178c6f54..1da329f5 100644 --- a/lua/lang/zig.lua +++ b/lua/lang/zig.lua @@ -15,7 +15,20 @@ M.lint = function() return "No linters configured!" 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() -- TODO: implement dap diff --git a/lua/lang/zsh.lua b/lua/lang/zsh.lua new file mode 100644 index 00000000..c81bd96c --- /dev/null +++ b/lua/lang/zsh.lua @@ -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 |