-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Progress extension #2461
Conversation
7a0f7f7
to
245a325
Compare
Nice!
Would be nice if the statusbar shows a bar or at least the percentage, so I don't need to open the pop-up.. |
examples/browser/package.json
Outdated
@@ -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" |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
?
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? |
packages/progress-monitor/src/browser/progress-monitor-frontend-module.ts
Outdated
Show resolved
Hide resolved
6b71b48
to
790696d
Compare
this.addKeyListener(document.body, Key.ESCAPE, e => { | ||
this.closeDialog(); | ||
}); | ||
this.addEventListener(document.body, 'click', e => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
packages/progress-monitor/src/browser/progress-monitor-frontend-module.ts
Outdated
Show resolved
Hide resolved
0725529
to
632fa49
Compare
@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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. 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. |
Signed-off-by: jpinkney <josh.pinkney@mail.utoronto.ca>
632fa49
to
b2b15a8
Compare
@AlexTugarev just to make this clear: you're saying that the UI is not showing the last progress that was received? |
'just tried it again with the only progress item I saw was this: 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:
|
@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 It would be great if you could finish it off! Let me know if you have any questions |
@tsmaeder I just need to add any progress when performing any git clone che#12564. 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. |
I have created a new PR. Fixed a bug and rebased. WDYT? |
I'm going to close this because the other PR is open with the updates and fixes! |
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