@@ -59,6 +59,27 @@ func openInLSPs(
62+// waitForLSPDiagnostics waits briefly for diagnostics publication after a file
63+// has been opened. Intended for read-only situations where viewing up-to-date
64+// files matters but latency should remain low (i.e. when using the view tool).
65+func waitForLSPDiagnostics(
67+ manager *lsp.Manager,
69+ timeout time.Duration,
71+ if filepath == "" || manager == nil || timeout <= 0 {
75+ for client := range manager.Clients().Seq() {
76+ if !client.HandlesFile(filepath) {
79+ client.WaitForDiagnostics(ctx, timeout)
62// notifyLSPs notifies LSP servers that a file has changed and waits for
83// notifyLSPs notifies LSP servers that a file has changed and waits for
63// updated diagnostics. Use this after edit/multiedit operations.
84// updated diagnostics. Use this after edit/multiedit operations.
64func notifyLSPs(
85func notifyLSPs(