Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable clang-tidy for clangd, but not effective #585

Closed
2 tasks done
macrosea opened this issue Mar 20, 2023 · 18 comments
Closed
2 tasks done

Disable clang-tidy for clangd, but not effective #585

macrosea opened this issue Mar 20, 2023 · 18 comments
Labels
bug Something isn't working clangd Clangd(lsp) related issues env Issues caused by incorrect environment settings (terminal, package manager, etc.) lsp LSP related issues upstream Upstream (neovim/plugin) issues

Comments

@macrosea
Copy link

Version confirmation

  • Confirm

Following prerequisites

  • Confirm

Neovim version

NVIM v0.8.2

Operating system/version

macos and ubuntu

Terminal name/version

iTerm

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

Affected language servers

clangd

How to reproduce the issue

modify the file: lua/modules/configs/completion/servers/clangd.lua as the below:

	cmd = {
		"clangd",
		"--background-index",
		"--pch-storage=memory",
		-- You MUST set this arg ↓ to your c/cpp compiler location (if not included)!
		"--query-driver=" .. get_binary_path_list({ "clang++", "clang", "gcc", "g++" }),
		"--clang-tidy=false",
		"--all-scopes-completion",
		"--completion-style=detailed",
		"--header-insertion-decorators",
		"--header-insertion=iwyu",
	},

Actual behavior

diagnostic still not disappear;

Expected behavior

No response

Support info

open a cpp file

Logs

No response

Additional information

No response

@macrosea macrosea added bug Something isn't working lsp LSP related issues labels Mar 20, 2023
@aarnphm
Copy link
Collaborator

aarnphm commented Mar 20, 2023

can you send the output of lua print(vim.inspect(vim.diagnostic.config()))

@rileychc
Copy link

{
["dim/unused"] = true,
float = true,
severity_sort = false,
signs = true,
underline = true,
update_in_insert = false,
virtual_text = true
},,I also need to make it disable

@aarnphm
Copy link
Collaborator

aarnphm commented Mar 20, 2023

Might also have to disable in null-ls https://github.com/ayamir/nvimdots/blob/ed54fd687d7347168b887b8b420d42f520f8b5d6/lua/modules/configs/completion/formatters/clang_format.lua

In this case null-ls is probably getting priority here. You can see running lsp client with LspInfo.

@rileychc
Copy link

What should I do?

@rileychc
Copy link

Pasted Graphic

@CharlesChiuGit
Copy link
Collaborator

comment this line.

"clang_format",

@rileychc

This comment was marked as off-topic.

@rileychc
Copy link

comment this line.

"clang_format",

After I set it up, it didn't work.

@CharlesChiuGit
Copy link
Collaborator

Linters still reports errors after u comment clang_format?

Would u mind share the screenshots? I would lieke to see the format of the diagnostics.

@ayamir
Copy link
Owner

ayamir commented Mar 20, 2023

{ ["dim/unused"] = true, float = true, severity_sort = false, signs = true, underline = true, update_in_insert = false, virtual_text = true },,I also need to make it disable

Open a new issue, don't off-topic.

@ayamir
Copy link
Owner

ayamir commented Mar 20, 2023

@macrosea You can directly remove --clang-tidy and see the result.

@rileychc
Copy link

OK, but , I also want to achieve it ,comment "--clang-tidy" or remove it ,no problem been solved.

@rileychc
Copy link

Linters still reports errors after u comment clang_format?

Would u mind share the screenshots? I would lieke to see the format of the diagnostics.

<img width="263" alt="Pasted Graphic 3" src="https://user-images.githubusercontent.com/116
Pasted Graphic 4
857974/226242901-9f273f77-cc0c-403a-93d4-26dd27d26e53.png">

@CharlesChiuGit
Copy link
Collaborator

Ok, so from the diagnostics, those errors are from lsp and but not null-ls. I don't think u need to change anything related to null-ls ATM.

@rileychc
Copy link

Ok, so from the diagnostics, those errors are from lsp and but not null-ls. I don't think u need to change anything related to null-ls ATM.

Thank you very much.

@ayamir
Copy link
Owner

ayamir commented Mar 20, 2023

You can write a .clang-tidy file under your project root and fill it with below which will ensure disable all of the clang-tidy's check. More info refer to this: https://clang.llvm.org/extra/clang-tidy/.

Checks: '-*'

@ayamir ayamir added the clangd Clangd(lsp) related issues label Mar 20, 2023
@Jint-lzxy Jint-lzxy added env Issues caused by incorrect environment settings (terminal, package manager, etc.) upstream Upstream (neovim/plugin) issues labels Mar 20, 2023
@Jint-lzxy
Copy link
Collaborator

AFAIK This is an upstream issue that might be fixed (perhaps?) in the next release. Current workaround is to create a new config.yaml in the following directory if such file doesn't exist (this is known as a global configuration file):

  • macOS: ~/Library/Preferences/clangd/
  • Other *nix systems: $XDG_CONFIG_HOME/clangd/, if $XDG_CONFIG_HOME is undefined then use ~/.config/clangd/

Then add the following content to that file:

Diagnostics:
  ClangTidy:
    Remove: ["*"]

How should I specify the c++ standard of clangd in that file?

Append to config.yaml:

CompileFlags:
  Add: [-std=c++??] # or gnu++??

cc @rileychc @macrosea

@Jint-lzxy
Copy link
Collaborator

Closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working clangd Clangd(lsp) related issues env Issues caused by incorrect environment settings (terminal, package manager, etc.) lsp LSP related issues upstream Upstream (neovim/plugin) issues
Projects
None yet
Development

No branches or pull requests

6 participants