Skip to content

Auto import has broken for rust-analyzer 1.85.x #1595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
only14vic opened this issue Mar 21, 2025 · 0 comments
Open

Auto import has broken for rust-analyzer 1.85.x #1595

only14vic opened this issue Mar 21, 2025 · 0 comments

Comments

@only14vic
Copy link

Original issue: rust-lang/rust-analyzer#19401

rust-analyzer version: 1.85.1 (4eb1612 2025-03-15)

rustc version: 1.85.1 (4eb161250 2025-03-15)

editor or extension: vim 9.1.1198-1 + vim-lsp

After updating Rust from the old version 1.84.1 to the new 1.85.x autoimport has stopped adding the module path to the use section of file. At the same time, completion works fine.

If I switch to the old version of Rust 1.84.1 sh# rustup default 1.84 then autoimport works perfectly with the same vim-lsp settings.

I tried different values ​​in granularity.group and granularity.enforce but autoimport did not work.

vim-lsp settings:

au User lsp_setup call lsp#register_server({
    \   'name': 'rust-analyzer',
    \   'cmd': ['rust-analyzer'],
    \   'allowlist': ['rust'],
    \   'initialization_options': {
    \       'lens': { 'enable': v:false, 'debug': { 'enable': v:false } },
    \       'imports': {
    \           'preferPrelude': v:true,
    \           'preferNoStd': v:true,
    \           'granularity': {
    \               'group': 'one',
    \               'enforce': v:true
    \           }
    \       },
    \       'completion': {
    \           'autoimport': { 'enable': v:true },
    \           'callable': { 'snippets': 'add_parentheses' },
    \           'fullFunctionSignatures': { 'enable': v:true },
    \           'snippets': { 'custom': {} },
    \           'postfix': { 'enable': v:false },
    \           'termSearch': { 'enable': v:true, 'fuel': 10000 }
    \       }
    \   }
    \ })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant