项目作者: emilienlemaire

项目描述 :
A plugin to publish clang-tidy checks on neovin lsp diagnostics
高级语言: Lua
项目地址: git://github.com/emilienlemaire/clang-tidy.nvim.git
创建时间: 2021-01-17T18:18:40Z
项目社区:https://github.com/emilienlemaire/clang-tidy.nvim

开源协议:

下载


clang-tidy.nvim

A small plugin to publish clang-tidy diagnostics via the built in lsp diagnostics.

Install

This plugin requires plenary.nvim
You can use your favorite plugin manager to install this plugin.
With packer.nvim :

  1. use 'nvim-lua/plenary.nvim'
  2. use 'emilienlemaire/clang-tidy.nvim'

Usage

Configuration

I recommand using this plugin only in buffer with clangd activated.
You can setup a custom attach function for clangd.

  1. local clang_tidy = require('clang-tidy')
  2. local custom_attach_clangd = function(client)
  3. clang_tidy.setup()
  4. -- rest of the attch function
  5. end
  6. lsp.clangd.setup({
  7. on_attach = custom_attach_clangd,
  8. -- rest of the setup table
  9. })

Custom configuration

You can confure clang-tidy as you wish in the setup function arguments:

  1. require('clang-tidy').setup{
  2. checks = {
  3. '-*',
  4. 'bugprone-*',
  5. 'cppcoreguidelines-avoid-*',
  6. 'readability-identifier-naming',
  7. 'misc-assert-side-effect',
  8. 'readability-container-size-empty-*',
  9. 'modernize-*'
  10. },
  11. ignore_severity = {}
  12. }

Here is the default configuration:

  1. {
  2. cmd = 'clang-tidy', -- The clang-tidy command
  3. checks = {'*'}, -- An array of clang-tidy checks
  4. args = {}, -- An array clang-tidy launching args
  5. cwd = vim.loop.cwd, -- Function: the function to execute to get the cwd
  6. ignore_severity = {
  7. 'note'
  8. } -- An array of severity that you don't wish to publish
  9. }

Running clang-tidy

You can run the clang-tidy plugin with:

  1. require('clang-tidy').run()