Skip to content

Implemented filter for debug console output#102704

Merged
isidorn merged 3 commits intomicrosoft:masterfrom
arhelmus:master
Aug 21, 2020
Merged

Implemented filter for debug console output#102704
isidorn merged 3 commits intomicrosoft:masterfrom
arhelmus:master

Conversation

@arhelmus
Copy link
Contributor

@arhelmus arhelmus commented Jul 16, 2020

This PR fixes #20838

After migration from Chrome DevTools to VS Code debugger, our users experienced major slowdown in productivity due to missed filtering in debug console. Users used to use filter to cut off irrelevant logs (as those pretty verbose) and with this PR I bringing this possibility in VS Code.

This feature is different from already implemented search, as instead of helping you to find what you searching for, it showing you only what you need.

Video: https://streamable.com/tvatmz

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jul 20, 2020
@weinand weinand removed their assignment Jul 20, 2020
@weinand weinand added this to the On Deck milestone Jul 20, 2020
@weinand weinand added the feature-request Request for new features or functionality label Jul 20, 2020
@isidorn
Copy link
Collaborator

isidorn commented Jul 28, 2020

@archDev thanks a lot for this great PR.
Since we are wrapping up our milestone and I was on vacation until today I am assigning this to August so we ideally merge it then and test it out.

In the meantime I just gave this a birds eye review.

  1. Did you checkout how the markers view is doing the filtering here. What needs to be done in the REPL is pretty much the same work unless I am mistaken
  2. Please get latest from master so we test this out with latest Electron version which we pushed to master
  3. Is it possible to write some unit tests
  4. Is it possible to have code re-use between the markers view and what you introduced in the REPL, so we do not have everything duplicated

Next milestone I plan to do a more thorough review.
Thanks a lot for your work!

fyi @joaomoreno and @sandy081 since they worked on the Markers view filter

@isidorn isidorn modified the milestones: On Deck, August 2020 Jul 28, 2020
@arhelmus
Copy link
Contributor Author

arhelmus commented Jul 29, 2020

Thanks for raising the priority for this @isidorn!

  1. It was the plan initially, but to implement filtering by type (show infos/warnings/errors), this information should present as part of IReplElement. I didnt found easy way to get this information in, so decided to just remove this type of filtering at all. Any suggestions?

2/3. I will try to allocate some time this week to do this

  1. It is definitely possible, I believe the input view itself can definetely by moved to common component. I don't feel confident in making this as I barely understand all the usecases of marker filter (I dropped quite a lot of code from it for repl), would love to get some help here.

@isidorn
Copy link
Collaborator

isidorn commented Jul 29, 2020

No problem, there is no priority, I was just on vacation for the past 3 weeks.

  1. I did not mean filtering by type, but I think you answered my question, you started with what Markers pane is doing and tried to make it simpler
    2 / 3 Great.
  2. Let's look into this once we merge this PR, so we can do that later if we think it makes sense

Once you do 2/3 I plan to review it some time start of August. Thanks for working on this.

@arhelmus
Copy link
Contributor Author

arhelmus commented Jul 30, 2020

@isidorn rebased on master, ensured that it still works and types are correct, added tests on filtering process in repl model

@isidorn
Copy link
Collaborator

isidorn commented Jul 31, 2020

@arhelmus great thanks. I plan to review and test it in detail in 10 days - since next week we are releasing our current stable build. I will provide more feedback then.

@isidorn
Copy link
Collaborator

isidorn commented Aug 11, 2020

Thanks again for this great PR. I have just tested this out and here's my feedback regarding the functionality:

  1. Filter box background seems to not be themable, it should have the same background color as the problems filter. You can for example swithc to Monoaki theme
  2. Even though the width is the same as the problems panel filter width I personaly think it is too wide. @sandy081 would you mind if we decrease the width of the filter box a bit?
  3. Do not store filter state across vscode releoads. Reload should just clear filter. We can add this later if users ask for it

Regarding the code changes I will comment directly in the code.

