Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

fix: ssr request #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 10 additions & 2 deletions lua/rust-tools/ssr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,27 @@ local function get_opts(query)
return opts
end

local function handler(err, result)
local function handler(err, result, ctx)
if err then
error("Could not execute request to server: " .. err.message)
return
end

vim.lsp.util.apply_workspace_edit(result)
local client = vim.lsp.get_client_by_id(ctx.client_id)
if not client then
return
end

vim.lsp.util.apply_workspace_edit(result, client.offset_encoding)
end

function M.ssr(query)
if not query then
vim.ui.input({ prompt = "Enter query: " }, function(input)
query = input
if query then
M.ssr(query)
end
end)
end

Expand Down