summaryrefslogtreecommitdiff
path: root/lua/lang/php.lua
diff options
context:
space:
mode:
authorchristianchiarulli <[email protected]>2021-07-14 18:50:07 -0400
committerchristianchiarulli <[email protected]>2021-07-14 18:50:07 -0400
commit2a7b3d4892605508d0b0328444d689e1c4922897 (patch)
treebc43127c8c01edbac4871813433f18d7d23942d6 /lua/lang/php.lua
parent81adc270dd674b2f3da19340f0c34d60d8667542 (diff)
reformat most langs
Diffstat (limited to 'lua/lang/php.lua')
-rw-r--r--lua/lang/php.lua65
1 files changed, 65 insertions, 0 deletions
diff --git a/lua/lang/php.lua b/lua/lang/php.lua
new file mode 100644
index 00000000..019f3a94
--- /dev/null
+++ b/lua/lang/php.lua
@@ -0,0 +1,65 @@
+local M = {}
+
+M.config = function()
+ -- TODO: implement config for language
+ return "No config available!"
+end
+
+M.format = function()
+ O.formatters.filetype["php"] = {
+ function()
+ return {
+ exe = O.lang.php.formatter.exe,
+ args = O.lang.php.formatter.args,
+ stdin = not (O.lang.php.formatter.stdin ~= nil),
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("lv-utils").check_lsp_client_active "intelephense" then
+ return
+ end
+
+ require("lspconfig").intelephense.setup {
+ cmd = { DATA_PATH .. "/lspinstall/php/node_modules/.bin/intelephense", "--stdio" },
+ on_attach = require("lsp").common_on_attach,
+ handlers = {
+ ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
+ virtual_text = O.lang.php.diagnostics.virtual_text,
+ signs = O.lang.php.diagnostics.signs,
+ underline = O.lang.php.diagnostics.underline,
+ update_in_insert = true,
+ }),
+ },
+ filetypes = O.lang.php.filetypes,
+ settings = {
+ intelephense = {
+ format = {
+ braces = O.lang.php.format.braces,
+ },
+ environment = {
+ phpVersion = O.lang.php.environment.php_version,
+ },
+ },
+ },
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M