Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for progress token using Barrier when indexHieFile #4205

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

soulomoon
Copy link
Collaborator

No description provided.

@soulomoon soulomoon force-pushed the soulomoon/wait-for-token-indexHieFile branch from 1440f35 to d70acdb Compare May 2, 2024 23:36
@soulomoon soulomoon changed the title Wait For token using Barrier when indexHieFile Wait for progress token using Barrier when indexHieFile May 3, 2024
@soulomoon soulomoon marked this pull request as ready for review May 3, 2024 01:21
@soulomoon soulomoon requested a review from pepeiborra as a code owner May 3, 2024 01:21
@michaelpj
Copy link
Collaborator

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?

@wz1000
Copy link
Collaborator

wz1000 commented May 3, 2024

This code manages its progress token in a somewhat unique way which is not easy to statically scope with the lsp progress functions.

_ <- LSP.sendRequest LSP.SMethod_WindowWorkDoneProgressCreate (LSP.WorkDoneProgressCreateParams u) (const $ pure ())
b <- liftIO newBarrier
void $ LSP.sendRequest LSP.SMethod_WindowWorkDoneProgressCreate (LSP.WorkDoneProgressCreateParams u) $ liftIO . signalBarrier b
ready <- liftIO $ waitBarrier b
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if its a good idea to delay indexing by an unbounded amount of time waiting for the client to respond with a progress token. Perhaps the progress reporting should be on another thread which doesn't block indexing.

Copy link
Collaborator Author

@soulomoon soulomoon May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but indexHieFile would return without reportProgress actually report done🤔. I am not sure how does it do to our test, I'll see how it goes.

@soulomoon
Copy link
Collaborator Author

soulomoon commented May 3, 2024

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🤔

@soulomoon soulomoon marked this pull request as draft May 4, 2024 13:43
@soulomoon soulomoon marked this pull request as ready for review May 4, 2024 23:43
@soulomoon
Copy link
Collaborator Author

soulomoon commented May 4, 2024

I've spawn a new thread to run the indexing progress update, send through TQueue. 🤔 Is it a good idea to do so?

@soulomoon soulomoon added the status: in discussion Not actionable, because discussion is still ongoing or there's no decision yet label May 5, 2024
@michaelpj
Copy link
Collaborator

I think we can probably do something like #4218 now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in discussion Not actionable, because discussion is still ongoing or there's no decision yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants