Skip to content

Commit 9325ef3

Browse files
authored
Only use local files in copilot cli chat (#1474)
1 parent 86e1c61 commit 9325ef3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/extension/agents/copilotcli/node/copilotcliAgentManager.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export class CopilotCLIAgentManager extends Disposable {
8787
if (ref.value instanceof ChatReferenceDiagnostic) {
8888
// Handle diagnostic reference
8989
for (const [uri, diagnostics] of ref.value.diagnostics) {
90+
if (uri.scheme !== 'file') {
91+
continue;
92+
}
9093
for (const diagnostic of diagnostics) {
9194
const severityMap: { [key: number]: string } = {
9295
0: 'error',
@@ -103,10 +106,12 @@ export class CopilotCLIAgentManager extends Disposable {
103106
}
104107
}
105108
} else {
106-
const filePath = URI.isUri(ref.value) ? ref.value.fsPath : isLocation(ref.value) ? ref.value.uri.fsPath : undefined;
107-
if (filePath) {
108-
files.push({ path: filePath, name: ref.name || path.basename(filePath) });
109+
const uri = URI.isUri(ref.value) ? ref.value : isLocation(ref.value) ? ref.value.uri : undefined;
110+
if (!uri || uri.scheme !== 'file') {
111+
return;
109112
}
113+
const filePath = uri.fsPath;
114+
files.push({ path: filePath, name: ref.name || path.basename(filePath) });
110115
const valueText = URI.isUri(ref.value) ?
111116
ref.value.fsPath :
112117
isLocation(ref.value) ?

0 commit comments

Comments
 (0)