This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
checkstyle config #1421
Answered
by
jose-elias-alvarez
sangramsingha
asked this question in
Q&A
-
Hi, I'm new to neovim and trying to config null-ls for java linting. Null-ls log
Null-ls config local java_project_path = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h")
...
diagnostics.checkstyle.with({
timeout = 20000,
filetypes = {"java"},
args = {
"-f", "sarif",
"-c" , "/google_checks.xml",
-- vim.fn.expand "%:P" --doesn't work
-- vim.api.nvim_buf_get_name(0) -- neither this
-- java_project_path .. "/src/main/java/" -- this work but its too slow on projects with lot of java files
}
}) is there a way to pass single file path from the current buffer to null-ls checkstyle. |
Beta Was this translation helpful? Give feedback.
Answered by
jose-elias-alvarez
Mar 4, 2023
Replies: 1 comment 1 reply
-
The issue with your first two approaches is that you are passing in the path to the buffer when Neovim is opened, not when the source actually runs. This may work: diagnostics.checkstyle.with({
timeout = 20000,
filetypes = { "java" },
args = function(params)
return {
"-f",
"sarif",
"-c",
"/google_checks.xml",
params.bufname,
}
end,
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sangramsingha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The issue with your first two approaches is that you are passing in the path to the buffer when Neovim is opened, not when the source actually runs. This may work: