mfussenegger / nvim-lint

An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support.
GNU General Public License v3.0
1.94k stars 204 forks source link

Integration Issue with cpplint and nvim-lint: No Linting Results Displayed #534

Closed alitokur closed 7 months ago

alitokur commented 7 months ago

I am trying to integrate cpplint with nvim-lint for C++ linting but linting results are not displayed after saving files.

Steps to Reproduce:

1- Install nvim-lint using packer with the following line in my packer configuration file:

use 'mfussenegger/nvim-lint'ua
use 'mfussenegger/nvim-lint'

2- Configure nvim-lint to use cpplint for markdown file types (note: assuming you meant C++ file types, but the provided configuration targets markdown) as shown below:

require('lint').linters_by_ft = {
  markdown = {'cpplint', }
}

3- Set up an autocommand to trigger linting on BufWritePost:

vim.api.nvim_create_autocmd({ "BufWritePost" }, {
  callback = function()
    require("lint").try_lint()
  end,
})

4- Install cpplint via mason

note: I use cmake to generate a compile_commands.json file under the build directory.

mfussenegger commented 7 months ago

Configure nvim-lint to use cpplint for markdown file types (note: assuming you meant C++ file types, but the provided configuration targets markdown) as shown below:

That's just an example for markdown. If you use different linters for different filetypes you need to change it accordingly