elm.lua 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. local M = {}
  2. M.config = function()
  3. local elm_bin = DATA_PATH .. "/lspinstall/elm/node_modules/.bin"
  4. O.lang.elm = {
  5. lsp = {
  6. path = elm_bin .. "/elm-language-server",
  7. format = elm_bin .. "/elm-format",
  8. root = elm_bin,
  9. test = elm_bin .. "/elm-test",
  10. },
  11. }
  12. end
  13. M.format = function()
  14. -- TODO: implement formatter for language
  15. return "No formatter available!"
  16. end
  17. M.lint = function()
  18. -- TODO: implement linters (if applicable)
  19. return "No linters configured!"
  20. end
  21. M.lsp = function()
  22. if require("lv-utils").check_lsp_client_active "elmls" then
  23. return
  24. end
  25. require("lspconfig").elmls.setup {
  26. cmd = { O.lang.elm.lsp.path },
  27. on_attach = require("lsp").common_on_attach,
  28. init_options = {
  29. elmAnalyseTrigger = "change",
  30. elmFormatPath = O.lang.elm.lsp.format,
  31. elmPath = O.lang.elm.lsp.root,
  32. elmTestPath = O.lang.elm.lsp.test,
  33. },
  34. }
  35. end
  36. M.dap = function()
  37. -- TODO: implement dap
  38. return "No DAP configured!"
  39. end
  40. return M