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

dap.autoload_configurations causes errors when opening files outside of workspace #182

Closed
eero-lehtinen opened this issue Jan 25, 2024 · 1 comment · Fixed by #183
Closed
Labels
bug Something isn't working

Comments

@eero-lehtinen
Copy link
Contributor

eero-lehtinen commented Jan 25, 2024

Neovim version (nvim -v)

v0.10.0 (latest nightly)

Operating system/version

EndeavourOS

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 0.3.1815-standalone
- 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.

How to reproduce the issue

mkdir -p /tmp/minimal/
NVIM_DATA_MINIMAL="/tmp/minimal" NVIM_APP_NAME="nvim-minimal" nvim -u minimal.lua

Open file:

fn main() {
    println!("Hello, world!");
}


Use vim.lsp.buf.definition on `println!`.

Expected behaviour

No errors.

Actual behaviour

Shows error

Error executing luv callback:                                                                                                                                              
vim/fs.lua:0: invalid value (nil) at index 1 in table for 'concat'                                                                                                         
stack traceback:                                                                                                                                                           
        [C]: in function 'concat'                                                                                                                                          
        vim/fs.lua: in function 'joinpath'                                                                                                                                 
        /tmp/minimal/rustaceanvim/lua/rustaceanvim/dap.lua:197: in function 'on_exit'                                                                                      
        ...nt_nvim3WUxQh/usr/share/nvim/runtime/lua/vim/_system.lua:297: in function <...nt_nvim3WUxQh/usr/share/nvim/runtime/lua/vim/_system.lua:267>

Doesn't actually break anything and happens only the first time, but the message popping up is annoying.
The error doesn't show up if dap.autoload_configurations is false.

The minimal config used to reproduce this issue.

-- Minimal nvim config with lazy
-- Assumes a directory in $NVIM_DATA_MINIMAL
-- Start with
--
-- export NVIM_DATA_MINIMAL=$(mktemp -d)
-- export NVIM_APP_NAME="nvim-ht-minimal"
-- nvim -u minimal.lua
--
-- Then exit out of neovim and start again.

-- Ignore default config
local config_path = vim.fn.stdpath("config")
vim.opt.rtp:remove(config_path)

-- Ignore default plugins
local data_path = vim.fn.stdpath("data")
local pack_path = data_path .. "/site"
vim.opt.packpath:remove(pack_path)

-- bootstrap lazy.nvim
data_path = assert(os.getenv("NVIM_DATA_MINIMAL"), "$NVIM_DATA_MINIMAL environment variable not set!")
local lazypath = data_path .. "/lazy/lazy.nvim"
local uv = vim.uv
	---@diagnostic disable-next-line: deprecated
	or vim.loop
if not uv.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"git@github.com:folke/lazy.nvim.git",
		"--branch=stable",
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

local lazy = require("lazy")

lazy.setup({
	{
		"mrcjkb/rustaceanvim",
		version = "^3",
		init = function()
			vim.g.rustaceanvim = {}

			vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "LSP: Go to definition" })
		end,
		ft = { "rust" },
	},
	{ "williamboman/mason.nvim", config = true },
	{
		"mfussenegger/nvim-dap",
		dependencies = {
			"williamboman/mason.nvim",
			"jay-babu/mason-nvim-dap.nvim",
		},
		event = "VeryLazy",
		config = function()
			require("mason-nvim-dap").setup({
				automatic_installation = false,
				ensure_installed = {
					"codelldb",
				},
			})

			local dap = require("dap")
			vim.keymap.set("n", "<F5>", dap.continue, { desc = "Debug: Start/Continue" })
			vim.keymap.set("n", "<space>b", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" })
		end,
	},
	-- Add any other plugins needed to reproduce the issue.
	-- see https://github.com/folke/lazy.nvim#-lazynvim for details.
}, { root = data_path, state = data_path .. "/lazy-state.json", lockfile = data_path .. "/lazy-lock.json" })
@eero-lehtinen eero-lehtinen added the bug Something isn't working label Jan 25, 2024
@mrcjkb
Copy link
Owner

mrcjkb commented Jan 25, 2024

Hey 👋

Thanks for reporting. Should be an easy fix 😄

@mrcjkb mrcjkb linked a pull request Jan 25, 2024 that will close this issue
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.

2 participants