Skip to content

Add debug view filters for NES requests #536

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

Merged
merged 4 commits into from
Aug 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,14 @@
"command": "github.copilot.chat.debug.hideTools",
"title": "Hide Tools"
},
{
"command": "github.copilot.chat.debug.showNesRequests",
"title": "Show NES Requests"
},
{
"command": "github.copilot.chat.debug.hideNesRequests",
"title": "Hide NES Requests"
},
{
"command": "github.copilot.chat.debug.exportLogItem",
"title": "Export as...",
Expand Down Expand Up @@ -2994,6 +3002,14 @@
"command": "github.copilot.chat.debug.hideTools",
"when": "false"
},
{
"command": "github.copilot.chat.debug.showNesRequests",
"when": "false"
},
{
"command": "github.copilot.chat.debug.hideNesRequests",
"when": "false"
},
{
"command": "github.copilot.chat.debug.exportLogItem",
"when": "false"
Expand Down Expand Up @@ -3239,6 +3255,16 @@
"command": "github.copilot.chat.debug.hideTools",
"when": "!github.copilot.chat.debug.toolsHidden",
"group": "commands@1"
},
{
"command": "github.copilot.chat.debug.showNesRequests",
"when": "github.copilot.chat.debug.nesRequestsHidden",
"group": "commands@2"
},
{
"command": "github.copilot.chat.debug.hideNesRequests",
"when": "!github.copilot.chat.debug.nesRequestsHidden",
"group": "commands@2"
}
],
"notebook/toolbar": [
Expand Down
19 changes: 19 additions & 0 deletions src/extension/log/vscode-node/requestLogTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ class ChatRequestItem extends vscode.TreeItem {
class LogTreeFilters extends Disposable {
private _elementsShown = true;
private _toolsShown = true;
private _nesRequestsShown = true;

private readonly _onDidChangeFilters = new vscode.EventEmitter<void>();
readonly onDidChangeFilters = this._onDidChangeFilters.event;
Expand All @@ -563,6 +564,7 @@ class LogTreeFilters extends Disposable {

this.setElementsShown(!vscodeExtensionContext.workspaceState.get(this.getStorageKey('elements')));
this.setToolsShown(!vscodeExtensionContext.workspaceState.get(this.getStorageKey('tools')));
this.setNesRequestsShown(!vscodeExtensionContext.workspaceState.get(this.getStorageKey('nesRequests')));
}

private getStorageKey(name: string): string {
Expand All @@ -579,18 +581,33 @@ class LogTreeFilters extends Disposable {
this.setShown('tools', this._toolsShown);
}

setNesRequestsShown(value: boolean) {
this._nesRequestsShown = value;
this.setShown('nesRequests', this._nesRequestsShown);
}

itemIncluded(item: TreeItem): boolean {
if (item instanceof ChatPromptItem) {
return true; // Always show chat prompt items
} else if (item instanceof ChatElementItem) {
return this._elementsShown;
} else if (item instanceof ToolCallItem) {
return this._toolsShown;
} else if (item instanceof ChatRequestItem) {
// Check if this is a NES request
if (this.isNesRequest(item)) {
return this._nesRequestsShown;
}
}

return true;
}

private isNesRequest(item: ChatRequestItem): boolean {
const debugName = item.info.entry.debugName.toLowerCase();
return debugName.startsWith('nes |') || debugName === 'xtabprovider';
}

private setShown(name: string, value: boolean): void {
vscode.commands.executeCommand('setContext', `github.copilot.chat.debug.${name}Hidden`, !value);
this.vscodeExtensionContext.workspaceState.update(this.getStorageKey(name), !value);
Expand All @@ -606,5 +623,7 @@ class LogTreeFilterCommands extends Disposable {
this._register(vscode.commands.registerCommand('github.copilot.chat.debug.hideElements', () => filters.setElementsShown(false)));
this._register(vscode.commands.registerCommand('github.copilot.chat.debug.showTools', () => filters.setToolsShown(true)));
this._register(vscode.commands.registerCommand('github.copilot.chat.debug.hideTools', () => filters.setToolsShown(false)));
this._register(vscode.commands.registerCommand('github.copilot.chat.debug.showNesRequests', () => filters.setNesRequestsShown(true)));
this._register(vscode.commands.registerCommand('github.copilot.chat.debug.hideNesRequests', () => filters.setNesRequestsShown(false)));
}
}