mrcjkb / rustaceanvim

Supercharge your Rust experience in Neovim! A heavily modified fork of rust-tools.nvim
GNU General Public License v2.0
1.3k stars 47 forks source link

Symbol search kind default not being applied correctly #410

Closed willhansen closed 1 month ago

willhansen commented 1 month ago

Have you read the docs and searched existing issues?

Neovim version (nvim -v)

v0.10

Operating system/version

Operating System: Linux Mint 21.3, Nixpkgs 23.11

Output of :checkhealth rustaceanvim

==============================================================================
rustaceanvim: require("rustaceanvim.health").check()

Checking for Lua dependencies ~
- WARNING dap not installed. Needed for debugging features [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap)

Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 2024-04-08
- OK Cargo: found cargo 1.77.1
- OK rustc: found rustc 1.77.1 (7cf61ebde 2024-03-27) (built from a source tarball)
- OK lldb: found lldb version 17.0.6

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

Checking for tree-sitter parser ~
- OK tree-sitter parser for Rust detected.

How to reproduce the issue

:Telescope lsp_document_symbols

Expected behaviour

see all symbols (like functions)

Actual behaviour

see only types

Suspected cause:

https://github.com/rust-lang/rust-analyzer/blob/a55e8bf09cdfc25066b77823cc98976a51af8a8b/crates/rust-analyzer/src/config.rs#L2758

https://github.com/mrcjkb/rustaceanvim/blob/90bfbc588fef7e44d82e5aba8dfc787e8d3f5d1a/lua/rustaceanvim/commands/workspace_symbol.lua#L14

The minimal config used to reproduce this issue.

Using lazy.nvim

Has issue:

{
    "mrcjkb/rustaceanvim",
    version = '^4', -- Recommended
    lazy = false, -- load on startup
},

This seems to fix it:

{
    "mrcjkb/rustaceanvim",
    version = '^4', -- Recommended
    lazy = false, -- load on startup
    opts = {
    },
    config = function(_, opts) 
      vim.g.rustaceanvim = {
        server = {
          default_settings = {
            ['rust-analyzer'] = {
              workspace = {
                symbol = {
                  search = {
                    kind = "all_symbols"
                  }
                }
              }
            }
          }
        }
      }
    end
  },
mrcjkb commented 1 month ago

Hey :wave:

The "suspected cause" you listed is correct. That request is made only by the :RustLsp workspaceSymbol command.

:Telescope lsp_document_symbols uses Neovim's built-in request, which, as you've correctly discovered, needs to be configured in the rust-analyzer settings.