go.lua 866 B

1234567891011121314151617181920212223242526272829
  1. O.formatters.filetype["go"] = {
  2. function()
  3. return {
  4. exe = O.lang.go.formatter.exe,
  5. args = O.lang.go.formatter.args,
  6. stdin = not (O.lang.go.formatter.stdin ~= nil),
  7. }
  8. end,
  9. }
  10. require("formatter.config").set_defaults {
  11. logging = false,
  12. filetype = O.formatters.filetype,
  13. }
  14. if not require("lv-utils").check_lsp_client_active "gopls" then
  15. require("lspconfig").gopls.setup {
  16. cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
  17. settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
  18. root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
  19. init_options = { usePlaceholders = true, completeUnimported = true },
  20. on_attach = require("lsp").common_on_attach,
  21. }
  22. end
  23. vim.opt_local.tabstop = 4
  24. vim.opt_local.shiftwidth = 4
  25. vim.opt_local.softtabstop = 4
  26. vim.opt_local.expandtab = false