Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent return value of request function #62

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading