From 38ac399b58c665589bf6cd90d603aa2f0a210a63 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Mon, 14 Oct 2024 09:51:15 -0700 Subject: [PATCH] Reduce the debounce duration to publish diagnostics to 1s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We received two feedbacks that the 2s timeout is too long. 2s was a somewhat arbitrary choice, let’s reduce it to 1s. Fixes #1753 --- Documentation/Configuration File.md | 2 +- Sources/SKOptions/SourceKitLSPOptions.swift | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Documentation/Configuration File.md b/Documentation/Configuration File.md index 50513d5f..ea03e6df 100644 --- a/Documentation/Configuration File.md +++ b/Documentation/Configuration File.md @@ -47,4 +47,4 @@ The structure of the file is currently not guaranteed to be stable. Options may - `backgroundPreparationMode: "build"|"noLazy"|"enabled"`: Determines how background indexing should prepare a target. Possible values are: `build`: Build a target to prepare it, `noLazy`: Prepare a target without generating object files but do not do lazy type checking and function body skipping, `enabled`: Prepare a target without generating object files and the like - `cancelTextDocumentRequestsOnEditAndClose: bool`: Whether sending a `textDocument/didChange` or `textDocument/didClose` notification for a document should cancel all pending requests for that document. - `experimentalFeatures: string[]`: Experimental features to enable -- `swiftPublishDiagnosticsDebounce`: The time that `SwiftLanguageService` should wait after an edit before starting to compute diagnostics and sending a `PublishDiagnosticsNotification`. +- `swiftPublishDiagnosticsDebounce: double`: The time that `SwiftLanguageService` should wait after an edit before starting to compute diagnostics and sending a `PublishDiagnosticsNotification`. diff --git a/Sources/SKOptions/SourceKitLSPOptions.swift b/Sources/SKOptions/SourceKitLSPOptions.swift index d04136f0..2c5d6452 100644 --- a/Sources/SKOptions/SourceKitLSPOptions.swift +++ b/Sources/SKOptions/SourceKitLSPOptions.swift @@ -297,16 +297,13 @@ public struct SourceKitLSPOptions: Sendable, Codable, Equatable { /// The time that `SwiftLanguageService` should wait after an edit before starting to compute diagnostics and /// sending a `PublishDiagnosticsNotification`. - /// - /// This is mostly intended for testing purposes so we don't need to wait the debouncing time to get a diagnostics - /// notification when running unit tests. public var swiftPublishDiagnosticsDebounceDuration: Double? = nil public var swiftPublishDiagnosticsDebounceDurationOrDefault: Duration { if let swiftPublishDiagnosticsDebounceDuration { return .seconds(swiftPublishDiagnosticsDebounceDuration) } - return .seconds(2) + return .seconds(1) } /// When a task is started that should be displayed to the client as a work done progress, how many milliseconds to