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

Progress extension #2461

Closed
wants to merge 2 commits into from
Closed

Conversation

JPinkney
Copy link
Contributor

This PR contributes a progress extension to Theia. With this PR different parts of theia will be able to contribute a progress report and users can filter through each progress report by their location in theia.

Related issue: #2299

Signed-off-by: jpinkney josh.pinkney@mail.utoronto.ca

@JPinkney JPinkney force-pushed the progress-extension branch 2 times, most recently from 7a0f7f7 to 245a325 Compare July 30, 2018 00:01
@svenefftinge
Copy link
Contributor

Nice!
I noticed that

  • the icon is always spinning even if there are no processes.
  • the pop-up doesn't close when focussing something else

Would be nice if the statusbar shows a bar or at least the percentage, so I don't need to open the pop-up..

@@ -37,7 +37,8 @@
"@theia/typescript": "^0.3.13",
"@theia/userstorage": "^0.3.13",
"@theia/variable-resolver": "^0.3.13",
"@theia/workspace": "^0.3.13"
"@theia/workspace": "^0.3.13",
"@theia/progress-monitor-extension": "^0.3.13"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the name could be simply "progress-monitor".

export class ProgressMonitorService {

protected readonly onContributionAddedOrUpdatedEmitter = new Emitter<ProgressReport>();
public onContributionAdded: Event<ProgressReport> = this.onContributionAddedOrUpdatedEmitter.event;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit strange that the names are not in sync. Should this be onContributionAddedOrUpdated?

this.node.onclick = (e) => {
e.stopPropagation();
};
progressService.onContributionAdded((progressReport: ProgressReport) => {
Copy link
Member

@akosyakov akosyakov Aug 1, 2018

Choose a reason for hiding this comment

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

I would manage the state in ProgressMonitorService to separate a model from a widget and here:

progressService.onChanged(() => this.update());


SEARCH_DELAY = 200;

private progressItems: Map<string, ProgressReport> = new Map();
Copy link
Member

Choose a reason for hiding this comment

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

Should not it be a part of ProgressMonitorService?

packages/progress-monitor/src/browser/progress-widget.tsx Outdated Show resolved Hide resolved
@simark
Copy link
Contributor

simark commented Aug 1, 2018

Just wondering, do you expect to have that many progress items in the progress monitor that it's worth having a search box? What scenario do you have in mind where this would be useful?

@tsmaeder tsmaeder mentioned this pull request Aug 2, 2018
12 tasks
@JPinkney JPinkney force-pushed the progress-extension branch 2 times, most recently from 6b71b48 to 790696d Compare August 7, 2018 20:35
this.addKeyListener(document.body, Key.ESCAPE, e => {
this.closeDialog();
});
this.addEventListener(document.body, 'click', e => {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The onclick for the status bar is set here to toggle whether the modal window is open. That part is needed so that it closes the dialog if anything but the modal window is clicked.

Copy link
Member

@akosyakov akosyakov Aug 8, 2018

Choose a reason for hiding this comment

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

sorry, I don't understand then why code checks that a clicked element should not belong to status bar entry. Should not it check that it does not belong to this.node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to make it so that you could click anywhere and close the modal window. However, that ran into some problems because when you would click the status bar item it would first hit that piece of code and close the dialog then the status bar item onclick would be triggered resulting in an opened dialog. To get around this I just made sure that if the status bar is the item being clicked then it shouldn't close the window here and instead wait for the onclick of the status bar item to close the dialog.

Copy link
Member

@akosyakov akosyakov Aug 8, 2018

Choose a reason for hiding this comment

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

ok

You can get rid of coupling with the status bar entry by making sure that your event listener is first, either by using the capture phase or not attaching a dialog to a status bar entry (since it has higher z-index).

Also, you should use target not srcElement: https://developer.mozilla.org/en-US/docs/Web/API/Event/srcElement

@JPinkney
Copy link
Contributor Author

@kittaakos @simark @akosyakov @svenefftinge Updated. Do you mind doing another review when you get a chance

@@ -66,6 +63,7 @@ export class JavaClientContribution extends BaseLanguageClientContribution {
protected onReady(languageClient: ILanguageClient): void {
languageClient.onNotification(ActionableNotification.type, this.showActionableMessage.bind(this));
languageClient.onNotification(StatusNotification.type, this.showStatusMessage.bind(this));
languageClient.onNotification(ProgressReportNotification.type, this.showProgressReportNotifications.bind(this));
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, I just read up on microsoft/language-server-protocol#70, which proposes a similar protocol extension. Tough it might be not only focused on languages.

Is the JDT LS team aware of this it looks a bit competing, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

@JPinkney could you check the LSP issue? maybe that contains hits for the protocol, which we can add/incorporate for the Progress protocol in Theia. Mapping ProgressReportNotification should not be a big problem.

Copy link
Contributor

@tsmaeder tsmaeder Oct 29, 2018

Choose a reason for hiding this comment

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

@AlexTugarev While I think reporting progress on requests is a great addition, I think it's not necessarily the same thing: in jdt.ls, at least, background tasks are triggered on stuff that is not a reqest, think about a pom.xml being updated by a refactoring: the language server only gets notified with a "didChangeWatchedFiles()", but will start a large scale update, possibly a build as a consequence. As a user, I am interested in knowing when such things are going on.

Copy link
Contributor

Choose a reason for hiding this comment

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

I should have referred to the PR microsoft/vscode-languageserver-node#261, which I consider to be the proposal for LSP#70. As far as I see they've removed the boundary of a request.

packages/progress-monitor/src/browser/progress-widget.tsx Outdated Show resolved Hide resolved
packages/progress-monitor/src/browser/progress-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/status-bar/status-bar.tsx Outdated Show resolved Hide resolved
@AlexTugarev
Copy link
Contributor

First of all, I think this is a very decent way to report progress. Accessing the progress ui by clicking on a statusbar item should not add more distraction, while adding a great possibility to inspect tasks running in background!

I tried this PR with the incorporation into the java extension. Unfortunately see this items. Though it looks like there were couple of updates afterwards, but they were not shown long enough to read them.

screen shot 2018-10-02 at 11 31 45

I'm mentioning this explicitly, as the status report of the JDT LS (which is still there) shows way more details.

I took a snapshot of the websocket frames to show, that there is not much traffic.

screen shot 2018-10-02 at 10 56 53

Signed-off-by: jpinkney <josh.pinkney@mail.utoronto.ca>
@tsmaeder
Copy link
Contributor

tsmaeder commented Nov 5, 2018

@AlexTugarev just to make this clear: you're saying that the UI is not showing the last progress that was received?

@AlexTugarev
Copy link
Contributor

'just tried it again with https://github.com/spring-guides/gs-spring-boot

the only progress item I saw was this:

screen shot 2018-11-05 at 12 25 38

in comparison to that, the status reporting shows many updates and indicates progress quite well.

also, I checked the JS console and that's what I found there:

bundle.js:100279 root ERROR Error: Widget is not attached.
    at Function.detach (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:23974:19)
    at ProgressDialog.../../node_modules/@phosphor/widgets/lib/widget.js.Widget.onCloseRequest (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:23625:20)
    at ProgressDialog.../../packages/core/lib/browser/widgets/widget.js.BaseWidget.onCloseRequest (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:98836:41)
    at ProgressDialog.../../node_modules/@phosphor/widgets/lib/widget.js.Widget.processMessage (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:23584:22)
    at invokeHandler (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:7518:21)
    at Object.sendMessage (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:7254:13)
    at ProgressDialog.../../node_modules/@phosphor/widgets/lib/widget.js.Widget.close (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:23421:33)
    at ProgressDialog.push.../../packages/progress-monitor/lib/browser/progress-dialog.js.ProgressDialog.closeDialog (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/53.bundle.js:141:14)
    at https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/53.bundle.js:303:38
    at CallbackList.../../packages/core/lib/common/event.js.CallbackList.invoke (https://3000-ba2325e4-5178-4432-97e1-fb84ebc30880.ws-eu.gitpod.io/bundle.js:100003:39)

@olexii4
Copy link
Contributor

olexii4 commented May 8, 2019

@JPinkney Do you plan to continue working on this PR?

It is really needed for me. So I am going to continue work on it. WDYT?

@JPinkney
Copy link
Contributor Author

JPinkney commented May 8, 2019

@olexii4 It would be great if you could finish it off! Let me know if you have any questions

@tsmaeder
Copy link
Contributor

tsmaeder commented May 9, 2019

@JPinkney Do you plan to continue working on this PR?

It is really needed for me. So I am going to continue work on it. WDYT?

@olexii4 How do you need this? It's is not the same as the proposed progress API in VS Code.

@olexii4
Copy link
Contributor

olexii4 commented May 10, 2019

@tsmaeder I just need to add any progress when performing any git clone che#12564.
It is really annoying when you don't know what is happening for lots of minutes.

My old PR wasn't approved because of using the same progress as the proposed in API theia#4483.

So I am going to rework it.

@olexii4 olexii4 mentioned this pull request May 17, 2019
@olexii4
Copy link
Contributor

olexii4 commented May 17, 2019

I have created a new PR. Fixed a bug and rebased.

#5176

WDYT?

@JPinkney
Copy link
Contributor Author

I'm going to close this because the other PR is open with the updates and fixes!

@JPinkney JPinkney closed this Jun 10, 2019
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.

8 participants