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

Provide a Progress support API for lemminx extension #1563

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

angelozerr
Copy link
Contributor

Provide a Progress support API for lemminx extension

Fixes #1562

@angelozerr
Copy link
Contributor Author

angelozerr commented Aug 1, 2023

It should be nice to use this progress support inside lemminx (ex : show a progress bar to notify that XSD is downloading).

Today this support is used for lemminx-maven eclipse-lemminx/lemminx-maven#473

Here how lemminx maven consumes the API https://github.com/eclipse/lemminx-maven/pull/473/files#diff-4a374a968fa37a849d87ec8835bd2a5acd917e74f36992a6866ff24a4e9106c7R244

Basicly:

  1. get progress support
//  you get the progress support in the start of lemminx extension by using regsitry 
this.progressSupport = registry.getProgressSupport();

See https://github.com/eclipse/lemminx-maven/pull/473/files#diff-4a374a968fa37a849d87ec8835bd2a5acd917e74f36992a6866ff24a4e9106c7R183

  1. consume progress support
ProgressMonitor progressMonitor = progressSupport != null ? progressSupport.createProgressMonitor() : null;
//  progressSupport.createProgressMonitor()  return toonull if LSP client cannot support progress

if (progressMonitor != null) {
	progressMonitor.begin("Loading Maven components...", "", 100, null);
}

if (progressMonitor != null) {
	progressMonitor.report("Initializing Plexus container" + getStepMessage(currentStep, nbSteps) + "...", percentage, null);
}

// another call of progressMonitor.report(

...			

progressMonitor.end();

See sample at https://github.com/eclipse/lemminx-maven/pull/473/files#diff-4a374a968fa37a849d87ec8835bd2a5acd917e74f36992a6866ff24a4e9106c7R244

@JessicaJHee JessicaJHee self-requested a review August 1, 2023 22:07
Copy link
Contributor

@JessicaJHee JessicaJHee left a comment

Choose a reason for hiding this comment

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

LGTM! Works well when tested with lemminx-maven

@angelozerr angelozerr merged commit acab0cf into eclipse-lemminx:main Aug 2, 2023
@angelozerr
Copy link
Contributor Author

Thanks so much @JessicaJHee for your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a Progress support API for lemminx extension
2 participants