php.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. local M = {}
  2. M.config = function()
  3. -- TODO: implement config for language
  4. return "No config available!"
  5. end
  6. M.format = function()
  7. O.formatters.filetype["php"] = {
  8. function()
  9. return {
  10. exe = O.lang.php.formatter.exe,
  11. args = O.lang.php.formatter.args,
  12. stdin = not (O.lang.php.formatter.stdin ~= nil),
  13. }
  14. end,
  15. }
  16. require("formatter.config").set_defaults {
  17. logging = false,
  18. filetype = O.formatters.filetype,
  19. }
  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 require("lv-utils").check_lsp_client_active "intelephense" then
  27. return
  28. end
  29. require("lspconfig").intelephense.setup {
  30. cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
  31. on_attach = require("lsp").common_on_attach,
  32. handlers = {
  33. ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
  34. virtual_text = O.lang.php.diagnostics.virtual_text,
  35. signs = O.lang.php.diagnostics.signs,
  36. underline = O.lang.php.diagnostics.underline,
  37. update_in_insert = true,
  38. }),
  39. },
  40. filetypes = O.lang.php.filetypes,
  41. settings = {
  42. intelephense = {
  43. format = {
  44. braces = O.lang.php.format.braces,
  45. },
  46. environment = {
  47. phpVersion = O.lang.php.environment.php_version,
  48. },
  49. },
  50. },
  51. }
  52. end
  53. M.dap = function()
  54. -- TODO: implement dap
  55. return "No DAP configured!"
  56. end
  57. return M