Skip to content

Commit 01733ee

Browse files
eleanorjboydCopilot
andcommitted
Format environment tool changes
Apply the repository Prettier configuration to the non-interactive environment setup implementation and tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1638b07 commit 01733ee

4 files changed

Lines changed: 11 additions & 26 deletions

File tree

src/client/chat/configurePythonEnvTool.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,7 @@ export class ConfigurePythonEnvTool extends BaseTool<IConfigurePythonEnvToolArgu
135135
token: CancellationToken,
136136
): Promise<LanguageModelToolResult> {
137137
traceVerbose(`${ConfigurePythonEnvTool.toolName}: setting environment directly from pythonPath: ${pythonPath}`);
138-
const result = await setEnvironmentDirectlyByPath(
139-
pythonPath,
140-
this.api,
141-
resource,
142-
token,
143-
);
138+
const result = await setEnvironmentDirectlyByPath(pythonPath, this.api, resource, token);
144139
if (result) {
145140
this.extraTelemetryProperties.resolveOutcome = 'providedEnv';
146141
this.extraTelemetryProperties.envType = getEnvTypeForTelemetry(result);

src/client/chat/selectEnvTool.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,7 @@ export class SelectPythonEnvTool extends BaseTool<ISelectPythonEnvToolArguments>
8383
traceVerbose(
8484
`${SelectPythonEnvTool.toolName}: setting environment directly from pythonPath: ${options.input.pythonPath}`,
8585
);
86-
const result = await setEnvironmentDirectlyByPath(
87-
options.input.pythonPath,
88-
this.api,
89-
resource,
90-
token,
91-
);
86+
const result = await setEnvironmentDirectlyByPath(options.input.pythonPath, this.api, resource, token);
9287
if (result) {
9388
return getEnvDetailsForResponse(
9489
result,

src/client/chat/utils.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ export function waitForActiveEnvironmentChange(
110110
});
111111
}
112112

113-
function isResourceMatch(
114-
eventResource: { uri: Uri } | Uri | undefined,
115-
requestedResource: Uri | undefined,
116-
): boolean {
113+
function isResourceMatch(eventResource: { uri: Uri } | Uri | undefined, requestedResource: Uri | undefined): boolean {
117114
const eventUri = eventResource && 'uri' in eventResource ? eventResource.uri : eventResource;
118115
const requestedUri = requestedResource
119116
? workspace.getWorkspaceFolder(requestedResource)?.uri ?? requestedResource

src/test/chat/setEnvironmentFastPath.unit.test.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ suite('Chat fast-path environment setup', () => {
7878

7979
test('resolves when an event matches the requested environment id', async () => {
8080
const emitter = new EventEmitter<ActiveEnvironmentPathChangeEvent>();
81-
const promise = waitForActiveEnvironmentChange(makeApi(emitter), 'python-env', undefined, tokenSource.token);
81+
const promise = waitForActiveEnvironmentChange(
82+
makeApi(emitter),
83+
'python-env',
84+
undefined,
85+
tokenSource.token,
86+
);
8287
let settled = false;
8388
void promise.then(() => {
8489
settled = true;
@@ -236,20 +241,13 @@ suite('Chat fast-path environment setup', () => {
236241
const api = ({
237242
onDidChangeActiveEnvironmentPath: emitter.event,
238243
updateActiveEnvironmentPath: async () => {
239-
setImmediate(() =>
240-
emitter.fire({ path: '/new/python', id: 'new-env', resource: undefined }),
241-
);
244+
setImmediate(() => emitter.fire({ path: '/new/python', id: 'new-env', resource: undefined }));
242245
},
243246
getActiveEnvironmentPath: () => ({ path: '/old/python', id: 'old-env' }),
244247
resolveEnvironment,
245248
} as unknown) as PythonExtension['environments'];
246249

247-
const result = await setEnvironmentDirectlyByPath(
248-
'/new/python',
249-
api,
250-
undefined,
251-
tokenSource.token,
252-
);
250+
const result = await setEnvironmentDirectlyByPath('/new/python', api, undefined, tokenSource.token);
253251

254252
expect(result).to.equal(undefined);
255253
sinon.assert.calledOnce(resolveEnvironment);

0 commit comments

Comments
 (0)