[X] I have searched the existing issues of trouble.nvim
[X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
v0.9.5 Release
Operating system/version
macOS 14.4.1
Describe the bug
Some diagnostic sources such as Trivy / Tfsec can report findings against directories in addition to files. V2 and V3 of Trouble both error if you move your cursor over one of these findings.
Steps To Reproduce
Install terraform and tflint
In an empty directory, create a main.tf file with the contents: provider "aws" {}
Run the command terraform init from within that folder
Open main.tf with the repro config below
Run :lua require('lint').try_lint()
Run :Trouble diagnostics (or :Trouble workspace_diagnostics for v2)
Scroll down to the last finding for the directory
Boom
Expected Behavior
There should be 2 findings reported, 1 in the local file and another on the module folder. (this makes sense in the context of a Terraform module since any file in the directory could define the version constraint as reported)
~/Code/ 2
├╴ poc/ 1
│ └╴ main.tf 1
│ └╴ Missing version constraint for provider "aws" in `required_providers` () [2, 0]
└╴ poc 1
└╴ terraform "required_version" attribute is required () [1, -1]
When hovering over the last line in the trouble window, Trouble will rapidly repeat calls to try and read the folder's path as if it were a file, giving a flurry of messages:
Error 21:59:55 notify.error Trouble ....local/share/nvim/lazy/trouble.nvim/lua/trouble/util.lua:222: EISDIR: illegal operation on a directory
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
"folke/trouble.nvim",
"mfussenegger/nvim-lint",
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
require("trouble").setup()
local lint = require("lint")
lint.linters_by_ft = {
terraform = { "tfsec" },
}
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Did you check docs and existing issues?
Neovim version (nvim -v)
v0.9.5 Release
Operating system/version
macOS 14.4.1
Describe the bug
Some diagnostic sources such as Trivy / Tfsec can report findings against directories in addition to files. V2 and V3 of Trouble both error if you move your cursor over one of these findings.
Steps To Reproduce
terraform
andtflint
provider "aws" {}
terraform init
from within that folder:lua require('lint').try_lint()
:Trouble diagnostics
(or:Trouble workspace_diagnostics
for v2)Expected Behavior
There should be 2 findings reported, 1 in the local file and another on the module folder. (this makes sense in the context of a Terraform module since any file in the directory could define the version constraint as reported)
When hovering over the last line in the trouble window, Trouble will rapidly repeat calls to try and read the folder's path as if it were a file, giving a flurry of messages:
Repro