You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return {
'mrcjkb/rustaceanvim',
version='^6', -- Recommendedlazy=false, -- This plugin is already lazydependencies= { 'saghen/blink.cmp' },
config=function()
-- From rustaceanvim docs:-- You can also use :h vim.lsp.config to configure vim.g.rustaceanvim.server options.-- For example, vim.lsp.config("*", {}) or vim.lsp.config("rust-analyzer", {}).-- Notice that its "rust-analyzer" (here), and not "rust_analyzer" (nvim-lspconfig)vim.lsp.config('rust-analyzer', {
capabilities=require('blink.cmp').get_lsp_capabilities({}, true),
settings= {
['rust-analyzer'] = {
check= {
command='clippy',
extraArgs= { '--no-deps' },
},
inlayHints= {
bindingModeHints= { enable=true },
closingBraceHints= { minLines=0 },
closureCaptureHints= { enable=true },
closureReturnTypeHints= { enable='always' },
expressionAdjustmentHints= {
enable='reborrow',
hideOutsideUnsafe=true,
},
lifetimeElisionHints= {
enable='skip_trivial',
useParameterNames=true,
},
maxLength=vim.NIL,
typing= { triggerChars='=.{(><' },
},
},
},
})
--- @type`rustaceanvim.Opts`vim.g.rustaceanvim= {
--- @type`rustaceanvim.tools.Opts`tools= {
reload_workspace_from_cargo_toml=true,
float_win_config= {
border= { '', '', '', '', '', '', '', '' },
},
},
--- @type`rustaceanvim.lsp.ClientOpts`--- @type`rustaceanvim.lsp.ClientConfig`server= {},
--- @type`rustaceanvim.dap.Opts`dap= {
-- ...
},
}
end,
}
My blink.cmp config
return {
'saghen/blink.cmp',
event='VimEnter',
version='1.*',
dependencies= {
'folke/lazydev.nvim',
{
-- Snippet Engine'L3MON4D3/LuaSnip',
version='2.*',
-- Build Step is needed for regex support in snippets. This step is not supported in-- many windows environments. Remove the below condition to re-enable on windows.build=vim.fn.has'win32' ==0andvim.fn.executable'make' ==1and'make install_jsregexp',
dependencies= {
-- Snippets collection for a set of different programming languages (VS Code style)-- https://github.com/rafamadriz/friendly-snippets'rafamadriz/friendly-snippets',
},
config=function()
require('luasnip.loaders.from_vscode').lazy_load() -- For VS Code style snippetsrequire('luasnip').setup()
end,
},
},
opts_extend= { 'sources.default' },
--- @module'blink.cmp'--- @typeblink.cmp.Configopts= {
keymap= {
-- 'default' (recommended) for mappings similar to built-in completions-- <c-y> to accept ([y]es) the completion.-- This will auto-import if your LSP supports it.-- This will expand snippets if the LSP sent a snippet.-- 'super-tab' for tab to accept-- 'enter' for enter to accept-- 'none' for no mappings---- For an understanding of why the 'default' preset is recommended,-- you will need to read `:help ins-completion`---- No, but seriously. Please read `:help ins-completion`, it is really good!---- All presets have the following mappings:-- <tab>/<s-tab>: move to forward/backward of your snippet expansion-- <c-space>: Open menu or open docs if already open-- <c-n>/<c-p> or <up>/<down>: Select next/previous item-- <c-e>: Hide menu-- <c-k>: Toggle signature help---- See :h blink-cmp-config-keymap for defining your own keymappreset='default',
-- stylua: ignore start
['<A-1>'] = { function(cmp) cmp.accept({ index=01 }) end },
['<A-2>'] = { function(cmp) cmp.accept({ index=02 }) end },
['<A-3>'] = { function(cmp) cmp.accept({ index=03 }) end },
['<A-4>'] = { function(cmp) cmp.accept({ index=04 }) end },
['<A-5>'] = { function(cmp) cmp.accept({ index=05 }) end },
['<A-6>'] = { function(cmp) cmp.accept({ index=06 }) end },
['<A-7>'] = { function(cmp) cmp.accept({ index=07 }) end },
['<A-8>'] = { function(cmp) cmp.accept({ index=08 }) end },
['<A-9>'] = { function(cmp) cmp.accept({ index=09 }) end },
['<A-0>'] = { function(cmp) cmp.accept({ index=10 }) end },
-- stylua: ignore end-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
appearance= {
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'-- Adjusts spacing to ensure icons are alignednerd_font_variant='normal',
},
completion= {
-- Controls what the plugin considers to be a keyword,-- used for fuzzy matching and triggering completionskeyword= {
-- 'prefix' will fuzzy match on the text before the cursor-- 'full' will fuzzy match on the text before _and_ after the cursor-- example: 'foo_|_bar' will match 'foo_' for 'prefix' and 'foo__bar' for 'full'range='prefix',
},
-- Controls when to request completion items from the sources and show the completion menutrigger= {
-- When true, will show completion window after backspacing into a keywordshow_on_backspace_in_keyword=true,
},
-- Manages the completion list and its behavior when selecting itemslist= {
selection= {
-- looks nice with ghost textauto_insert=false,
},
},
-- Manages the appearance of the completion menumenu= {
scrollbar=false,
draw= {
-- Use treesitter to highlight the label text for the given list of sources-- Too noisy, kind_icon is enoughtreesitter= {
-- 'lsp',
},
-- Components to render, grouped by column. Check out-- https://cmp.saghen.dev/configuration/completion#available-componentscolumns= {
{ 'item_idx' },
{ 'kind_icon' },
{ 'label' },
},
-- Definitions for possible components to render. Each defines:-- ellipsis: whether to add an ellipsis when truncating the text-- width: control the min, max and fill behavior of the component-- text function: will be called for each item-- highlight function: will be called only when the line appears on screencomponents= {
-- Overriding `columns[1].item_idx`item_idx= {
text=function(ctx)
returnctx.idx==10and'0'orctx.idx>10and''ortostring(ctx.idx)
end,
},
},
},
},
documentation= {
auto_show=true,
auto_show_delay_ms=500,
-- Whether to use treesitter highlighting, disable if you run into performance issuestreesitter_highlighting=true,
window= {
scrollbar=false,
},
},
-- Displays a preview of the selected item on the current lineghost_text= {
enabled=true,
-- Show the ghost text when an item has been selectedshow_with_selection=true,
-- Show the ghost text when no item has been selected, defaulting to the first itemshow_without_selection=true,
-- Show the ghost text when the menu is openshow_with_menu=true,
-- Show the ghost text when the menu is closedshow_without_menu=true,
},
},
-- See :h blink-cmp-config-fuzzy for more informationfuzzy= {
implementation='prefer_rust_with_warning',
},
-- Shows a signature help window while you type arguments for a functionsignature= {
enabled=true,
},
-- things that provide you with completion items, trigger characters, documentation and signature helpsources= {
-- `lsp`, `path`, `snippets`, `luasnip`, `buffer`, and `omni` sources are built-indefault= { 'lsp', 'path', 'snippets' },
per_filetype= {
lua= { inherit_defaults=true, 'lazydev' },
},
providers= {
path= {
opts= {
-- Path completion from cwd instead of current buffer's directoryget_cwd=function(_)
returnvim.fn.getcwd()
end,
},
},
snippets= {
-- Hide snippets after trigger charactershould_show_items=function(ctx)
returnctx.trigger.initial_kind~='trigger_character'end,
},
lazydev= {
name='LazyDev',
module='lazydev.integrations.blink',
-- make lazydev completions top priority (see `:h blink.cmp`)score_offset=100,
},
},
},
snippets= {
preset='luasnip',
},
},
}
I do have a separate nvim-lspconfig configuration file, but Rust is not used or mentioned there.
I also have windwp/nvim-autopairs configured, but it does not provide all the features of rust-analyzer.typing.triggerChars
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
rust-analyzer
has atyping.triggerChars
config. How do i utilize this?My rust specific config
My blink.cmp config
I do have a separate
nvim-lspconfig
configuration file, but Rust is not used or mentioned there.I also have
windwp/nvim-autopairs
configured, but it does not provide all the features ofrust-analyzer.typing.triggerChars
Beta Was this translation helpful? Give feedback.
All reactions