Skip to content

Commit b999cac

Browse files
committed
fix: update
1 parent 410acfe commit b999cac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/copilot/contextProvider.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function createJavaContextResolver(): ContextResolverFunction {
7474
async function resolveJavaContext(request: ResolveRequest, copilotCancel: vscode.CancellationToken): Promise<SupportedContextItem[]> {
7575
const items: SupportedContextItem[] = [];
7676
const start = performance.now();
77+
let duration: number;
7778

7879
let dependenciesResult: CopilotHelper.IResolveResult | undefined;
7980
let importsResult: CopilotHelper.IResolveResult | undefined;
@@ -103,7 +104,7 @@ async function resolveJavaContext(request: ResolveRequest, copilotCancel: vscode
103104
items.push(...importsResult.items);
104105
} catch (error: any) {
105106
if (error instanceof CopilotCancellationError) {
106-
const duration = Math.round(performance.now() - start);
107+
duration = Math.round(performance.now() - start);
107108
sendContextResolutionTelemetry(
108109
request,
109110
duration,
@@ -118,7 +119,7 @@ async function resolveJavaContext(request: ResolveRequest, copilotCancel: vscode
118119
throw error;
119120
}
120121
if (error instanceof vscode.CancellationError || error.message === CancellationError.CANCELED) {
121-
const duration = Math.round(performance.now() - start);
122+
duration = Math.round(performance.now() - start);
122123
sendContextResolutionTelemetry(
123124
request,
124125
duration,
@@ -134,7 +135,7 @@ async function resolveJavaContext(request: ResolveRequest, copilotCancel: vscode
134135
}
135136

136137
// Send telemetry for general errors (but continue with partial results)
137-
const duration = Math.round(performance.now() - start);
138+
duration = Math.round(performance.now() - start);
138139
sendContextResolutionTelemetry(
139140
request,
140141
duration,
@@ -152,7 +153,7 @@ async function resolveJavaContext(request: ResolveRequest, copilotCancel: vscode
152153
}
153154

154155
// Send telemetry data once at the end for success case
155-
const duration = Math.round(performance.now() - start);
156+
duration = Math.round(performance.now() - start);
156157
sendContextResolutionTelemetry(
157158
request,
158159
duration,

0 commit comments

Comments
 (0)