Skip to content

Commit dd92dd7

Browse files
authored
Merge pull request #124 from arduino/flag_to_disable_real_time_errors
Added flag to disable real-time PublishDiagnostics push
2 parents 96c7d69 + 4c974dc commit dd92dd7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: ls/ls.go

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type Config struct {
6060
FormatterConf *paths.Path
6161
EnableLogging bool
6262
SkipLibrariesDiscoveryOnRebuild bool
63+
DisableRealTimeDiagnostics bool
6364
}
6465

6566
var yellow = color.New(color.FgHiYellow)
@@ -1191,6 +1192,11 @@ func (ls *INOLanguageServer) CopyFullBuildResults(logger jsonrpc.FunctionLogger,
11911192
}
11921193

11931194
func (ls *INOLanguageServer) PublishDiagnosticsNotifFromClangd(logger jsonrpc.FunctionLogger, clangParams *lsp.PublishDiagnosticsParams) {
1195+
if ls.config.DisableRealTimeDiagnostics {
1196+
logger.Logf("Ignored by configuration")
1197+
return
1198+
}
1199+
11941200
ls.readLock(logger, false)
11951201
defer ls.readUnlock(logger)
11961202

Diff for: main.go

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ func main() {
5353
skipLibrariesDiscoveryOnRebuild := flag.Bool(
5454
"skip-libraries-discovery-on-rebuild", false,
5555
"Skip libraries discovery on rebuild, it will make rebuilds faster but it will fail if the used libraries changes.")
56+
noRealTimeDiagnostics := flag.Bool(
57+
"no-real-time-diagnostics", false,
58+
"Disable real time diagnostics")
5659
flag.Parse()
5760

5861
if *loggingBasePath != "" {
@@ -123,6 +126,7 @@ func main() {
123126
CliDaemonAddress: *cliDaemonAddress,
124127
CliInstanceNumber: *cliDaemonInstanceNumber,
125128
SkipLibrariesDiscoveryOnRebuild: *skipLibrariesDiscoveryOnRebuild,
129+
DisableRealTimeDiagnostics: *noRealTimeDiagnostics,
126130
}
127131

128132
stdio := streams.NewReadWriteCloser(os.Stdin, os.Stdout)

0 commit comments

Comments
 (0)