Skip to content

Commit 87b0405

Browse files
authored
4.x (#142)
* dump-server implementation * handle when dump server is not installed * add way to install * move to an extension schema * move existing features to extensions * internal updates for commands, implement better task than system for long process * remove unused function * move more to extensions * move history to extension * basic tinker and improve commands * tinker extension improve * support create and store * improve it using treesitter * rename the dump server files to match the style * move extension to task * improve checkhealth * introduce actions ad add first one of go to migration * add more detail failure in case of defined environment not found * move commands and clean the services folder * Update how optiosn are retrieve * add action and improvements * change style add methods * set the style for naming, support better injection * more improvements * change way to handle environment * fix wrong usage * add snacks picker for laravel commands * new class structure * add mcp tools * add check that mcp is installed * WIP * wip * big refactor * remove repositories, change health * remove promises * refactors * add completion * refactor * more improvements * fix lsp errors * improve completion * fix the clear position * small fixes * remove the thenCall * use lsp config for model cmpletion * fix variable name * simplify using treesitter * pretty print save and command to open * remove this test file * add better description * general improvements and reconfigure environments * create the managers for pickers and actions * fix bug where not boot of extensions * wrap in the schedule for the response * fix remember cache not returning error value returned by the service * added cache test * have a proper error object not just string * add logger * add the schedule to wrap the picker * refactors * clean up * fix small issues * fix checkhealth and improve readme * improve readme * add logo * fix image link * update logo * update logo * Update readme * add dump server image * Update readme
1 parent ea41c6d commit 87b0405

File tree

277 files changed

+22531
-5078
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+22531
-5078
lines changed

.neoconf.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 189 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,197 @@
1-
# Breaking Changes
2-
I have re-written most of the plugin so in case you need to stay in an old version use the tagged version `v2.2.1` and not master.
3-
4-
# Laravel.nvim
1+
![logo](imgs/logo.png)
52
Plugin for Neovim to enhance the development experience of Laravel projects
63

7-
Quick executing of artisan commands, list and navigate to routes. Information about the routes.
8-
Robust API to allow you to run any command in the way that you need.
94

10-
For more information, see the [official documentation](https://adalessa.github.io/laravel-nvim-docs/)
5+
# ✨ Features
6+
7+
## Environment
8+
The plugin supports different types of environment, like local, sail, docker compose and heard, and can be extended for your own need
9+
10+
## Pickers
11+
- Artisan commands
12+
- Routes
13+
- User Commands, allow you to define your own quick actions
14+
- Makes
15+
- Resources, picker sort by common laravel resources like controlles migrations, etc.
16+
- Related, on a model quickly go to relations of it.
17+
- Composer
18+
- History, the plugin stores the previously run commands to quicly re-run them.
19+
20+
![artisan-picker](imgs/artisan-picker.png)
21+
22+
## Virtual Information
23+
- Model Info: Get the model information like database, table and fields, directly on the model
24+
- Route Info: Get the URI, method and middlewares right on top of your controller function
25+
- Composer Info: Get the exact version of the installed packages and if an update is available.
26+
![model-info](imgs/model-info.png)
27+
![model-info](imgs/route-info.png)
28+
![model-info](imgs/composer-info.png)
29+
30+
## Actions
31+
The plugin provides an action system like the lsp action, but only for laravel.
32+
33+
## Tinker
34+
Tinker it's a great tool, the plugins provides a new way to interact with it.
35+
Using files .tinker on your project and a dedicated UI makes interact with Tinker
36+
a lot easier and fun.
37+
![tinker-ui](imgs/tinker-ui.png)
38+
39+
## Dump Server
40+
Integration with [laravel dump server](https://github.com/beyondcode/laravel-dump-server)
41+
![dump-server](imgs/dump-server.png)
42+
43+
## Dev Server
44+
One of the ways to run your laravel environment is locally using `artisan serve`.
45+
For this type of user laravel now ships with a command in composer called `dev`
46+
If you are one of this users you can start the server directly from neovim.
47+
48+
49+
## Lualine Integration
50+
![lualine](imgs/lualine.png)
51+
<details>
52+
<summary>items configurations</summary>
53+
54+
```lua
55+
{
56+
{
57+
function()
58+
local ok, laravel_version = pcall(function()
59+
return Laravel.app("status"):get("laravel")
60+
end)
61+
if ok then
62+
return laravel_version
63+
end
64+
end,
65+
icon = { "", color = { fg = "#F55247" } },
66+
cond = function()
67+
local ok, has_laravel_versions = pcall(function()
68+
return Laravel.app("status"):has("laravel")
69+
end)
70+
return ok and has_laravel_versions
71+
end,
72+
},
73+
{
74+
function()
75+
local ok, php_version = pcall(function()
76+
return Laravel.app("status"):get("php")
77+
end)
78+
if ok then
79+
return php_version
80+
end
81+
return nil
82+
end,
83+
icon = { "", color = { fg = "#AEB2D5" } },
84+
cond = function()
85+
local ok, has_php_version = pcall(function()
86+
return Laravel.app("status"):has("php")
87+
end)
88+
return ok and has_php_version
89+
end,
90+
},
91+
{
92+
function()
93+
local ok, hostname = pcall(function()
94+
return Laravel.extensions.composer_dev.hostname()
95+
end)
96+
if ok then
97+
return hostname
98+
end
99+
return nil
100+
end,
101+
icon = { "", color = { fg = "#8FBC8F" } },
102+
cond = function()
103+
local ok, is_running = pcall(function()
104+
return Laravel.extensions.composer_dev.isRunning()
105+
end)
106+
return ok and is_running
107+
end,
108+
},
109+
{
110+
function()
111+
local ok, unseen_records = pcall(function()
112+
return #(Laravel.extensions.dump_server.unseenRecords())
113+
end)
114+
115+
if ok then
116+
return unseen_records
117+
end
118+
return 0
119+
end,
120+
icon = { "󰱧 ", color = { fg = "#FFCC66" } },
121+
cond = function()
122+
local ok, is_running = pcall(function()
123+
return Laravel.extensions.dump_server.isRunning()
124+
end)
125+
126+
return ok and is_running
127+
end,
128+
},
129+
}
130+
```
131+
</details>
132+
133+
# 📦 Installation
134+
135+
Using [Lazy.nvim](https://github.com/foke/lazy.nvim)
136+
```lua
137+
{
138+
"adalessa/laravel.nvim",
139+
dependencies = {
140+
"tpope/vim-dotenv",
141+
"MunifTanjim/nui.nvim",
142+
"nvim-lua/plenary.nvim",
143+
"nvim-neotest/nvim-nio",
144+
"ravitemer/mcphub.nvim", -- optional
145+
},
146+
cmd = { "Laravel" },
147+
keys = {
148+
{ "<leader>ll", function() Laravel.pickers.laravel() end, desc = "Laravel: Open Laravel Picker" },
149+
{ "<c-g>", function() Laravel.commands.run("view:finder") end, desc = "Laravel: Open View Finder" },
150+
{ "<leader>la", function() Laravel.pickers.artisan() end, desc = "Laravel: Open Artisan Picker" },
151+
{ "<leader>lt", function() Laravel.commands.run("actions") end, desc = "Laravel: Open Actions Picker" },
152+
{ "<leader>lr", function() Laravel.pickers.routes() end, desc = "Laravel: Open Routes Picker" },
153+
{ "<leader>lh", function() Laravel.run("artisan docs") end, desc = "Laravel: Open Documentation" },
154+
{ "<leader>lm", function() Laravel.pickers.make() end, desc = "Laravel: Open Make Picker" },
155+
{ "<leader>lc", function() Laravel.pickers.commands() end, desc = "Laravel: Open Commands Picker" },
156+
{ "<leader>lo", function() Laravel.pickers.resources() end, desc = "Laravel: Open Resources Picker" },
157+
{ "<leader>lp", function() Laravel.commands.run("command_center") end, desc = "Laravel: Open Command Center" },
158+
{
159+
"gf",
160+
function()
161+
local ok, res = pcall(function()
162+
if Laravel.app("gf").cursorOnResource() then
163+
return "<cmd>lua Laravel.commands.run('gf')<cr>"
164+
end
165+
end)
166+
if not ok or not res then
167+
return "gf"
168+
end
169+
return res
170+
end,
171+
expr = true,
172+
noremap = true,
173+
},
174+
},
175+
event = { "VeryLazy" },
176+
opts = {
177+
lsp_server = "phpactor", -- "phpactor | intelephense"
178+
features = {
179+
pickers = {
180+
provider = "snacks", -- "snacks | telescope | fzf-lua | ui-select"
181+
},
182+
},
183+
},
184+
}
185+
```
186+
187+
## Configuration
188+
The configuration is extense and recommend look [here](lua/laravel/options/default.lua)
11189

12190
# Self promotion
13-
I am Ariel I am a developer and also content creator (mostly in Spanish) if you would like to show some love leave a start into the plugin and subscribe to my [Youtube](https://youtube.com/@Alpha_Dev) if you want to show even more love you can support becoming a member on Youtube. But just leaving a like or letting me know that you like and enjoy the plugin is appreciated.
191+
I am Ariel I am a developer and also content creator (mostly in Spanish)
192+
if you would like to show some love leave a start into the plugin and subscribe to my [Youtube](https://youtube.com/@Alpha_Dev)
193+
if you want to show even more love you can support becoming a member on Youtube.
194+
But just leaving a like or letting me know that you like and enjoy the plugin is appreciated.
14195

15196
# Collaboration
16197
I am open to review pr if you have ideas or ways to improve the plugin would be great.

imgs/artisan-picker.png

303 KB
Loading

imgs/composer-info.png

262 KB
Loading

imgs/dump-server.png

217 KB
Loading

imgs/logo.png

469 KB
Loading

imgs/lualine.png

10.4 KB
Loading

imgs/model-info.png

191 KB
Loading

imgs/route-info.png

240 KB
Loading

imgs/tinker-ui.png

323 KB
Loading

0 commit comments

Comments
 (0)