Implemented filter for debug console output#102704
Conversation
|
@archDev thanks a lot for this great PR. In the meantime I just gave this a birds eye review.
Next milestone I plan to do a more thorough review. fyi @joaomoreno and @sandy081 since they worked on the Markers view filter |
|
Thanks for raising the priority for this @isidorn!
2/3. I will try to allocate some time this week to do this
|
|
No problem, there is no priority, I was just on vacation for the past 3 weeks.
Once you do 2/3 I plan to review it some time start of August. Thanks for working on this. |
|
@isidorn rebased on master, ensured that it still works and types are correct, added tests on filtering process in repl model |
|
@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. |
|
Thanks again for this great PR. I have just tested this out and here's my feedback regarding the functionality:
Regarding the code changes I will comment directly in the code. |
| @@ -0,0 +1,41 @@ | |||
| /*--------------------------------------------------------------------------------------------- | |||
There was a problem hiding this comment.
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?
| const $ = dom.$; | ||
|
|
||
| const HISTORY_STORAGE_KEY = 'debug.repl.history'; | ||
| const FILTER_STATE_STORAGE_KEY = 'debug.repl.filter'; |
There was a problem hiding this comment.
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`; |
There was a problem hiding this comment.
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'] || ''; |
There was a problem hiding this comment.
This filtering objects should be created when the tree gets created, in the renderBody, not in the constructor
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
|
|
||
| getReplElements(): IReplElement[] { | ||
| return this.replElements; | ||
| return this.replElements.filter(element => |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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'); | ||
| }); | ||
|
|
| this.clearFilterText(); | ||
| handled = true; | ||
| } | ||
| if (handled) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
This does not seem to work for me. Never does the filter grow, it is always large.
There was a problem hiding this comment.
I double checked, now when I change size of window, class is changing.
| @@ -0,0 +1,180 @@ | |||
| /*--------------------------------------------------------------------------------------------- | |||
There was a problem hiding this comment.
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
|
I have added comments inline. Mostly smaller things, looks good overall. |
|
I will allocate some time this week to address your comments, thanks for review |
|
Fantastic. After discussing with my collegues we decided it would be best to introduce a new folder |
|
@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? |
|
@arhelmus thanks a lot. |
|
@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? |
|
@sandy081 ok. I will take care of it. Will ping you if something is needed. Thanks |
|
Thanks again for this PR. Merging it in, will polish with some commits on top on master. |
|
@isidorn is it included in the last release of VS Code ? I can't find filters in the debug console still |
|
It is in vscode insiders. Will be in next vscode stable in 10 days. |


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