diff options
| author | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2022-09-30 17:25:10 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2022-09-30 17:25:10 +0200 |
| commit | a424a58b5e178f6ad9d878d0e4825bb507f50d9d (patch) | |
| tree | abe76ae8bd0bc0be4275406e51dcad8e8d058b2e /lua/alpha/php/servers.lua | |
| parent | c06ec100be915a3ac5b39374a636b9089e0ee4a0 (diff) | |
| download | nvim-conf-a424a58b5e178f6ad9d878d0e4825bb507f50d9d.tar.gz nvim-conf-a424a58b5e178f6ad9d878d0e4825bb507f50d9d.zip | |
small improvements and wip
Diffstat (limited to 'lua/alpha/php/servers.lua')
| -rw-r--r-- | lua/alpha/php/servers.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lua/alpha/php/servers.lua b/lua/alpha/php/servers.lua new file mode 100644 index 0000000..78c99a8 --- /dev/null +++ b/lua/alpha/php/servers.lua @@ -0,0 +1,28 @@ +local phpactor = {} + +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) +end + +return { + phpactor = phpactor, +} |