@@ -0,0 +1,41 @@
/*---------------------------------------------------------------------------------------------
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please put this under repl.css I do not see a need for having a seperate file,
Or even better @sandy081 what do you think about having shared css rules between problems filter and debug console filter so we do not have this duplication.
@arhelmus did you change anything from the css rules from the problems or they are 100% the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

100% same

Copy link
Member

Choose a reason for hiding this comment

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

works for me

const $ = dom.$;

const HISTORY_STORAGE_KEY = 'debug.repl.history';
const FILTER_STATE_STORAGE_KEY = 'debug.repl.filter';
Copy link
Collaborator

Choose a reason for hiding this comment

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

As mentioned already we should not store the filter input. It is fine if it gets cleared across reload imho.

private completionItemProvider: IDisposable | undefined;
private modelChangeListener: IDisposable = Disposable.None;
private readonly panelState: MementoObject;
private readonly filterActionId: string = `workbench.actions.treeView.${this.id}.filter`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This action id should not be a private, but a top level const .

this.history = new HistoryNavigator(JSON.parse(this.storageService.get(HISTORY_STORAGE_KEY, StorageScope.WORKSPACE, '[]')), 50);
this.panelState = new Memento(FILTER_STATE_STORAGE_KEY, storageService).getMemento(StorageScope.WORKSPACE);

const initialFilterText = this.panelState['filter'] || '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

This filtering objects should be created when the tree gets created, in the renderBody, not in the constructor

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 surprised with this comment as that's how filter stuff created in markers view, in constructor. I tried to move it to render body and problem is that repl.getActions is triggered before repl.renderBody as executed, and if filter state will not be created in constructor, we will need to handle undefined invariant in filter view

this.replInputContainer.style.height = `${replInputHeight}px`;

this.replInput.layout({ width: width - 30, height: replInputHeight });
this.filterState.layout = new dom.Dimension(width, height);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not understand why we update teh filterStat layout when in practice this does not seem to do anything ofr me.
Also filterState and filter should idealy not be attributes on the repl but just local variables passed to the tree.

Copy link
Contributor Author

@arhelmus arhelmus Aug 16, 2020

Choose a reason for hiding this comment

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

I think it is required for this state change, but I not sure how it is implemented for markers filter. It seems to me like there are some layout change happening which I can't find. Can you help me with this?

Screenshot 2020-08-16 at 12 50 00

Screenshot 2020-08-16 at 12 49 55


getReplElements(): IReplElement[] {
return this.replElements;
return this.replElements.filter(element =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this really needed? Do the problems do the same?
I thought the tree will do the filtering even if we give it more data? Or I might be mistaken?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately, this model is literally a model of real data source which has nothing to do with actual implementation (ReplDataSource). I didn't found better way to test this than to add support of primitive filtering to the model.

assert.equal(repl.getReplElements().length, 3);
assert.equal((<SimpleReplElement>repl.getReplElements()[2]).value, 'second global line');
});

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good job with tests

this.clearFilterText();
handled = true;
}
if (handled) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this should just be in the previous if statment and we do not need the handled boolean. Feels like a copy paste error.


protected updateClass(): void {
if (this.element && this.container) {
this.element.className = this.class;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not seem to work for me. Never does the filter grow, it is always large.

Copy link
Contributor Author

@arhelmus arhelmus Aug 16, 2020

Choose a reason for hiding this comment

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

I double checked, now when I change size of window, class is changing.

@@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------------------------
Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as I understand nothing in this calss is REPL specific.
Is this a 1:1 copy from the Problems? If yes we should just have a shared class
fyi @sandy081

@isidorn
Copy link
Collaborator

isidorn commented Aug 11, 2020

I have added comments inline. Mostly smaller things, looks good overall.
I would like to understand exactly how much fo the funcionality is shared between problems and debug console so ideally we would just share the same classes and not have code duplication.
Thanks a lot!

@arhelmus
Copy link
Contributor Author

I will allocate some time this week to address your comments, thanks for review

@isidorn
Copy link
Collaborator

isidorn commented Aug 12, 2020

Fantastic. After discussing with my collegues we decided it would be best to introduce a new folder
vs/workbench/contrib/treeFilter under which we should put all the shared things between the Problems view and the DebugConsole. So the .cssfile and the ParsedQuery logic and everything which makes sense to you.

@arhelmus
Copy link
Contributor Author

@isidorn I fixed 1 and 3 from your first comment, moved the filter view in separate component (I believe its only part which can be shared and its actually the part with all the copy-paste I did) and addressed your comments to the code.

Do you think now you can handle this PR to unify treeViewItem between markers and repl?

@isidorn
Copy link
Collaborator

isidorn commented Aug 17, 2020

@arhelmus thanks a lot.
I can try to take it over from here to merge it in and also use it in the markers view.

@sandy081
Copy link
Member

@isidorn Just back from vacation. Have not gone through all changes and I trust your decisions. Let me know if you need any input from me?

@isidorn
Copy link
Collaborator

isidorn commented Aug 17, 2020

@sandy081 ok. I will take care of it. Will ping you if something is needed. Thanks

@isidorn
Copy link
Collaborator

isidorn commented Aug 21, 2020

Thanks again for this PR. Merging it in, will polish with some commits on top on master.
☀️ 👏

@isidorn isidorn merged commit 4b90413 into microsoft:master Aug 21, 2020
@RobinLbt
Copy link

RobinLbt commented Sep 1, 2020

@isidorn is it included in the last release of VS Code ? I can't find filters in the debug console still

@isidorn
Copy link
Collaborator

isidorn commented Sep 1, 2020

It is in vscode insiders. Will be in next vscode stable in 10 days.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Word filter for debug console

5 participants