go.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. local M = {}
  2. M.config = function()
  3. O.formatters.filetype["go"] = {
  4. function()
  5. return {
  6. exe = O.lang.go.formatter.exe,
  7. args = O.lang.go.formatter.args,
  8. stdin = not (O.lang.go.formatter.stdin ~= nil),
  9. }
  10. end,
  11. }
  12. require("formatter.config").set_defaults {
  13. logging = false,
  14. filetype = O.formatters.filetype,
  15. }
  16. end
  17. M.format = function()
  18. -- TODO: implement formatter for language
  19. return "No formatter available!"
  20. end
  21. M.lint = function()
  22. -- TODO: implement linters (if applicable)
  23. return "No linters configured!"
  24. end
  25. M.lsp = function()
  26. if not require("lv-utils").check_lsp_client_active "gopls" then
  27. require("lspconfig").gopls.setup {
  28. cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
  29. settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
  30. root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
  31. init_options = { usePlaceholders = true, completeUnimported = true },
  32. on_attach = require("lsp").common_on_attach,
  33. }
  34. end
  35. end
  36. M.dap = function()
  37. -- TODO: implement dap
  38. return "No DAP configured!"
  39. end
  40. return M