html.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. local M = {}
  2. M.config = function()
  3. O.lang.html = {
  4. linters = {
  5. "tidy",
  6. -- https://docs.errata.ai/vale/scoping#html
  7. "vale",
  8. },
  9. lsp = {
  10. path = DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
  11. },
  12. }
  13. end
  14. M.format = function()
  15. -- TODO: implement formatters (if applicable)
  16. return "No formatters configured!"
  17. end
  18. M.lint = function()
  19. require("lint").linters_by_ft = {
  20. html = O.lang.html.linters,
  21. }
  22. end
  23. M.lsp = function()
  24. if not require("lv-utils").check_lsp_client_active "html" then
  25. -- npm install -g vscode-html-languageserver-bin
  26. local capabilities = vim.lsp.protocol.make_client_capabilities()
  27. capabilities.textDocument.completion.completionItem.snippetSupport = true
  28. require("lspconfig").html.setup {
  29. cmd = {
  30. "node",
  31. O.lang.html.lsp.path,
  32. "--stdio",
  33. },
  34. on_attach = require("lsp").common_on_attach,
  35. capabilities = capabilities,
  36. }
  37. end
  38. end
  39. M.dap = function()
  40. -- TODO: implement dap
  41. return "No DAP configured!"
  42. end
  43. return M