-
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
Apply vscode Timeline Plugin API #7997
Conversation
examples/browser/package.json
Outdated
@@ -48,6 +48,7 @@ | |||
"@theia/search-in-workspace": "^1.2.0", | |||
"@theia/task": "^1.2.0", | |||
"@theia/terminal": "^1.2.0", | |||
"@theia/timeline": "^1.2.0", |
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.
Let's keep the browser app in sync with the electron one.
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.
done
Is it somehow based on the current git history implementation or there is no sense in reusing it? |
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 did the first round of code review.
this.containerLayout.addWidget(this.timelineEmptyWidget); | ||
|
||
this.refresh(); | ||
this.timelineService.onDidChangeTimeline(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.
always collect all listeners into this.toDispose
Please profile and check that when you close the widget that it does not leak. Please add it to How to test
section for reviewers.
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.
export class TimelineContribution implements FrontendApplicationContribution { | ||
|
||
@inject(FileNavigatorContribution) | ||
protected readonly explorer: FileNavigatorContribution; |
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.
not used?
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 is used to add the timeline widget to explorer:
explorer.addWidget(timeline, { initiallyCollapsed: true }); |
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 could not find any usages, please check again. Please do it by using find references, not find in text.
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.
removed the leftovers
protected readonly timelineService: TimelineService; | ||
|
||
async onDidInitializeLayout?(app: FrontendApplication): Promise<void> { | ||
const explorer = await this.widgetManager.getWidget(EXPLORER_VIEW_CONTAINER_ID); |
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.
We should instead listen when widgetManager fires onWillCreate
event and if a new widget is explorer then we shoudl participate and add the timeline, otherwise we eagerly create a widget even if a user does not see it.
See PluginViewRegistry
how we add views on demand.
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.
Now, the timeline widget is created only when timeline provider
is registered:
theia/packages/timeline/src/browser/timeline-contribution.ts
Lines 57 to 61 in 5a0eec1
this.timelineService.onDidChangeProviders( async event => { | |
if (explorer instanceof ViewContainer) { | |
if (event.added && event.added.length > 0 && explorer.getTrackableWidgets().indexOf(timeline) === -1) { | |
timeline = await this.widgetManager.getOrCreateWidget(TimelineWidget.ID); | |
explorer.addWidget(timeline, { initiallyCollapsed: true }); |
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.
getWidget
creates a new widget eagerly, so timeline is only added once in onDidInitializeLayout
.
We should instead participate in creation of the explorer view container and add the timline widget each time via widgetManager.onWillCreate
event. Try to completely close and open the explorer tab.
@akosyakov @kittaakos Thank you for your review. I will be able to answer all your comments after 30-th june, because I am on PTO right now. |
@vinokurig enjoy your time off, there is no hurry! |
I've fixed the plugin link, please download the the patched plugin and replace it. |
I rebuilt the sources, re-downloaded the git vsix. But Timeline panel is still not present 🤷 |
Thanks for doing the initial contribution of the timeline. I have a couple of questions.
|
Sorry, updated the link again, now it should work |
I had assumed that the git history view would be updated to use the timeline view. However I have now realized that the timeline view is designed to show items for a single file only, so perhaps using the same view is not a good idea (though our git package will need to contribute to the timeline). Also we have more flexibility if git history is a different view. For example I experimented with adding a graph of branches to the history view (though I had not got it into a state good enough for a PR). |
Timeline will need to support folders eventually as well: microsoft/vscode#95332 Not sure why we need to support double code doing the same and giving different UX. |
We would use the same base code
When I am looking at file or folder history, I am typically looking into understanding the details of the code in that file or folder. When I am looking at repository history I am more likely to be managing commits (rebasing, merging etc). Different work, different UX. Maybe it can all be shoehorned into the timeline. |
Thanks @vinokurig! It works now ) When I'm calling Is it expected? |
That's a known issue, not related to this PR. I thought there was an issue for it but I could not find it so I will create one. |
packages/timeline/package.json
Outdated
"@theia/core": "^1.2.0", | ||
"@theia/editor": "^1.2.0", | ||
"@theia/navigator": "^1.2.0" |
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 be ^1.3.0
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.
done
@akosyakov @westbury Looks like I have answered all your comments, could you please review the PR again? |
d38a9a3
to
3d594e2
Compare
Could someone test and approve it if it is fine? Rather than that it is fine with me. |
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 have tested this and I have noticed the following:
-
The 'load-more' does not really work very well. I have to repeatedly press it to get another 20 items. I have a portrait oriented screen that shows 150 lines so this takes a few presses. Then when my timeline section is full, I scroll down. However as soon as I try to scroll it resets and shows only 20 items again. So I can't see the bottom items.
-
The view is missing a few things which are shown is vs-code. That is ok as we don't need to implement everything in the first commit. However two things that would be good to get in fairly soon, preferably before the 1.6 release, are a) put the file name in the title and b) show the timestamp for each item.
-
I still think this should not be based on
TreeWidget
. A timeline is not a tree and never can be (unless one lives in Winden). @akosyakov mentioned Git - Timeline support for folders microsoft/vscode#95332 but, even if Microsoft were to accept that request, the timeline will still be a chronological list of commits that affect a folder, not a tree. Furthermore a timeline may have branches. I know that neither the timeline API nor Theia's history view currently support branches but I don't want to preclude supporting branches. Also there are over 1400 lines in TreeWidget that support trees yet all we use is selection and cursor up and down. The tree widget causes problems, for example cursor-left does nothing while cursor-right moves down, not a major bug and easily fixed but indicative of problems that can occur.
Overall though this is good and we need to get it merged. The only significant problem is the load-more action mentioned above. Ultimately I think this would work better if we used react-virtualized, so more items are fetched as the user scrolls, as is done in Theia's history view. I therefore don't think we need to spend too much effort perfecting this now. Most of the load-more problems are not visible to the user if PAGE_SIZE is increased, 200 should be plenty enough for most users' screen sizes. So I am happy to approve this with PAGE_SIZE at 200 and, of course, rebased and squashed.
3987218
to
e30056a
Compare
I've fixed it and other issues in the latest commit.
I'll file an issue with this improvements when it is merged.
I prefer to keep it as a tree because in this case we just extend the basic tree widget, so the implementation is simpler. Otherwise it would require a new widget from scratch or moving the git-history widget to some common place and extending it which can produce even more bugs. The problems that you described are fixed in the latest commit. |
@westbury any updates on this? |
I've tested it again and I have found the following issues:
|
6ecc67d
to
bc2e375
Compare
@westbury I've fixed it again, so your cases are fixed now except the last one. The
so I think it is a bug in the tree widget. I can file an issue about the default selection is not lost after selecting other nodes after merging it to be able to provide a use-case in the issue. WDYT? |
Thanks for fixing those issues.
I think the tree widget is working as designed. The problem is that the Load-More item has the |
} | ||
|
||
this.providers.delete(id); | ||
this.providerSubscriptions.delete(id); |
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.
Surely you should be disposing the listener here? You make the effort to keep the listener disposables in this.providerSubscriptions
but you don't do anything with them.
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've fixed that by disposing the provider directly instead of storing disposables in a map.
@westbury |
15827e2
to
ad7a249
Compare
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.
Great. It tests well and I did not see any memory leaks. Thanks for fixing that last issue. Just remove the unnecessary inject and I will be happy for this to be merged.
@@ -30,6 +30,8 @@ export interface TimelineNode extends SelectableTreeNode { | |||
@injectable() | |||
export class TimelineTreeModel extends TreeModelImpl { | |||
|
|||
@inject(TreeSelectionService) protected readonly selectionService: TreeSelectionService; |
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.
Not necessary. This is injected into TreeModelImpl.
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.
fixed
Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
66ef68d
to
af95c30
Compare
See theia's [changelog](https://github.com/eclipse-theia/theia/blob/v1.16.0/CHANGELOG.md#v1160---7292021), we update from 1.13.0 to 1.16.0. Changes specific to slapos port: * We set `warnOnPotentiallyInsecureHostPattern` because the new warning is very intrusive ... but it might actually be very insecure. For now we don't have solution. We are tracking this in https://erp5js.nexedi.net/#/bug_module/20210819-20614EE * New libsecret component that is now required by theia * Switch to using vscode git instead of theia git, to use timeline ( see eclipse-theia/theia#7997 ) * globally version up slapos.core to https://pypi.org/project/slapos.core/1.6.18/ See merge request nexedi/slapos!1039
What it does
Add Timeline Plugin API that controls the Timeline view.
fixes #7577
How to test
"@theia/git": "^1.2.0"
fromexamples/browser/package.json
fileplugins
folderAfter closing and reopening the widget,
TimeLine
widget exists as single object:Review checklist
Reminder for reviewers