Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pack): add laravel.nvim #1108

Merged
merged 7 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lua/astrocommunity/pack/laravel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Laravel Pack

**Note:** Installation of `phpactor` requires `composer`
**Note:** `laravel-dev-generators` in your path. See the releases section of https://github.com/haringsrob/laravel-dev-tool
**Note:** For proper blade template highlighting, you'll need to update the queries file https://github.com/EmranMR/tree-sitter-blade/discussions/20

This plugin pack does the following:

- Adds [php pack](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/pack/php)
- Adds php and phpdoc Treesitter parsers
- Adds phpactor language servers
- Adds php-cs-fixer for formatting
- Adds php-debug-adapter for debugging
- Adds [blade pack](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/pack/blade)
- Adds blade Treesitter parser: https://github.com/EmranMR/tree-sitter-blade
- Adds blade language server: https://github.com/haringsrob/laravel-dev-tools
- Adds blade-formatter to null-ls or conform
- Adds `laravel.nvim` for laravel specific tools
- Adds `laravel-ide-helper.nvim` for laravel model info
- Adds `blade-nav.nvim` for cmp and gf for views/routes/configs and more
- Adds `vim-test` for PHPUit and Pest test support
89 changes: 89 additions & 0 deletions lua/astrocommunity/pack/laravel/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
return {
{ import = "astrocommunity.pack.php" },
{ import = "astrocommunity.pack.html-css" },
{ import = "astrocommunity.pack.blade" },
{
"adalessa/laravel.nvim",
cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" },
dependencies = {
"nvim-telescope/telescope.nvim",
"tpope/vim-dotenv",
"MunifTanjim/nui.nvim",
"nvimtools/none-ls.nvim",
{
"AstroNvim/astrocore",
opts = function(_, opts)
local maps = opts.mappings
local prefix = "<Leader>L"
maps.n[prefix] = { desc = require("astroui").get_icon("Laravel", 1, true) .. "Laravel" }

maps.n[prefix .. "a"] = { ":Laravel artisan<CR>", desc = "Artisan" }
maps.n[prefix .. "r"] = { ":Laravel routes<CR>", desc = "Routes" }
maps.n[prefix .. "c"] = { ":Composer<CR>", desc = "Composer" }
maps.n[prefix .. "n"] = { ":Npm<CR>", desc = "Npm" }
maps.n[prefix .. "y"] = { ":Yarn<CR>", desc = "Yarn" }
end,
},
{ "AstroNvim/astroui", opts = { icons = { Laravel = "󰫐" } } },
},
event = { "VeryLazy" },
config = true,
},
{
"Bleksak/laravel-ide-helper.nvim",
dependencies = {
{
"AstroNvim/astrocore",
opts = function(_, opts)
local maps = opts.mappings
local prefix = "<Leader>Li"
maps.n[prefix] = { desc = require("astroui").get_icon("IdeHelper", 1, true) .. "Laravel Ide Helper" }

maps.n[prefix .. "m"] = {
function() require("laravel-ide-helper").generate_models(vim.fn.expand "%") end,
desc = "Generate Model Info for current model",
}
maps.n[prefix .. "M"] = {
function() require("laravel-ide-helper").generate_models() end,
desc = "Generate Model Info for all models",
}
end,
},
{ "AstroNvim/astroui", opts = { icons = { IdeHelper = "󱚌" } } },
},
},
{
"ricardoramirezr/blade-nav.nvim",
dependencies = {
"hrsh7th/nvim-cmp",
},
ft = { "blade", "php" },
},
{
"vim-test/vim-test",
cmd = { "TestNearest", "TestFile", "TestLast", "TestClass", "TestSuite", "TestVist" },
dependencies = {
{
"AstroNvim/astrocore",
opts = function(_, opts)
local maps = opts.mappings
local prefix = "<Leader>Lt"
maps.n[prefix] = { desc = require("astroui").get_icon("Testing", 1, true) .. "Testing" }

maps.n[prefix .. "n"] = { ":TestNearest<CR>", desc = "Test Nearest" }
maps.n[prefix .. "f"] = { ":TestFile<CR>", desc = "Test File" }
maps.n[prefix .. "l"] = { ":TestLast<CR>", desc = "Test Last" }
maps.n[prefix .. "c"] = { ":TestClass<CR>", desc = "Test Class" }
maps.n[prefix .. "s"] = { ":TestSuite<CR>", desc = "Test Suite" }
maps.n[prefix .. "v"] = { ":TestVisit<CR>", desc = "Test Visit" }

-- Set the strategy to open results in a vertical split
vim.g["test#strategy"] = "neovim"
vim.g["test#neovim#term_position"] = "vert"
end,
},
{ "AstroNvim/astroui", opts = { icons = { Testing = "󰙨" } } },
},
event = { "VeryLazy" },
},
ALameLlama marked this conversation as resolved.
Show resolved Hide resolved
}
Loading