Skip to content

Commit ecda674

Browse files
committed
Suppress 'anon_bitfield_qualifiers' errors
Those errors are present in the CMSIS-Atmel package, and makes the language server produce other bogus errors as a consquence of parse failure of header files. See arduino/arduino-ide#307 See arduino/arduino-ide#112
1 parent c132863 commit ecda674

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: ls/lsp_client_clangd.go

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ type ClangdLSPClient struct {
2222
}
2323

2424
func NewClangdLSPClient(logger jsonrpc.FunctionLogger, dataFolder *paths.Path, ls *INOLanguageServer) *ClangdLSPClient {
25+
clangdConfFile := ls.buildPath.Join(".clangd")
26+
clangdConf := fmt.Sprintln("Diagnostics:")
27+
clangdConf += fmt.Sprintln(" Suppress: [anon_bitfield_qualifiers]")
28+
clangdConf += fmt.Sprintln("CompileFlags:")
29+
clangdConf += fmt.Sprintln(" Add: -ferror-limit=0")
30+
if err := clangdConfFile.WriteFile([]byte(clangdConf)); err != nil {
31+
logger.Logf("Error writing clangd configuration: %s", err)
32+
}
33+
2534
// Start clangd
2635
args := []string{
2736
ls.config.ClangdPath.String(),

0 commit comments

Comments
 (0)