@@ -67,6 +67,15 @@ updateState _ StopProgress st = pure st
67
67
68
68
data InProgress = InProgress { todo , done :: ! Int , current :: ! (HMap. HashMap NormalizedFilePath Int )}
69
69
70
+ recordProgress :: NormalizedFilePath -> (Int -> Int ) -> InProgress -> InProgress
71
+ recordProgress file shift InProgress {.. } = case HMap. alterF alter file current of
72
+ ((prev, new), m') ->
73
+ let todo' = if isJust prev then todo else todo + 1
74
+ done' = if new == 0 then done+ 1 else done
75
+ in InProgress todo' done' m'
76
+ where
77
+ alter x = let x' = maybe (shift 0 ) shift x in ((x,x'), Just x')
78
+
70
79
-- | A 'ProgressReporting' that enqueues Begin and End notifications in a new
71
80
-- thread, with a grace period (nothing will be sent if 'KickCompleted' arrives
72
81
-- before the end of the grace period).
@@ -145,14 +154,7 @@ delayedProgressReporting before after lspEnv optProgressStyle = do
145
154
-- Do not remove the eta-expansion without profiling a session with at
146
155
-- least 1000 modifications.
147
156
where
148
- f shift = void $ modifyVar' var $ \ InProgress {.. } ->
149
- case HMap. alterF alter file current of
150
- ((prev, new), m') ->
151
- let todo' = if isJust prev then todo else todo + 1
152
- done' = if new == 0 then done+ 1 else done
153
- in InProgress todo' done' m'
154
- where
155
- alter x = let x' = maybe (shift 0 ) shift x in ((x,x'), Just x')
157
+ f shift = modifyVar' var $ recordProgress file shift
156
158
157
159
mRunLspT :: Applicative m => Maybe (LSP. LanguageContextEnv c ) -> LSP. LspT c m () -> m ()
158
160
mRunLspT (Just lspEnv) f = LSP. runLspT lspEnv f
0 commit comments