aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/php/servers.lua
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-01-31 09:44:13 +0100
commit669561e21073e6efafddda25ba3ace69fb43819e (patch)
treef94ebd60ad4cab480b5cbcb7e65dd2060696c339 /lua/alpha/php/servers.lua
parent5044c70e9f62cdd06ee91e754423b07c1c18c12d (diff)
downloadnvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.tar.gz
nvim-conf-669561e21073e6efafddda25ba3ace69fb43819e.zip
feat: apply stylua
Diffstat (limited to 'lua/alpha/php/servers.lua')
-rw-r--r--lua/alpha/php/servers.lua42
1 files changed, 18 insertions, 24 deletions
diff --git a/lua/alpha/php/servers.lua b/lua/alpha/php/servers.lua
index caab4a8..ba3680c 100644
--- a/lua/alpha/php/servers.lua
+++ b/lua/alpha/php/servers.lua
@@ -6,40 +6,34 @@ local phpactor = {}
-- vim.lsp.start() should return the client
function phpactor.findclass(buffer, fqn, callback)
- local class_parts = vim.split(fqn, "\\")
- local class = class_parts[#class_parts]
-
- vim.lsp.buf_request(buffer, "workspace/symbol", { query = class }, function(err, server_result, _, _)
- if err then
- callback(
- nil,
- "Error when finding workspace symbols: " .. err.message
- )
-
- return
- end
-
- local locations = vim.lsp.util.symbols_to_items(server_result or {}, buffer) or {}
- if vim.tbl_isempty(locations) then
- vim.api.nvim_err_writeln("Empty response looking for class: " .. fqn)
- return
- end
-
- end)
+ local class_parts = vim.split(fqn, "\\")
+ local class = class_parts[#class_parts]
+
+ vim.lsp.buf_request(buffer, "workspace/symbol", { query = class }, function(err, server_result, _, _)
+ if err then
+ callback(nil, "Error when finding workspace symbols: " .. err.message)
+
+ return
+ end
+
+ local locations = vim.lsp.util.symbols_to_items(server_result or {}, buffer) or {}
+ if vim.tbl_isempty(locations) then
+ vim.api.nvim_err_writeln("Empty response looking for class: " .. fqn)
+ return
+ end
+ end)
end
-- getting the config I can re use the client
-- the next thing is to make the request with the client
local config = require("lspconfig").phpactor
config.root_dir = vim.fn.getcwd()
-local client_id = vim.lsp.start(
- config
-);
+local client_id = vim.lsp.start(config)
local client = vim.lsp.get_client_by_id(client_id)
P(client)
-- use client.request or request_sync
-- look for the direct of the symbol
return {
- phpactor = phpactor,
+ phpactor = phpactor,
}