-
Notifications
You must be signed in to change notification settings - Fork 267
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
Merging Network Extension #128
Conversation
|
||
it("applyDrawerTabLocationPatch correctly changes text", async () => { | ||
const apply = await import("./simpleView"); | ||
|
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.
nit: remove extra space
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.
Left some comments
const result = apply.applyAppendTabPatch(fileContents); | ||
expect(result).not.toEqual(null); | ||
expect(result).toEqual(expect.stringContaining( | ||
"appendTab(id, tabTitle, view, tabTooltip, userGesture, isCloseable, index) { if (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.
what are the tradeoffs of moving away from "selectTab". Would this prevents some tabs to be initialized and not only selected like previously?
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.
From my understanding these are how the tabs are generated:
Every tab/tool has a view associated with it, and when the ViewManager creates a tabbed section, it calls ViewManager.appendApplicable items to populate the tabs in the tabbedSection. By filtering the tab ids at this level, the tabbed headers won't and cannot add unused tabs in their tab array property.
The previous patches were _showTabElement and _selectTab.
_showTabElement rendered the tabs within the tab header. We can't render a tab that isn't added to the tab array, so we no longer need to filter here.
_selectTab previously would return early if a tab that wasn't on the exception list was clicked making it a noop. This is what would cause tabs to be unselectable. Since we are only appending tabs that we want, we do not need a check to make certain tabs unselectable.
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 still sounds to me that we need to completely understand the effect of this change. As an example:
inspector_main\InspectorMain.js, during SourcesPanelIndicator constructor:
self.UI.inspectorView.setPanelIcon('sources', icon);
in SetTabbedPane.js setTabIcon is defined as:
setTabIcon(id, icon) {
const tab = this._tabsById.get(id);
tab._setIcon(icon);
this._updateTabElements();
}
Will throw an exception as the id is not registered in the tab array . I tested this theory on an environment with the PR changes applied and got the same error:
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 just restored the applySelectTabPatch and applyShowTabElement functions and removed the appendTab patch. In general, I don't love that there are so many hard coded tab ID references in the source code, but I guess we have to work around that in our patches.
} | ||
} | ||
|
||
export function applyDrawerTabLocationPatch(content: string) { |
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 start adding some comments on each patch that briefly describes what exactly they are patching.(2-5 lines), otherwise the review (and any subsequent fixes) become time consuming. I'll create a similar PR for the existing patches.
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.
Good idea. Adding comments.
visibility: visible !important; | ||
}`.replace(/\n/g, separator); | ||
|
||
const topHeaderCSS = |
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.
This function is becoming crowded, let's use an "atomic" approach: individual functions for individual patches, that way we can also add a description to know exactly what is it patching.
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.
Splitting this up into General CSS changes, Network CSS changes and context menu changes.
5e8c75d
to
d9a209a
Compare
…rejection after implementing appendTab
4e9d63d
to
10912cf
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.
Nice!, thanks for tackling this out 👍
This PR adds the network tool to the devtools extension! The majority of this change was moving over the various patches and tests unique to the Network tool.
Here are some other notable changes from in this PR:
.tabbed-pane-right-toolbar
patch to bevisibility: hidden
overdisplay: none
since it was hiding the network search close button and could not reveal when its parent haddisplay: none
applyInspectorCommonCssHeaderContentsPatch
since it was hiding the header toolbar. Depending on how we want to expose the Network pane, we can re-add this codeThe original network extension can be found here: https://github.com/microsoft/vscode-edge-devtools-network