-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")
local function join_paths(...)
local path_sep = on_windows and "\\" or "/"
local result = table.concat({ ... }, path_sep)
return result
end
vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])
local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"
vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))
local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")
local null_ls_config = function()
local null_ls = require("null-ls")
local null_ls_utils = require("null-ls.utils")
local diagnostics = null_ls.builtins.diagnostics
-- add only what you need to reproduce your issue
null_ls.setup({
root_dir = null_ls_utils.root_pattern("selene.toml"),
sources = {
diagnostics.selene.with({
condition = function(utils)
return utils.root_has_file({ "selene.toml" })
end,
}),
},
debug = true,
})
end
local function load_plugins()
-- only add other plugins if they are necessary to reproduce the issue
require("packer").startup({
{
"wbthomason/packer.nvim",
{
"nvimtools/none-ls.nvim",
requires = { "nvim-lua/plenary.nvim" },
config = null_ls_config,
},
},
config = {
package_root = package_root,
compile_path = compile_path,
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
load_plugins()
require("packer").sync()
else
load_plugins()
require("packer").sync()
end
In a testing enviroment (a directory for a lua project), have the following files.
[DEBUG Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/sources.lua:82: registering conditional source selene
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/client.lua:114: starting null-ls client
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method initialize
[DEBUG Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/client.lua:182: unable to notify client for method textDocument/didOpen (client not active): {
textDocument = {
uri = "file:///Users/aome/dev/nvim_plugins/colorscheme-installer.nvim/.luacheckrc"
}
}
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method initialized
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didOpen
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:329: spawning command "selene" at /Users/aome/dev/nvim_plugins/colorscheme-installer.nvim with args { "--display-style", "quiet", "-" }
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:207: error output: nil
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:208: output: -:2:1: warning[unscoped_variables]: `cache` is not declared locally, and will be available in every scope
-:2:1: warning[unused_variable]: cache is defined, but never used
-:4:1: warning[unscoped_variables]: `ignore` is not declared locally, and will be available in every scope
-:4:1: warning[unused_variable]: ignore is defined, but never used
-:11:1: warning[unscoped_variables]: `read_globals` is not declared locally, and will be available in every scope
-:11:1: warning[unused_variable]: read_globals is defined, but never used
-:15:1: warning[unscoped_variables]: `include_files` is not declared locally, and will be available in every scope
-:15:1: warning[unused_variable]: include_files is defined, but never used
-:16:1: warning[unscoped_variables]: `exclude_files` is not declared locally, and will be available in every scope
-:16:1: warning[unused_variable]: exclude_files is defined, but never used
Results:
0 errors
10 warnings
0 parse errors
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/diagnostics.lua:181: received diagnostics from source 1
[TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/diagnostics.lua:182: { {
code = "unscoped_variables",
col = 0,
end_col = 5,
end_lnum = 1,
lnum = 1,
message = "`cache` is not declared locally, and will be available in every scope",
row = "2",
severity = 2,
source = "selene"
}, {
code = "unused_variable",
col = 0,
end_col = 5,
end_lnum = 1,
lnum = 1,
message = "cache is defined, but never used",
row = "2",
severity = 2,
source = "selene"
}, {
code = "unscoped_variables",
col = 0,
end_col = 6,
end_lnum = 3,
lnum = 3,
message = "`ignore` is not declared locally, and will be available in every scope",
row = "4",
severity = 2,
source = "selene"
}, {
code = "unused_variable",
col = 0,
end_col = 6,
end_lnum = 3,
lnum = 3,
message = "ignore is defined, but never used",
row = "4",
severity = 2,
source = "selene"
}, {
code = "unscoped_variables",
col = 0,
end_col = 12,
end_lnum = 10,
lnum = 10,
message = "`read_globals` is not declared locally, and will be available in every scope",
row = "11",
severity = 2,
source = "selene"
}, {
code = "unused_variable",
col = 0,
end_col = 12,
end_lnum = 10,
lnum = 10,
message = "read_globals is defined, but never used",
row = "11",
severity = 2,
source = "selene"
}, {
code = "unscoped_variables",
col = 0,
end_col = 13,
end_lnum = 14,
lnum = 14,
message = "`include_files` is not declared locally, and will be available in every scope",
row = "15",
severity = 2,
source = "selene"
}, {
code = "unused_variable",
col = 0,
end_col = 13,
end_lnum = 14,
lnum = 14,
message = "include_files is defined, but never used",
row = "15",
severity = 2,
source = "selene"
}, {
code = "unscoped_variables",
col = 0,
end_col = 13,
end_lnum = 15,
lnum = 15,
message = "`exclude_files` is not declared locally, and will be available in every scope",
row = "16",
severity = 2,
source = "selene"
}, {
code = "unused_variable",
col = 0,
end_col = 13,
end_lnum = 15,
lnum = 15,
message = "exclude_files is defined, but never used",
row = "16",
severity = 2,
source = "selene"
} }
FAQ
Issues
Neovim Version
NVIM v0.9.5 Build type: RelWithDebInfo LuaJIT 2.1.1692716794
Dev Version?
Operating System
MacOS 14.4.1
Minimal Config
Steps to Reproduce
In a testing enviroment (a directory for a lua project), have the following files.
selene.tomlfile with the following config:neovim.ymlfile with the following config:.luacheckrcfile with the following config:nvim --clean -u minimal_init.luaand navigate to:e .luacheckrcReproducibility Check
minimal_init.luatemplate and that my issue is reproducible by runningnvim --clean -u minimal_init.luaand following the steps above.Expected Behavior
To not display any diagnostics from
seleneinside excluded files.Actual Behavior
Displaying diagnostics from
seleneinside excluded files.Debug Log
[DEBUG Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/sources.lua:82: registering conditional source selene [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/client.lua:114: starting null-ls client [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method initialize [DEBUG Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/client.lua:182: unable to notify client for method textDocument/didOpen (client not active): { textDocument = { uri = "file:///Users/aome/dev/nvim_plugins/colorscheme-installer.nvim/.luacheckrc" } } [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method initialized [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didOpen [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN [DEBUG Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:329: spawning command "selene" at /Users/aome/dev/nvim_plugins/colorscheme-installer.nvim with args { "--display-style", "quiet", "-" } [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:207: error output: nil [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:208: output: -:2:1: warning[unscoped_variables]: `cache` is not declared locally, and will be available in every scope -:2:1: warning[unused_variable]: cache is defined, but never used -:4:1: warning[unscoped_variables]: `ignore` is not declared locally, and will be available in every scope -:4:1: warning[unused_variable]: ignore is defined, but never used -:11:1: warning[unscoped_variables]: `read_globals` is not declared locally, and will be available in every scope -:11:1: warning[unused_variable]: read_globals is defined, but never used -:15:1: warning[unscoped_variables]: `include_files` is not declared locally, and will be available in every scope -:15:1: warning[unused_variable]: include_files is defined, but never used -:16:1: warning[unscoped_variables]: `exclude_files` is not declared locally, and will be available in every scope -:16:1: warning[unused_variable]: exclude_files is defined, but never used Results: 0 errors 10 warnings 0 parse errors [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/diagnostics.lua:181: received diagnostics from source 1 [TRACE Thu May 9 14:45:59 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/diagnostics.lua:182: { { code = "unscoped_variables", col = 0, end_col = 5, end_lnum = 1, lnum = 1, message = "`cache` is not declared locally, and will be available in every scope", row = "2", severity = 2, source = "selene" }, { code = "unused_variable", col = 0, end_col = 5, end_lnum = 1, lnum = 1, message = "cache is defined, but never used", row = "2", severity = 2, source = "selene" }, { code = "unscoped_variables", col = 0, end_col = 6, end_lnum = 3, lnum = 3, message = "`ignore` is not declared locally, and will be available in every scope", row = "4", severity = 2, source = "selene" }, { code = "unused_variable", col = 0, end_col = 6, end_lnum = 3, lnum = 3, message = "ignore is defined, but never used", row = "4", severity = 2, source = "selene" }, { code = "unscoped_variables", col = 0, end_col = 12, end_lnum = 10, lnum = 10, message = "`read_globals` is not declared locally, and will be available in every scope", row = "11", severity = 2, source = "selene" }, { code = "unused_variable", col = 0, end_col = 12, end_lnum = 10, lnum = 10, message = "read_globals is defined, but never used", row = "11", severity = 2, source = "selene" }, { code = "unscoped_variables", col = 0, end_col = 13, end_lnum = 14, lnum = 14, message = "`include_files` is not declared locally, and will be available in every scope", row = "15", severity = 2, source = "selene" }, { code = "unused_variable", col = 0, end_col = 13, end_lnum = 14, lnum = 14, message = "include_files is defined, but never used", row = "15", severity = 2, source = "selene" }, { code = "unscoped_variables", col = 0, end_col = 13, end_lnum = 15, lnum = 15, message = "`exclude_files` is not declared locally, and will be available in every scope", row = "16", severity = 2, source = "selene" }, { code = "unused_variable", col = 0, end_col = 13, end_lnum = 15, lnum = 15, message = "exclude_files is defined, but never used", row = "16", severity = 2, source = "selene" } }Help
No
Implementation Help
No response
Requirements