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

Project fails to run and debug when the file path contains space #212

Closed
absarrahman opened this issue Feb 6, 2024 · 2 comments · Fixed by #214
Closed

Project fails to run and debug when the file path contains space #212

absarrahman opened this issue Feb 6, 2024 · 2 comments · Fixed by #214
Labels
bug Something isn't working

Comments

@absarrahman
Copy link

absarrahman commented Feb 6, 2024

Neovim version (nvim -v)

v0.9.4

Operating system/version

Mac OS 14.3

Output of :checkhealth rustaceanvim

Checking for Lua dependencies ~
- OK [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap) installed.

Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 1.75.0 (82e1608d 2023-12-21)
- OK Cargo: found cargo 1.75.0 (1d8b05cdd 2023-11-20)
- OK rustc: found rustc 1.75.0 (82e1608df 2023-12-21)
- OK debug adapter: found codelldb 

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

mkdir "test is test" && cd $_
cargo new foo
cd foo
nvim .
:RustLsp runnables
1: run foo

Expected behaviour

Hello World

Actual behaviour

zsh:cd:1: too many arguments

[Process exited 1]

The minimal config used to reproduce this issue.

{
        "mrcjkb/rustaceanvim",
        ft = "rust",
        config = function()
            vim.g.rustaceanvim = function()
                local mason_registry = require("mason-registry")

                -- Need codelldb dap from mason
                local codelldb = mason_registry.get_package("codelldb")
                local extension_path = codelldb:get_install_path() .. "/extension/"
                local codelldb_path = extension_path .. "adapter/codelldb"
                local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib"
                return {
                    dap = {
                        adapter = require('rustaceanvim.config').get_codelldb_adapter(codelldb_path, liblldb_path),
                    },

                    server = {
                        on_attach = function(_, bufnr)
                            vim.lsp.inlay_hint.enable(bufnr, true)
                            vim.keymap.set("n", "K", "<cmd>RustLSP hover actions<cr>", { buffer = bufnr })
                            -- Code action groups
                            vim.keymap.set("n", "<Leader>vca", "<cmd>RustLsp codeAction<cr>", { buffer = bufnr })
                            vim.keymap.set(
                                "n",
                                "<leader>dr",
                                "<cmd>RustLsp debuggables<cr>",
                                { desc = "Run Debuggables (Rust)" }
                            )
                        end,
                        settings = {
                            -- rust-analyzer language server configuration
                            ["rust-analyzer"] = {
                                cargo = {
                                    allFeatures = true,
                                    loadOutDirsFromCheck = true,
                                    runBuildScripts = true,
                                },
                                -- Add clippy lints for Rust.
                                checkOnSave = {
                                    allFeatures = true,
                                    command = "clippy",
                                    extraArgs = { "--no-deps" },
                                },
                                procMacro = {
                                    enable = true,
                                    ignored = {
                                        ["async-trait"] = { "async_trait" },
                                        ["napi-derive"] = { "napi" },
                                        ["async-recursion"] = { "async_recursion" },
                                    },
                                },
                            },
                        },
                    },
                    tools = {
                        on_initialized = function()
                            vim.cmd([[
                  augroup RustLSP
                    autocmd CursorHold                      *.rs silent! lua vim.lsp.buf.document_highlight()
                    autocmd CursorMoved,InsertEnter         *.rs silent! lua vim.lsp.buf.clear_references()
                    autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh()
                  augroup END
                ]])
                        end,
                    },
                }
            end
        end
    },
@absarrahman absarrahman added the bug Something isn't working label Feb 6, 2024
@absarrahman
Copy link
Author

absarrahman commented Feb 6, 2024

Screenshot 2024-02-06 at 6 05 00 PM

The project runs and debugs fine if your project directory path does not contain any spaces

@absarrahman
Copy link
Author

absarrahman commented Feb 6, 2024

I have fixed this issue for RustLsp runnables and it is working fine. However, I am not sure how to fix the debugging issue.

This is the commit which I did for the fix
absarrahman@ee0cb37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant