remove conjure mapping on doc_word and add inlay hints for rust-analyzer

nix-components
pegasust 2022-10-26 05:09:47 -07:00
parent 52e998c85b
commit d8e9004a8e
1 changed files with 549 additions and 345 deletions

View File

@ -103,6 +103,7 @@ Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emula
Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs)
Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*)
Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis
Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration
-- UI & colorscheme
Plug('gruvbox-community/gruvbox') -- theme provider
@ -423,7 +424,7 @@ local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protoco
-- })
-- default language servers
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals',
'rnix', 'eslint', 'terraform-ls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls" }
'rnix', 'eslint', 'terraform-ls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls' }
require("mason").setup({
ui = {
icons = {
@ -474,6 +475,17 @@ require('mason-lspconfig').setup_handlers({
}
}
end,
-- ["rust_analyzer"] = function()
-- require('lspconfig').rust_analyzer.setup {
-- on_attach = on_attach,
-- capabilities = capabilities,
-- settings = {
-- checkOnSave = {
-- command = "clippy",
-- }
-- }
-- }
-- end,
-- ["astro"] = function()
-- print('configuring astro')
-- require('lspconfig').astro.setup {
@ -488,6 +500,194 @@ require('mason-lspconfig').setup_handlers({
-- }
-- end
})
require("rust-tools").setup {
tools = { -- rust-tools options
-- how to execute terminal commands
-- options right now: termopen / quickfix
executor = require("rust-tools/executors").termopen,
-- 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"
on_initialized = nil,
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
reload_workspace_from_cargo_toml = true,
-- These apply to the default RustSetInlayHints command
inlay_hints = {
-- automatically set inlay hints (type hints)
-- default: true
auto = true,
-- Only show inlay hints for the current line
only_current_line = false,
-- whether to show parameter hints with the inlay hints or not
-- default: true
show_parameter_hints = true,
-- prefix for parameter hints
-- default: "<-"
parameter_hints_prefix = "<- ",
-- prefix for all the other hints (type, chaining)
-- default: "=>"
other_hints_prefix = "=> ",
-- whether to align to the length of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = false,
-- padding from the right if right_align is true
right_align_padding = 7,
-- The color of the hints
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" },
},
-- 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,
on_attach = function(client, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc })
end
on_attach(client, bufnr);
nmap('K', require'rust-tools'.hover_actions.hover_actions, 'Hover Documentation')
end,
capabilities = capabilities,
settings = {
checkOnSave = {
command = "clippy",
}
}
}, -- rust-analyzer options
-- debugging stuff
dap = {
adapter = {
type = "executable",
command = "lldb-vscode",
name = "rt_lldb",
},
},
}
require('zk').setup({
picker = "telescope",
lsp = {
@ -647,3 +847,7 @@ require('lualine').setup {
}
require('nvim-surround').setup {}
vim.cmd([[
let g:conjure#mapping#doc_word = v:false
]])