From 4c974dcabe0ec31c6ab7ad9907e5b87a360e714f Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 14 Jul 2022 15:33:00 +0200 Subject: [PATCH] Added flag to disable real-time PublishDiagnostics push --- ls/ls.go | 6 ++++++ main.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/ls/ls.go b/ls/ls.go index 4279028..99de0a0 100644 --- a/ls/ls.go +++ b/ls/ls.go @@ -60,6 +60,7 @@ type Config struct { FormatterConf *paths.Path EnableLogging bool SkipLibrariesDiscoveryOnRebuild bool + DisableRealTimeDiagnostics bool } var yellow = color.New(color.FgHiYellow) @@ -1191,6 +1192,11 @@ func (ls *INOLanguageServer) CopyFullBuildResults(logger jsonrpc.FunctionLogger, } func (ls *INOLanguageServer) PublishDiagnosticsNotifFromClangd(logger jsonrpc.FunctionLogger, clangParams *lsp.PublishDiagnosticsParams) { + if ls.config.DisableRealTimeDiagnostics { + logger.Logf("Ignored by configuration") + return + } + ls.readLock(logger, false) defer ls.readUnlock(logger) diff --git a/main.go b/main.go index 5c10e6d..1c3cd3c 100644 --- a/main.go +++ b/main.go @@ -53,6 +53,9 @@ func main() { skipLibrariesDiscoveryOnRebuild := flag.Bool( "skip-libraries-discovery-on-rebuild", false, "Skip libraries discovery on rebuild, it will make rebuilds faster but it will fail if the used libraries changes.") + noRealTimeDiagnostics := flag.Bool( + "no-real-time-diagnostics", false, + "Disable real time diagnostics") flag.Parse() if *loggingBasePath != "" { @@ -123,6 +126,7 @@ func main() { CliDaemonAddress: *cliDaemonAddress, CliInstanceNumber: *cliDaemonInstanceNumber, SkipLibrariesDiscoveryOnRebuild: *skipLibrariesDiscoveryOnRebuild, + DisableRealTimeDiagnostics: *noRealTimeDiagnostics, } stdio := streams.NewReadWriteCloser(os.Stdin, os.Stdout)