Skip to content

Commit

Permalink
refactor: use client.request instead of vim.lsp.request_all
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoP committed Nov 11, 2023
1 parent 4e9f708 commit b293e93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ You could also use a filetype autocmd to create the keymap.

## TODO

- [ ] One terminal per language server instance
- [ ] Tests
7 changes: 4 additions & 3 deletions lua/powershell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,15 @@ end

M.eval = function()
local buf = vim.api.nvim_get_current_buf()
local client = clients[buf]
if not client then
local client_id = clients[buf]
if not client_id then
vim.notify(
"Currently, there is no LSP client initialize by powershell.nvim attached to the current buffer.",
vim.log.levels.WARN
)
return
end
local client = vim.lsp.get_client_by_id(client_id)

local mode = vim.api.nvim_get_mode().mode
---@type string
Expand All @@ -382,7 +383,7 @@ M.eval = function()
text = table.concat(vim.api.nvim_buf_get_text(0, start_row, start_col, end_row, end_col, {}), "\n")
end

vim.lsp.buf_request_all(0, "evaluate", { expression = text }, function() end)
client.request("evaluate", { expression = text }, function() end, 0)
end

return M

0 comments on commit b293e93

Please sign in to comment.