diff options
Diffstat (limited to 'lua/alpha')
| -rw-r--r-- | lua/alpha/lsp/attach.lua | 45 | ||||
| -rw-r--r-- | lua/alpha/lsp/null-ls.lua | 16 | ||||
| -rw-r--r-- | lua/alpha/lsp/servers.lua | 16 |
3 files changed, 67 insertions, 10 deletions
diff --git a/lua/alpha/lsp/attach.lua b/lua/alpha/lsp/attach.lua index e15ad92..6fc415c 100644 --- a/lua/alpha/lsp/attach.lua +++ b/lua/alpha/lsp/attach.lua @@ -5,6 +5,51 @@ local filetype_attach = setmetatable({ vim.api.nvim_buf_create_user_command(bufnr, "LspPhpactorReindex", function() vim.lsp.buf_notify(bufnr, "phpactor/index/reindex", {}) end, {}) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspPhpactorStatus', function() + local results, _ = vim.lsp.buf_request_sync(bufnr, "phpactor/status", {["return"]=true}) + + local content = '' + + for _, res in pairs(results or {}) do + if res ~= nil and res["result"] ~= nil then + content = content .. res["result"] + end + end + + + local Popup = require("nui.popup") + local event = require("nui.utils.autocmd").event + + local popup = Popup({ + enter = true, + focusable = true, + border = { + style = "rounded", + }, + position = "50%", + size = { + width = "80%", + height = "60%", + }, + }) + + -- mount/open the component + popup:mount() + + -- unmount component when cursor leaves buffer + popup:on(event.BufLeave, function() + popup:unmount() + end) + local out = {}; + for match in string.gmatch(content, "[^\n]+") do + table.insert(out, match); + end + + vim.api.nvim_buf_set_option(popup.bufnr, "filetype", "markdown") + vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, out) + + end, {}) end, }, { __index = function() diff --git a/lua/alpha/lsp/null-ls.lua b/lua/alpha/lsp/null-ls.lua index 3428ec6..b329ba6 100644 --- a/lua/alpha/lsp/null-ls.lua +++ b/lua/alpha/lsp/null-ls.lua @@ -16,14 +16,14 @@ null_ls.setup { -- php_actions.getter_setter, -- php_actions.file_creator, - null_ls.builtins.diagnostics.phpstan.with { - to_temp_file = false, - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - -- command = "./bin/phpstan", - -- condition = function () - -- return vim.fn.findfile("bin/phpstan") ~= "" - -- end - }, + -- null_ls.builtins.diagnostics.phpstan.with { + -- to_temp_file = false, + -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + -- -- command = "./bin/phpstan", + -- -- condition = function () + -- -- return vim.fn.findfile("bin/phpstan") ~= "" + -- -- end + -- }, null_ls.builtins.diagnostics.phpcs.with { method = null_ls.methods.DIAGNOSTICS_ON_SAVE, condition = function(utils) diff --git a/lua/alpha/lsp/servers.lua b/lua/alpha/lsp/servers.lua index 14ec9d3..c849c13 100644 --- a/lua/alpha/lsp/servers.lua +++ b/lua/alpha/lsp/servers.lua @@ -12,6 +12,18 @@ local default = function() end return { + -- ["cucumber_language_server"] = function() + -- return { + -- on_attach = lsp_attach, + -- flags = lsp_flags, + -- settings = { + -- cucumber = { + -- features = { "tests/Behat/features/*.feature" }, + -- glue = { "tests/Behat/*.php" }, + -- }, + -- }, + -- } + -- end, ["emmet_ls"] = function() local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) @@ -78,7 +90,7 @@ return { end, ["omnisharp"] = function() return { - cmd = {"OmniSharp"}, + cmd = { "OmniSharp" }, on_attach = lsp_attach, flags = lsp_flags, } @@ -88,7 +100,7 @@ return { return { on_attach = lsp_attach, flags = lsp_flags, - filetypes = { "php", "cucumber" }, + filetypes = { "php" }, init_options = { ["language_server_worse_reflection.inlay_hints.enable"] = true, ["language_server_worse_reflection.inlay_hints.params"] = true, |