File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1203,6 +1203,30 @@ func (ls *INOLanguageServer) PublishDiagnosticsNotifFromClangd(logger jsonrpc.Fu
12031203 }
12041204 }
12051205
1206+ // Try to filter as much bogus errors as possible (due to wrong clang "driver" or missing
1207+ // support for specific embedded CPU architecture).
1208+ for _ , ideParams := range allIdeParams {
1209+ n := 0
1210+ for _ , ideDiag := range ideParams .Diagnostics {
1211+ var code string
1212+ _ = json .Unmarshal (ideDiag .Code , & code )
1213+ switch code {
1214+ case "" :
1215+ // Filter unkown non-string codes
1216+ case "drv_unknown_argument_with_suggestion" :
1217+ // Skip errors like: "Unknown argument '-mlongcalls'; did you mean '-mlong-calls'?"
1218+ case "drv_unknown_argument" :
1219+ // Skip errors like: "Unknown argument: '-mtext-section-literals'"
1220+ default :
1221+ ideParams .Diagnostics [n ] = ideDiag
1222+ n ++
1223+ continue
1224+ }
1225+ logger .Logf ("filtered out diagnostic with error-code: %s" , ideDiag .Code )
1226+ }
1227+ ideParams .Diagnostics = ideParams .Diagnostics [:n ]
1228+ }
1229+
12061230 // Push back to IDE the converted diagnostics
12071231 logger .Logf ("diagnostics to IDE:" )
12081232 for _ , ideParams := range allIdeParams {
You can’t perform that action at this time.
0 commit comments