Skip to content

Commit

Permalink
Merge pull request #62 from k-86/fix-request-return-value
Browse files Browse the repository at this point in the history
Fix inconsistent return value of request function
  • Loading branch information
Shougo committed Jun 3, 2024
2 parents 1b5154e + e40ad73 commit 79e270f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions denops/@ddc-sources/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ export class Source extends BaseSource<Params> {
lspItem,
{ client, timeout: 1000, sync: true, bufnr: bufnr },
);
const { result } = u.ensure(
const result = u.ensure(
response,
is.ObjectOf({ result: is.ObjectOf({ label: is.String }) }),
is.ObjectOf({ label: is.String }),
);
return result as LSP.CompletionItem;
} catch {
Expand Down
5 changes: 4 additions & 1 deletion lua/ddc_source_lsp/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ end
function M.request_sync(clientId, method, params, opts)
local client = vim.lsp.get_client_by_id(clientId)
if client then
return client.request_sync(method, normalize(params), opts.timeout, opts.bufnr or 0)
local resp = client.request_sync(method, normalize(params), opts.timeout, opts.bufnr or 0)
if resp and resp.err == nil and resp.result then
return resp.result
end
end
end

Expand Down

0 comments on commit 79e270f

Please sign in to comment.