php.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. O.formatters.filetype["php"] = {
  2. function()
  3. return {
  4. exe = O.lang.php.formatter.exe,
  5. args = O.lang.php.formatter.args,
  6. stdin = not (O.lang.php.formatter.stdin ~= nil),
  7. }
  8. end,
  9. }
  10. require("formatter.config").set_defaults {
  11. logging = false,
  12. filetype = O.formatters.filetype,
  13. }
  14. if require("lv-utils").check_lsp_client_active "intelephense" then
  15. return
  16. end
  17. require("lspconfig").intelephense.setup {
  18. cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
  19. on_attach = require("lsp").common_on_attach,
  20. handlers = {
  21. ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
  22. virtual_text = O.lang.php.diagnostics.virtual_text,
  23. signs = O.lang.php.diagnostics.signs,
  24. underline = O.lang.php.diagnostics.underline,
  25. update_in_insert = true,
  26. }),
  27. },
  28. filetypes = O.lang.php.filetypes,
  29. settings = {
  30. intelephense = {
  31. format = {
  32. braces = O.lang.php.format.braces,
  33. },
  34. environment = {
  35. phpVersion = O.lang.php.environment.php_version,
  36. },
  37. },
  38. },
  39. }