Skip to content

Commit 80359d9

Browse files
dacowanhexlandCopilot
authored
feat: Adding Editor Network Stats (#339)
Adding a new debugger stats visualization for editor network statistics - Fixed an issue with the stats provider where it was only aggregating the first field - Added aggregator support for different field variants - Added CSS styling for resizable table column headers (they only look different though - turns out the web view table component doesn't support resizing column headers) - Fixed an issue in the statistics collector when parent stats had no children and for aggregating columns of different types - Added a dynamic multi column display table (just add new labels and it will expand - no need to set it up beforehand) - Added an Editor Network Stats pane - Added flags to prettify camel case strings or display as-is <img width="2670" height="1286" alt="image" src="https://github.com/user-attachments/assets/aa71a52b-66b6-4f20-bf33-99736a5b4f03" /> --------- Co-authored-by: David Cowan <taz@hexland.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2ee192a commit 80359d9

File tree

6 files changed

+516
-3
lines changed

6 files changed

+516
-3
lines changed

src/stats/stats-provider.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,25 @@ export class StatsProvider {
8484
const childStringValues: string[][] = [];
8585

8686
for (const child of stat.children ?? []) {
87-
if (!(child.values && typeof child.values[0] === 'string' && child.values[0].length > 0)) {
87+
if (!child.values || child.values.length === 0) {
8888
continue;
8989
}
9090

91-
childStringValues.push([child.name, child.values[0]]);
91+
// Handle different value types
92+
if (typeof child.values[0] === 'string' && child.values[0].length > 0) {
93+
// Original behavior: string values
94+
childStringValues.push([child.name, child.values[0]]);
95+
} else if (typeof child.values[0] === 'number') {
96+
// New behavior: numeric values
97+
if (child.values.length === 1) {
98+
// Single numeric value
99+
childStringValues.push([child.name, child.values[0].toString()]);
100+
} else if (child.values.length >= 2) {
101+
// Multiple numeric values - create a row with all values
102+
const valueStrings = child.values.map(v => v.toString());
103+
childStringValues.push([child.name, ...valueStrings]);
104+
}
105+
}
92106
}
93107

94108
const childStatData: StatData = {

webview-ui/src/diagnostics_panel/App.css

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,56 @@ main {
156156
background-color: var(--vscode-button-background);
157157
color: var(--vscode-button-foreground);
158158
}
159+
160+
/* Multi-column table with enhanced column interaction */
161+
#multi-column-grid {
162+
width: 100%;
163+
overflow-x: auto;
164+
table-layout: fixed;
165+
}
166+
167+
/* Enhanced column styling for better visual feedback */
168+
#multi-column-grid vscode-data-grid-cell[cell-type="columnheader"] {
169+
font-weight: bold;
170+
background-color: var(--vscode-editor-background);
171+
border-bottom: 2px solid var(--vscode-editorGroup-border);
172+
border-right: 1px solid var(--vscode-editorGroup-border);
173+
position: relative;
174+
cursor: default;
175+
user-select: none;
176+
padding: 8px 12px;
177+
overflow: hidden;
178+
text-overflow: ellipsis;
179+
}
180+
181+
/* Add visual resize handle to column headers */
182+
#multi-column-grid vscode-data-grid-cell[cell-type="columnheader"]::after {
183+
content: '';
184+
position: absolute;
185+
top: 0;
186+
right: 0;
187+
width: 4px;
188+
height: 100%;
189+
background: transparent;
190+
cursor: col-resize;
191+
z-index: 1;
192+
}
193+
194+
#multi-column-grid vscode-data-grid-cell[cell-type="columnheader"]:hover::after {
195+
background: var(--vscode-focusBorder);
196+
opacity: 0.5;
197+
}
198+
199+
/* Regular cell styling */
200+
#multi-column-grid vscode-data-grid-cell:not([cell-type="columnheader"]) {
201+
padding: 8px 12px;
202+
border-right: 1px solid var(--vscode-editorGroup-border);
203+
overflow: hidden;
204+
text-overflow: ellipsis;
205+
min-width: 0;
206+
}
207+
208+
/* Default styling for value columns when no columnWidths prop is provided */
209+
#multi-column-grid vscode-data-grid-cell:not([grid-column="1"]) {
210+
text-align: right;
211+
}

webview-ui/src/diagnostics_panel/StatisticProvider.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ export class MultipleStatisticProvider extends StatisticProvider {
118118
}
119119

120120
if (event.values.length === 0) {
121-
return;
121+
// Allow events through if they have children_string_values even if values is empty
122+
if (!event.children_string_values || event.children_string_values.length === 0) {
123+
return;
124+
}
122125
}
123126

124127
if (this.options.valuesFilter && !this.options.valuesFilter(event)) {

0 commit comments

Comments
 (0)