Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 073039a

Browse filesBrowse files
committed
Try to filter as much bogus errors as possible
Those errors are mostly due to mismatching clang "driver" or missing support for specific embedded CPU architecture.
1 parent 3b7271a commit 073039a
Copy full SHA for 073039a

File tree

Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed

‎ls/ls.go

Copy file name to clipboardExpand all lines: ls/ls.go
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.