1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
local phpactor = function ()
vim.ui.select({
"class_inflect",
"context_menu",
"expand_class",
"generate_accessor",
"change_visibility",
"copy_class",
"import_class",
"import_missing_classes",
"move_class",
"navigate",
"new_class",
"transform",
"update",
"config",
"status",
"cache_clear",
}, {
prompt = "Phpactor Action",
}, function(choice)
if choice == nil or choice == "" then
return
end
-- TODO: add option for new class in same directory
if choice == "new_class" then
return vim.ui.input({
prompt = "New Class",
}, function(value)
if value == nil then
return
end
-- TODO: check filename generation to validate the path
require("phpactor").rpc("new_class", { text_value = vim.fn.getcwd() .. '/' .. value .. ".php" })
end)
end
require("phpactor").rpc(choice, {})
end)
end
return {
"adalessa/phpactor.nvim",
cmd = { "PhpActor" },
keys = {
{ "<leader>pa", phpactor, desc = "PhpActor options" },
{ "<leader>pc", ":PhpActor context_menu<cr>", desc = "PhpActor context menu" },
},
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = {
install = {
bin = 'phpactor'
},
lspconfig = {
enabled = false,
},
},
}
|