Skip to content

Commit

Permalink
Fixes the .BufferedDebounce to actualy buffer
Browse files Browse the repository at this point in the history
this was processing observable windows as they came in instead of waiting for them the close.
  • Loading branch information
TheAngryByrd committed Oct 11, 2022
1 parent 0a184c5 commit 00fd659
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar
do
disposables.Add(
(notifications.Publish :> IObservable<_>)
// .BufferedDebounce(TimeSpan.FromMilliseconds(200.))
// .SelectMany(fun l -> l.Distinct())
.BufferedDebounce(TimeSpan.FromMilliseconds(200.))
.SelectMany(fun l -> l.Distinct())
.Subscribe(fun e -> handleCommandEvents e)
)

Expand Down
2 changes: 1 addition & 1 deletion src/FsAutoComplete/LspServers/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ module ObservableExtensions =

/// Fires an event only after the specified interval has passed in which no other pending event has fired. Buffers all events leading up to that emit.
member x.BufferedDebounce(ts: TimeSpan) =
x.Publish(fun shared -> shared.Window(shared.Throttle(ts)))
x.Publish(fun shared -> shared.Window(shared.Throttle(ts))).SelectMany(fun l -> l.ToList())

module Helpers =
let notImplemented<'t> = async.Return LspResult.notImplemented<'t>
Expand Down

0 comments on commit 00fd659

Please sign in to comment.