zsh.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. if not require("lv-utils").check_lsp_client_active "bashls" then
  2. -- npm i -g bash-language-server
  3. require("lspconfig").bashls.setup {
  4. cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
  5. on_attach = require("lsp").common_on_attach,
  6. filetypes = { "sh", "zsh" },
  7. }
  8. end
  9. -- sh
  10. local sh_arguments = {}
  11. local shellcheck = {
  12. LintCommand = "shellcheck -f gcc -x",
  13. lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" },
  14. }
  15. if O.lang.sh.linter == "shellcheck" then
  16. table.insert(sh_arguments, shellcheck)
  17. end
  18. if not require("lv-utils").check_lsp_client_active "efm" then
  19. require("lspconfig").efm.setup {
  20. -- init_options = {initializationOptions},
  21. cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
  22. init_options = { documentFormatting = true, codeAction = false },
  23. root_dir = require("lspconfig").util.root_pattern ".git/",
  24. filetypes = { "zsh" },
  25. settings = {
  26. rootMarkers = { ".git/" },
  27. languages = {
  28. sh = sh_arguments,
  29. },
  30. },
  31. }
  32. end