Wait for progress token using Barrier when indexHieFile
Could we refactor this to actually use the helpers from lsp for running progress sessions? I think that should handle all of this properly, rather than us re-implementing it here?
This code manages its progress token in a somewhat unique way which is not easy to statically scope with the lsp progress functions.
Instead of a long runner task, it is more like tunes of small tasks dynamically created only finished when the all the pendding tasks are done. Hard to fit this in helpers from lsp. But we still can if we are handling this in a seperate thread, might need serveral pipes though. And hard to say if it would make thing simpler🤔
I've spawn a new thread to run the indexing progress update, send through TQueue. 🤔 Is it a good idea to do so?
I think we can probably do something like https://github.com/haskell/haskell-language-server/pull/4218 now
I think we can probably do something like #4218 now
It seems, here we are using a push update model. And in #4218, it is a pull update model for every interval. Maybe we can unify to use a pull update model?
Also, I am wondering if we can make Development.IDE.Core.ProgressReporting more general, so we can actually reuse it.
Also, I am wondering if we can make Development.IDE.Core.ProgressReporting more general, so we can actually reuse it.
Yes, I think there's almost something there. It's something like a standalone counter that also has some triggers for killing and restarting it?
The scope quite complex and is hard to fit in.
To solve the scope problem, I refactored the Development.IDE.Core.ProgressReporting to add InProgressStateOutSide. We can let the ouside program manage the state, and ProgressReporting just pull in the todo and done count.
But it seems we lose the finish notification. Any idea? @michaelpj I think it should be fine even if we do not show the finish notification? Or maybe we can add it to LSP package?
Now it becomes resumable/restartable/cancellable progress reporting
We might want to renamed that
ProgressStarted->ProgressNewStarted: cancel the old oneProgressTryToStart->ProgressStarted: won't cancel the old one
After introducing new event capturing more progress reporting logic, we are able to change the indexProgressToken :: Var (Maybe LSP.ProgressToken) to indexProgressReporting :: ProgressReporting IO. Ready to be reviewed again @michaelpj
Needs conflicts fixed then good to go