-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lsp): support
rust-analyzer/viewRecursiveMemoryLayout
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local ui = require('rustaceanvim.ui') | ||
|
||
local M = {} | ||
|
||
---@return lsp_range_params | ||
|
||
---@type integer | nil | ||
local latest_buf_id = nil | ||
|
||
local function parse(_) | ||
local ret = {} | ||
-- TODO: | ||
error('not implemented') | ||
return ret | ||
end | ||
|
||
local function handler(_, result) | ||
ui.delete_buf(latest_buf_id) | ||
latest_buf_id = vim.api.nvim_create_buf(false, true) | ||
ui.split(true, latest_buf_id) | ||
vim.api.nvim_buf_set_name(latest_buf_id, 'memory.layout.rust') | ||
vim.api.nvim_buf_set_text(latest_buf_id, 0, 0, 0, 0, parse(result)) | ||
ui.resize(true, '-25') | ||
end | ||
|
||
local rl = require('rustaceanvim.rust_analyzer') | ||
function M.memory_layout() | ||
rl.buf_request(0, 'rust-analyzer/viewRecursiveMemoryLayout', vim.lsp.util.make_position_params(), handler) | ||
end | ||
|
||
return M.memory_layout |