Skip to content

Commit 277add1

Browse files
authored
Merge pull request #92 from arduino/suppress_bitfield_errors
Suppress 'anon_bitfield_qualifiers' errors
2 parents e2ccbfa + af923db commit 277add1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: ls/lsp_client_clangd.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,23 @@ 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(),
2837
"-log=verbose",
2938
fmt.Sprintf(`--compile-commands-dir=%s`, ls.buildPath),
3039
}
3140
if dataFolder != nil {
32-
args = append(args, fmt.Sprintf("-query-driver=%s", dataFolder.Join("packages", "**")))
41+
args = append(args, fmt.Sprintf("-query-driver=%s", dataFolder.Join("packages", "**").Canonical()))
3342
}
3443

3544
logger.Logf(" Starting clangd: %s", strings.Join(args, " "))

0 commit comments

Comments
 (0)