feat: Add php lang

This commit is contained in:
Dev'A'Lot 2023-12-25 00:07:15 +11:00
parent 879e29504d
commit cf3b4d8792
No known key found for this signature in database
2 changed files with 171 additions and 0 deletions

View file

@ -0,0 +1,88 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"php",
})
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
intelephense = {
cmd = { "intelephense", "--stdio" },
filetypes = { "php" },
root_dir = require("lspconfig.util").root_pattern("composer.json", ".git"),
},
phpactor = {
cmd = { "phpactor", "language-server" },
filetypes = { "php" },
root_dir = require("lspconfig.util").root_pattern("composer.json", ".git"),
},
},
},
},
-- Ensure PHP tools are installed
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "intelephense", "phpactor", "phpcbf" })
end,
},
{
"nvimtools/none-ls.nvim",
optional = true,
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "phpcbf" })
end,
},
},
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.formatting.phpcbf,
})
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
php = { "phpcbf" },
},
},
},
{
"mfussenegger/nvim-dap",
optional = true,
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "php-debug-adapter" })
end,
},
},
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
"olimorris/neotest-phpunit",
},
opts = {
adapters = {
["neotest-phpunit"] = {},
},
},
},
}

View file

@ -0,0 +1,83 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"php",
})
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
intelephense = {
cmd = { "intelephense", "--stdio" },
filetypes = { "php" },
root_dir = require("lspconfig.util").root_pattern("composer.json", ".git"),
},
},
},
},
-- Ensure PHP tools are installed
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "intelephense", "phpcbf" })
end,
},
{
"nvimtools/none-ls.nvim",
optional = true,
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "phpcbf" })
end,
},
},
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.formatting.phpcbf,
})
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
php = { "phpcbf" },
},
},
},
{
"mfussenegger/nvim-dap",
optional = true,
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "php-debug-adapter" })
end,
},
},
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
"olimorris/neotest-phpunit",
},
opts = {
adapters = {
["neotest-phpunit"] = {},
},
},
},
}