simrat39 / rust-tools.nvim

Tools for better development in rust using neovim's builtin lsp
MIT License
2.16k stars 158 forks source link

How to execute the "Run Test" inlay ? #374

Open elankath opened 1 year ago

elankath commented 1 year ago

New to both neovim and rust-tools so I apologize if this issue is not caused by this plugin or I am asking something very stupid. I have Rust tools installed and get this nice inlay with an arrow icon to Run/Debug the current test.

RustRunTestInlay

But clicking on the arrow does nothing. (Its just an inlay and does not appear to be selectable or receive clicks). Is there any way to execute the current test using this arrow inlay and not by using RustRunnables and selecting the test every time ? Why even bother showing this inlay if it cannot receive events ?

cshuaimin commented 1 year ago

It's lsp code lens, not inlay hints. You should bind a key to vim.lsp.codelens.run().

cathaysia commented 1 year ago

Why I don't have this?

image

here is my settings:

require('rust-tools').setup({
    server = {
        settings = {
            ['rust-analyzer'] = {
                completion = {
                    privateEditable = {
                        enable = true,
                    },
                },
                { references = {
                    excludeImports = true,
                } },
            },
        },
    },
    dap = {
        adapter = require('rust-tools.dap').get_codelldb_adapter(
            vim.env.HOME .. '/.local/share/nvim/mason/bin/codelldb',
            vim.env.HOME
                .. '/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.'
                .. (vim.loop.os_uname().sysname == 'Linux' and 'so' or 'dylib')
        ),
    },
})
cathaysia commented 1 year ago

any idea about this?

cshuaimin commented 1 year ago

@cathaysia Do you refresh codelens (vim.lsp.codelens.refresh()) in an autocmd? e.g. in LunarVim

cathaysia commented 1 year ago

thanks, this works for me. :)


From: Chen Shuaimin @.> Sent: Monday, June 26, 2023 12:23:54 PM To: simrat39/rust-tools.nvim @.> Cc: DragonBillow @.>; Mention @.> Subject: Re: [simrat39/rust-tools.nvim] How to execute the "Run Test" inlay ? (Issue #374)

@cathaysiahttps://github.com/cathaysia Do you refresh codelens (vim.lsp.codelens.refresh()) in an autocmd? e.g. in LunarVimhttps://github.com/LunarVim/LunarVim/blob/407e7b05eace59f571730f7d1467c39f7ba73a90/lua/lvim/lsp/utils.lua#L125-L149

― Reply to this email directly, view it on GitHubhttps://github.com/simrat39/rust-tools.nvim/issues/374#issuecomment-1606572103, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKBJ6AJADXQ4RY3P5JKZXJ3XNEFFVANCNFSM6AAAAAAXIULIV4. You are receiving this because you were mentioned.Message ID: @.***>

llllvvuu commented 1 year ago

It can also be run using hover command: K and then K again to enter the window