style: fmt
This commit is contained in:
parent
67de3e4110
commit
21fdf2d031
301
rust.lua
301
rust.lua
@ -121,29 +121,26 @@ vim.g.rustaceanvim = {
|
|||||||
require('crates').setup()
|
require('crates').setup()
|
||||||
local keymap_opts = {buffer = bufnr}
|
local keymap_opts = {buffer = bufnr}
|
||||||
-- Hover actions
|
-- Hover actions
|
||||||
-- call twice to focus
|
-- call twice to focus
|
||||||
vim.keymap.set("n", "<leader>K",
|
vim.keymap.set("n", "<leader>K",
|
||||||
function()
|
function()
|
||||||
vim.cmd.RustLsp { 'hover', 'actions' }
|
vim.cmd.RustLsp {'hover', 'actions'}
|
||||||
end, keymap_opts)
|
end, keymap_opts)
|
||||||
-- Code action groups
|
-- Code action groups
|
||||||
vim.keymap.set("n", "<leader>as",
|
vim.keymap.set("n", "<leader>as",
|
||||||
function()
|
function()
|
||||||
vim.cmd.RustLsp { 'hover', 'actions' }
|
vim.cmd.RustLsp {'hover', 'actions'}
|
||||||
end, keymap_opts)
|
end, keymap_opts)
|
||||||
vim.keymap.set('n', '<leader>cc',
|
vim.keymap.set('n', '<leader>cc',
|
||||||
function()
|
function() vim.cmd.RustLsp('openCargo') end,
|
||||||
vim.cmd.RustLsp('openCargo')
|
keymap_opts)
|
||||||
end, keymap_opts)
|
vim.keymap.set('n', '<leader>cr', function()
|
||||||
vim.keymap.set('n', '<leader>cr',
|
vim.cmd.RustLsp {'runnables', 'last' --[[ optional ]] }
|
||||||
function()
|
end, keymap_opts)
|
||||||
vim.cmd.RustLsp {'runnables', 'last' --[[ optional ]] }
|
vim.keymap.set('n', '<leader>cd', function()
|
||||||
end, keymap_opts)
|
vim.cmd.RustLsp {'debuggables', 'last' --[[ optional ]] }
|
||||||
vim.keymap.set('n', '<leader>cd',
|
end, keymap_opts)
|
||||||
function()
|
-- vim.keymap.set("n", "g0", vim.lsp.buf.document_symbol, keymap_opts)
|
||||||
vim.cmd.RustLsp {'debuggables', 'last' --[[ optional ]] }
|
|
||||||
end, keymap_opts)
|
|
||||||
-- vim.keymap.set("n", "g0", vim.lsp.buf.document_symbol, keymap_opts)
|
|
||||||
local diag_float_grp = vim.api.nvim_create_augroup(
|
local diag_float_grp = vim.api.nvim_create_augroup(
|
||||||
"DiagnosticFloat", {clear = true})
|
"DiagnosticFloat", {clear = true})
|
||||||
vim.api.nvim_create_autocmd("CursorHold", {
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
@ -171,180 +168,128 @@ vim.g.rustaceanvim = {
|
|||||||
local rt = require("rust-tools")
|
local rt = require("rust-tools")
|
||||||
local deps = require("nvim-deps")
|
local deps = require("nvim-deps")
|
||||||
|
|
||||||
rt.setup(
|
rt.setup({
|
||||||
{
|
tools = { -- rust-tools options
|
||||||
tools = { -- rust-tools options
|
|
||||||
|
|
||||||
-- how to execute terminal commands
|
-- how to execute terminal commands
|
||||||
-- options right now: termopen / quickfix / toggleterm / vimux
|
-- options right now: termopen / quickfix / toggleterm / vimux
|
||||||
executor = require("rust-tools.executors").termopen,
|
executor = require("rust-tools.executors").termopen,
|
||||||
|
|
||||||
-- callback to execute once rust-analyzer is done initializing the workspace
|
-- callback to execute once rust-analyzer is done initializing the workspace
|
||||||
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||||
on_initialized = nil,
|
on_initialized = nil,
|
||||||
|
|
||||||
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||||
reload_workspace_from_cargo_toml = true,
|
reload_workspace_from_cargo_toml = true,
|
||||||
|
|
||||||
-- These apply to the default RustSetInlayHints command
|
-- These apply to the default RustSetInlayHints command
|
||||||
inlay_hints = {
|
inlay_hints = {
|
||||||
-- automatically set inlay hints (type hints)
|
-- automatically set inlay hints (type hints)
|
||||||
-- default: true
|
-- default: true
|
||||||
auto = true,
|
auto = true,
|
||||||
|
|
||||||
-- Only show inlay hints for the current line
|
-- Only show inlay hints for the current line
|
||||||
only_current_line = false,
|
only_current_line = false,
|
||||||
|
|
||||||
-- whether to show parameter hints with the inlay hints or not
|
-- whether to show parameter hints with the inlay hints or not
|
||||||
-- default: true
|
-- default: true
|
||||||
show_parameter_hints = true,
|
show_parameter_hints = true,
|
||||||
|
|
||||||
-- prefix for parameter hints
|
-- prefix for parameter hints
|
||||||
-- default: "<-"
|
-- default: "<-"
|
||||||
parameter_hints_prefix = "<- ",
|
parameter_hints_prefix = "<- ",
|
||||||
|
|
||||||
-- prefix for all the other hints (type, chaining)
|
-- prefix for all the other hints (type, chaining)
|
||||||
-- default: "=>"
|
-- default: "=>"
|
||||||
other_hints_prefix = "=> ",
|
other_hints_prefix = "=> ",
|
||||||
|
|
||||||
-- whether to align to the length of the longest line in the file
|
-- whether to align to the length of the longest line in the file
|
||||||
max_len_align = false,
|
max_len_align = false,
|
||||||
|
|
||||||
-- padding from the left if max_len_align is true
|
-- padding from the left if max_len_align is true
|
||||||
max_len_align_padding = 1,
|
max_len_align_padding = 1,
|
||||||
|
|
||||||
-- whether to align to the extreme right or not
|
-- whether to align to the extreme right or not
|
||||||
right_align = false,
|
right_align = false,
|
||||||
|
|
||||||
-- padding from the right if right_align is true
|
-- padding from the right if right_align is true
|
||||||
right_align_padding = 7,
|
right_align_padding = 7,
|
||||||
|
|
||||||
-- The color of the hints
|
-- The color of the hints
|
||||||
highlight = "Comment",
|
highlight = "Comment"
|
||||||
|
},
|
||||||
|
|
||||||
|
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
||||||
|
hover_actions = {
|
||||||
|
|
||||||
|
-- the border that is used for the hover window
|
||||||
|
-- see vim.api.nvim_open_win()
|
||||||
|
border = {
|
||||||
|
{"╭", "FloatBorder"}, {"─", "FloatBorder"},
|
||||||
|
{"╮", "FloatBorder"}, {"│", "FloatBorder"},
|
||||||
|
{"╯", "FloatBorder"}, {"─", "FloatBorder"},
|
||||||
|
{"╰", "FloatBorder"}, {"│", "FloatBorder"}
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Maximal width of the hover window. Nil means no max.
|
||||||
|
max_width = nil,
|
||||||
|
|
||||||
|
-- Maximal height of the hover window. Nil means no max.
|
||||||
|
max_height = nil,
|
||||||
|
|
||||||
|
-- whether the hover action window gets automatically focused
|
||||||
|
-- default: false
|
||||||
|
auto_focus = false
|
||||||
|
},
|
||||||
|
|
||||||
|
-- settings for showing the crate graph based on graphviz and the dot
|
||||||
|
-- command
|
||||||
|
crate_graph = {
|
||||||
|
-- Backend used for displaying the graph
|
||||||
|
-- see: https://graphviz.org/docs/outputs/
|
||||||
|
-- default: x11
|
||||||
|
backend = "x11",
|
||||||
|
-- where to store the output, nil for no output stored (relative
|
||||||
|
-- path from pwd)
|
||||||
|
-- default: nil
|
||||||
|
output = nil,
|
||||||
|
-- true for all crates.io and external crates, false only the local
|
||||||
|
-- crates
|
||||||
|
-- default: true
|
||||||
|
full = true,
|
||||||
|
|
||||||
|
-- List of backends found on: https://graphviz.org/docs/outputs/
|
||||||
|
-- Is used for input validation and autocompletion
|
||||||
|
-- Last updated: 2021-08-26
|
||||||
|
enabled_graphviz_backends = {
|
||||||
|
"bmp", "cgimage", "canon", "dot", "gv", "xdot", "xdot1.2",
|
||||||
|
"xdot1.4", "eps", "exr", "fig", "gd", "gd2", "gif", "gtk",
|
||||||
|
"ico", "cmap", "ismap", "imap", "cmapx", "imap_np", "cmapx_np",
|
||||||
|
"jpg", "jpeg", "jpe", "jp2", "json", "json0", "dot_json",
|
||||||
|
"xdot_json", "pdf", "pic", "pct", "pict", "plain", "plain-ext",
|
||||||
|
"png", "pov", "ps", "ps2", "psd", "sgi", "svg", "svgz", "tga",
|
||||||
|
"tiff", "tif", "tk", "vml", "vmlz", "wbmp", "webp", "xlib",
|
||||||
|
"x11"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
-- all the opts to send to nvim-lspconfig
|
||||||
hover_actions = {
|
-- these override the defaults set by rust-tools.nvim
|
||||||
|
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
||||||
|
server = {
|
||||||
|
-- standalone file support
|
||||||
|
-- setting it to false may improve startup time
|
||||||
|
standalone = true,
|
||||||
|
cmd = {(deps.rust_analyzer_path .. "/bin/rust-analyzer")}
|
||||||
|
}, -- rust-analyzer options
|
||||||
|
|
||||||
-- the border that is used for the hover window
|
-- debugging stuff
|
||||||
-- see vim.api.nvim_open_win()
|
dap = {
|
||||||
border = {
|
adapter = {
|
||||||
{ "╭", "FloatBorder" },
|
type = "executable",
|
||||||
{ "─", "FloatBorder" },
|
command = deps.lldb_path .. "lldb-vscode",
|
||||||
{ "╮", "FloatBorder" },
|
name = "rt_lldb"
|
||||||
{ "│", "FloatBorder" },
|
}
|
||||||
{ "╯", "FloatBorder" },
|
}
|
||||||
{ "─", "FloatBorder" },
|
})
|
||||||
{ "╰", "FloatBorder" },
|
|
||||||
{ "│", "FloatBorder" },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Maximal width of the hover window. Nil means no max.
|
|
||||||
max_width = nil,
|
|
||||||
|
|
||||||
-- Maximal height of the hover window. Nil means no max.
|
|
||||||
max_height = nil,
|
|
||||||
|
|
||||||
-- whether the hover action window gets automatically focused
|
|
||||||
-- default: false
|
|
||||||
auto_focus = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- settings for showing the crate graph based on graphviz and the dot
|
|
||||||
-- command
|
|
||||||
crate_graph = {
|
|
||||||
-- Backend used for displaying the graph
|
|
||||||
-- see: https://graphviz.org/docs/outputs/
|
|
||||||
-- default: x11
|
|
||||||
backend = "x11",
|
|
||||||
-- where to store the output, nil for no output stored (relative
|
|
||||||
-- path from pwd)
|
|
||||||
-- default: nil
|
|
||||||
output = nil,
|
|
||||||
-- true for all crates.io and external crates, false only the local
|
|
||||||
-- crates
|
|
||||||
-- default: true
|
|
||||||
full = true,
|
|
||||||
|
|
||||||
-- List of backends found on: https://graphviz.org/docs/outputs/
|
|
||||||
-- Is used for input validation and autocompletion
|
|
||||||
-- Last updated: 2021-08-26
|
|
||||||
enabled_graphviz_backends = {
|
|
||||||
"bmp",
|
|
||||||
"cgimage",
|
|
||||||
"canon",
|
|
||||||
"dot",
|
|
||||||
"gv",
|
|
||||||
"xdot",
|
|
||||||
"xdot1.2",
|
|
||||||
"xdot1.4",
|
|
||||||
"eps",
|
|
||||||
"exr",
|
|
||||||
"fig",
|
|
||||||
"gd",
|
|
||||||
"gd2",
|
|
||||||
"gif",
|
|
||||||
"gtk",
|
|
||||||
"ico",
|
|
||||||
"cmap",
|
|
||||||
"ismap",
|
|
||||||
"imap",
|
|
||||||
"cmapx",
|
|
||||||
"imap_np",
|
|
||||||
"cmapx_np",
|
|
||||||
"jpg",
|
|
||||||
"jpeg",
|
|
||||||
"jpe",
|
|
||||||
"jp2",
|
|
||||||
"json",
|
|
||||||
"json0",
|
|
||||||
"dot_json",
|
|
||||||
"xdot_json",
|
|
||||||
"pdf",
|
|
||||||
"pic",
|
|
||||||
"pct",
|
|
||||||
"pict",
|
|
||||||
"plain",
|
|
||||||
"plain-ext",
|
|
||||||
"png",
|
|
||||||
"pov",
|
|
||||||
"ps",
|
|
||||||
"ps2",
|
|
||||||
"psd",
|
|
||||||
"sgi",
|
|
||||||
"svg",
|
|
||||||
"svgz",
|
|
||||||
"tga",
|
|
||||||
"tiff",
|
|
||||||
"tif",
|
|
||||||
"tk",
|
|
||||||
"vml",
|
|
||||||
"vmlz",
|
|
||||||
"wbmp",
|
|
||||||
"webp",
|
|
||||||
"xlib",
|
|
||||||
"x11",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- all the opts to send to nvim-lspconfig
|
|
||||||
-- these override the defaults set by rust-tools.nvim
|
|
||||||
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
|
||||||
server = {
|
|
||||||
-- standalone file support
|
|
||||||
-- setting it to false may improve startup time
|
|
||||||
standalone = true,
|
|
||||||
cmd = { (deps.rust_analyzer_path .. "/bin/rust-analyzer") },
|
|
||||||
}, -- rust-analyzer options
|
|
||||||
|
|
||||||
-- debugging stuff
|
|
||||||
dap = {
|
|
||||||
adapter = {
|
|
||||||
type = "executable",
|
|
||||||
command = deps.lldb_path .. "lldb-vscode",
|
|
||||||
name = "rt_lldb",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user