Skip to content

Commit acfdd49

Browse files
authored
tools: add "Open Memory Folder" command (#1839)
1 parent 8d93508 commit acfdd49

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,12 @@
19551955
"category": "Chat",
19561956
"enablement": "config.github.copilot.chat.enableUserPreferences"
19571957
},
1958+
{
1959+
"command": "github.copilot.chat.tools.memory.openFolder",
1960+
"title": "%github.copilot.command.openMemoryFolder%",
1961+
"category": "Chat",
1962+
"enablement": "config.github.copilot.chat.tools.memory.enabled"
1963+
},
19581964
{
19591965
"command": "github.copilot.chat.review.markUnhelpful",
19601966
"title": "%github.copilot.command.unhelpfulReviewSuggestion%",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"github.copilot.command.generateDocs": "Generate Docs",
2929
"github.copilot.command.generateTests": "Generate Tests",
3030
"github.copilot.command.openUserPreferences": "Open User Preferences",
31+
"github.copilot.command.openMemoryFolder": "Open Memory Folder",
3132
"github.copilot.command.sendChatFeedback": "Send Chat Feedback",
3233
"github.copilot.command.buildLocalWorkspaceIndex": "Build Local Workspace Index",
3334
"github.copilot.command.buildRemoteWorkspaceIndex": "Build Remote Workspace Index",

src/extension/tools/vscode-node/tools.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7+
import { IVSCodeExtensionContext } from '../../../platform/extContext/common/extensionContext';
78
import { Disposable } from '../../../util/vs/base/common/lifecycle';
89
import { autorun } from '../../../util/vs/base/common/observableInternal';
10+
import { URI } from '../../../util/vs/base/common/uri';
911
import { getContributedToolName } from '../common/toolNames';
1012
import { IToolsService } from '../common/toolsService';
1113
import { IToolGroupingCache, IToolGroupingService } from '../common/virtualTools/virtualToolTypes';
@@ -18,6 +20,7 @@ export class ToolsContribution extends Disposable {
1820
@IToolsService toolsService: IToolsService,
1921
@IToolGroupingCache toolGrouping: IToolGroupingCache,
2022
@IToolGroupingService toolGroupingService: IToolGroupingService,
23+
@IVSCodeExtensionContext private readonly extensionContext: IVSCodeExtensionContext,
2124
) {
2225
super();
2326

@@ -30,6 +33,16 @@ export class ToolsContribution extends Disposable {
3033
vscode.window.showInformationMessage('Tool groups have been reset. They will be regenerated on the next agent request.');
3134
}));
3235

36+
this._register(vscode.commands.registerCommand('github.copilot.chat.tools.memory.openFolder', async () => {
37+
const storageUri = this.extensionContext.storageUri;
38+
if (!storageUri) {
39+
vscode.window.showErrorMessage('No workspace is currently open. Memory operations require an active workspace.');
40+
return;
41+
}
42+
const memoryFolderUri = URI.joinPath(storageUri, 'memory-tool/memories');
43+
return vscode.env.openExternal(vscode.Uri.from(memoryFolderUri));
44+
}));
45+
3346
this._register(autorun(reader => {
3447
vscode.commands.executeCommand('setContext', 'chat.toolGroupingThreshold', toolGroupingService.threshold.read(reader));
3548
}));

test/base/extHostContext/simulationExtHostToolsService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class SimulationExtHostToolsService extends BaseToolsService implements I
6464
}
6565

6666
private ensureToolsRegistered() {
67-
this._lmToolRegistration ??= new ToolsContribution(this, {} as any, { threshold: observableValue(this, 128) } as any);
67+
this._lmToolRegistration ??= new ToolsContribution(this, {} as any, { threshold: observableValue(this, 128) } as any, {} as any);
6868
}
6969

7070
getCopilotTool(name: string): ICopilotTool<any> | undefined {

0 commit comments

Comments
 (0)