Skip to content
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

Auto import has broken for vim-lsp #19401

Open
only14vic opened this issue Mar 20, 2025 · 2 comments
Open

Auto import has broken for vim-lsp #19401

only14vic opened this issue Mar 20, 2025 · 2 comments
Labels
C-bug Category: bug

Comments

@only14vic
Copy link

only14vic commented Mar 20, 2025

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 }
    \       }
    \   }
    \ })
@only14vic only14vic added the C-bug Category: bug label Mar 20, 2025
@only14vic
Copy link
Author

I turned on the logs of the LSP server and compared the answers from the old version of Rust-Aanalyzer 1.84.1 and the new version 1.85.1.

In the answers from the new version of Rust-Aanalyzer there is no parameter additionaltextedits, but in the old version there is.

Image

@only14vic
Copy link
Author

only14vic commented Mar 24, 2025

I tried rust-analyzer 1.85.1 with neovim + rust-analyzer plugin. Autoimport doesn't work in it either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant