zsh.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. local M = {}
  2. M.config = function()
  3. O.lang.zsh = {
  4. lsp = {
  5. path = DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server",
  6. },
  7. }
  8. end
  9. M.format = function()
  10. -- TODO: implement format for language
  11. return "No format available!"
  12. end
  13. M.lint = function()
  14. -- zsh
  15. local zsh_arguments = {}
  16. if not require("lv-utils").check_lsp_client_active "efm" then
  17. require("lspconfig").efm.setup {
  18. -- init_options = {initializationOptions},
  19. cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
  20. init_options = { documentFormatting = true, codeAction = false },
  21. root_dir = require("lspconfig").util.root_pattern ".git/",
  22. filetypes = { "zsh" },
  23. settings = {
  24. rootMarkers = { ".git/" },
  25. languages = {
  26. zsh = zsh_arguments,
  27. },
  28. },
  29. }
  30. end
  31. end
  32. M.lsp = function()
  33. if not require("lv-utils").check_lsp_client_active "bashls" then
  34. -- npm i -g bash-language-server
  35. require("lspconfig").bashls.setup {
  36. cmd = { O.lang.zsh.lsp.path, "start" },
  37. on_attach = require("lsp").common_on_attach,
  38. filetypes = { "sh", "zsh" },
  39. }
  40. end
  41. end
  42. M.dap = function()
  43. -- TODO: implement dap
  44. return "No DAP configured!"
  45. end
  46. return M