swift.lua 976 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. local M = {}
  2. M.config = function()
  3. O.lang.swift = {
  4. formatter = {
  5. exe = "swiftformat",
  6. args = {},
  7. stdin = true,
  8. },
  9. }
  10. end
  11. M.format = function()
  12. -- TODO: implement formatter (if applicable)
  13. return "No formatter configured!"
  14. end
  15. M.lint = function()
  16. O.formatters.filetype["swift"] = {
  17. function()
  18. return {
  19. exe = O.lang.swift.formatter.exe,
  20. args = O.lang.swift.formatter.args,
  21. stdin = O.lang.swift.formatter.stdin,
  22. }
  23. end,
  24. }
  25. require("formatter.config").set_defaults {
  26. logging = false,
  27. filetype = O.formatters.filetype,
  28. }
  29. end
  30. M.lsp = function()
  31. if require("lv-utils").check_lsp_client_active "sourcekit" then
  32. return
  33. end
  34. require("lspconfig").sourcekit.setup {
  35. cmd = { "xcrun", "sourcekit-lsp" },
  36. on_attach = require("lsp").common_on_attach,
  37. filetypes = { "swift" },
  38. }
  39. end
  40. M.dap = function()
  41. -- TODO: implement dap
  42. return "No DAP configured!"
  43. end
  44. return M