diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-05-02 08:42:29 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-05-02 08:42:44 +0200 |
| commit | 68e29799b41ba4db8ea06d111c4687f4a500942e (patch) | |
| tree | fddd525bff7ac207e52eb5bcf52df68d5d4685fe /lua/plugins/phpactor.lua | |
| parent | df32f161ef5e427009f0b00c9586f1b8951c05ad (diff) | |
| download | nvim-conf-68e29799b41ba4db8ea06d111c4687f4a500942e.tar.gz nvim-conf-68e29799b41ba4db8ea06d111c4687f4a500942e.zip | |
improve phpactor. install twilight. update laravel
Diffstat (limited to 'lua/plugins/phpactor.lua')
| -rw-r--r-- | lua/plugins/phpactor.lua | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/lua/plugins/phpactor.lua b/lua/plugins/phpactor.lua index 8dec3ec..23311fc 100644 --- a/lua/plugins/phpactor.lua +++ b/lua/plugins/phpactor.lua @@ -1,15 +1,58 @@ +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 context_menu<cr>", desc = "PhpActor context menu" }, + { "<leader>pa", phpactor, desc = "PhpActor options" }, + { "<leader>pc", ":PhpActor context_menu<cr>", desc = "PhpActor context menu" }, }, dependencies = { "nvim-lua/plenary.nvim", }, opts = { install = { - bin = vim.fn.stdpath "data" .. "/mason/bin/phpactor", + bin = vim.fn.exepath "phpactor", }, lspconfig = { enabled = false, |