zsh.lua 1022 B

1234567891011121314151617181920212223242526272829303132333435
  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. filetypes = { "zsh" },
  24. settings = {
  25. rootMarkers = { ".git/" },
  26. languages = {
  27. sh = sh_arguments,
  28. },
  29. },
  30. }
  31. end