simrat39 / rust-tools.nvim

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

Run :RustViewCrateGraph failed #68

Open hungrybirder opened 2 years ago

hungrybirder commented 2 years ago

HI @simrat39

Thanks for this useful plugin.

I got an issue.

cd tmp
cargo new hello_cargo
cd hello_cargo
nvim src/main.rs

and run :RustViewCrateGraph command. image

:RustViewCrateGraph doesn't work well.

Some Info rust-tools.nvim: eb6ac6ca69ec76fb5fde75d421022f6fd474629f

NVIM v0.6.0-dev+355-g187e3a3b7raph. This may take a while... Build type: Release LuaJIT 2.1.0-beta3

cargo 1.48.0 (65cbdd2dc 2020-10-14) rust: stable 1.55.0 (bottled), HEAD

macOS Big Sur Version 11.6 with XQuartz installed.

nvim for rust config

-- setup rust-tools
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
  properties = {
    'documentation',
    'detail',
    'additionalTextEdits',
  }
}
capabilities = vim.tbl_extend('keep', capabilities or {}, lsp_status.capabilities)

capabilities.experimental = {}
capabilities.experimental.hoverActions = true

local opts = {
    tools = {
      autoSetHints = true,
      hover_with_actions = true,
      runnables = {
          use_telescope = true
      },
      debuggables = {
          use_telescope = true
      },
      inlay_hints = {
          show_parameter_hints = true,
          parameter_hints_prefix = "<-",
          other_hints_prefix  = "=>",
      },
      hover_actions = {
        border = {
          {"╭", "FloatBorder"}, {"─", "FloatBorder"},
          {"╮", "FloatBorder"}, {"│", "FloatBorder"},
          {"╯", "FloatBorder"}, {"─", "FloatBorder"},
          {"╰", "FloatBorder"}, {"│", "FloatBorder"}
        },
        -- whether the hover action window gets automatically focused
        auto_focus = true
      },
      crate_graph = {
        -- Backend used for displaying the graph
        -- see: https://graphviz.org/docs/outputs/
        -- default: x11
        backend = "x11",
        -- where to store the output, nil for no output stored (relative
        -- path from pwd)
        -- default: nil
        output = nil,
        -- true for all crates.io and external crates, false only the local
        -- crates
        -- default: true
        full = true,
        -- enabled_graphviz_backends = {
        --   "bmp", "cgimage", "canon", "dot", "gv", "xdot", "xdot1.2", "xdot1.4",
        --   "eps", "exr", "fig", "gd", "gd2", "gif", "gtk", "ico", "cmap", "ismap",
        --   "imap", "cmapx", "imap_np", "cmapx_np", "jpg", "jpeg", "jpe", "jp2",
        --   "json", "json0", "dot_json", "xdot_json", "pdf", "pic", "pct", "pict",
        --   "plain", "plain-ext", "png", "pov", "ps", "ps2", "psd", "sgi", "svg",
        --   "svgz", "tga", "tiff", "tif", "tk", "vml", "vmlz", "wbmp", "webp", "xlib",
        --   "x11"
        -- }
      }
    },
    server = { -- setup rust_analyzer
      on_attach = lsp_on_attach,
      capabilities = capabilities,
    },
    -- dap = {
    --   adapter = {
    --     type = 'executable',
    --     command = 'lldb-vscode',
    --     name = "rt_lldb"
    --   }
    -- }
}

require('rust-tools').setup(opts)
-- setup rust-tools end

If my config or something is wrong, please let me know.

Thank you.

simrat39 commented 2 years ago

I'm guessing the x11 backend is not supported on mac os. Try changing it to something else in the config.

EmilLuta commented 1 year ago

Hi there. @simrat39 I have the same issue. I tried changing my config to:

backend = "jpg",

for instance, but it'll still force it to x11, receiving the same error message as above (Format: "x11" ...).

Would it be possible that the option is not used (maybe a bug)?