Skip to content
Merged
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
33 changes: 19 additions & 14 deletions src/managers/common/nativePythonFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class NativePythonFinderImpl implements NativePythonFinder {
}

private start(): rpc.MessageConnection {
this.outputChannel.info(`Starting Python Locator ${this.toolPath} server`);
this.outputChannel.info(`[pet] Starting Python Locator ${this.toolPath} server`);

// jsonrpc package cannot handle messages coming through too quickly.
// Lets handle the messages and close the stream only when
Expand All @@ -213,7 +213,7 @@ class NativePythonFinderImpl implements NativePythonFinder {
try {
const proc = ch.spawn(this.toolPath, ['server'], { env: process.env });
proc.stdout.pipe(readable, { end: false });
proc.stderr.on('data', (data) => this.outputChannel.error(data.toString()));
proc.stderr.on('data', (data) => this.outputChannel.error(`[pet] ${data.toString()}`));
writable.pipe(proc.stdin, { end: false });

disposables.push({
Expand All @@ -223,12 +223,12 @@ class NativePythonFinderImpl implements NativePythonFinder {
proc.kill();
}
} catch (ex) {
this.outputChannel.error('Error disposing finder', ex);
this.outputChannel.error('[pet] Error disposing finder', ex);
}
},
});
} catch (ex) {
this.outputChannel.error(`Error starting Python Finder ${this.toolPath} server`, ex);
this.outputChannel.error(`[pet] Error starting Python Finder ${this.toolPath} server`, ex);
}
const connection = rpc.createMessageConnection(
new rpc.StreamMessageReader(readable),
Expand All @@ -241,27 +241,28 @@ class NativePythonFinderImpl implements NativePythonFinder {
writable.end();
}),
connection.onError((ex) => {
this.outputChannel.error('Connection Error:', ex);
this.outputChannel.error('[pet] Connection Error:', ex);
}),
connection.onNotification('log', (data: NativeLog) => {
const msg = `[pet] ${data.message}`;
switch (data.level) {
case 'info':
this.outputChannel.info(data.message);
this.outputChannel.info(msg);
break;
case 'warning':
this.outputChannel.warn(data.message);
this.outputChannel.warn(msg);
break;
case 'error':
this.outputChannel.error(data.message);
this.outputChannel.error(msg);
break;
case 'debug':
this.outputChannel.debug(data.message);
this.outputChannel.debug(msg);
break;
default:
this.outputChannel.trace(data.message);
this.outputChannel.trace(msg);
}
}),
connection.onNotification('telemetry', (data) => this.outputChannel.info(`Telemetry: `, data)),
connection.onNotification('telemetry', (data) => this.outputChannel.info('[pet] Telemetry: ', data)),
connection.onClose(() => {
disposables.forEach((d) => d.dispose());
}),
Expand All @@ -288,7 +289,9 @@ class NativePythonFinderImpl implements NativePythonFinder {
executable: data.executable,
})
.then((environment: NativeEnvInfo) => {
this.outputChannel.info(`Resolved ${environment.executable}`);
this.outputChannel.info(
`Resolved environment during PET refresh: ${environment.executable}`,
);
nativeInfo.push(environment);
})
.catch((ex) =>
Expand All @@ -307,7 +310,7 @@ class NativePythonFinderImpl implements NativePythonFinder {
await this.connection.sendRequest<{ duration: number }>('refresh', refreshOptions);
await Promise.all(unresolved);
} catch (ex) {
this.outputChannel.error('Error refreshing', ex);
this.outputChannel.error('[pet] Error refreshing', ex);
throw ex;
} finally {
disposables.forEach((d) => d.dispose());
Expand All @@ -333,13 +336,15 @@ class NativePythonFinderImpl implements NativePythonFinder {
};
// No need to send a configuration request, is there are no changes.
if (JSON.stringify(options) === JSON.stringify(this.lastConfiguration || {})) {
this.outputChannel.debug('[pet] configure: No changes detected, skipping configuration update.');
return;
}
this.outputChannel.info('[pet] configure: Sending configuration update:', JSON.stringify(options));
try {
this.lastConfiguration = options;
await this.connection.sendRequest('configure', options);
} catch (ex) {
this.outputChannel.error('Configuration error', ex);
this.outputChannel.error('[pet] configure: Configuration error', ex);
}
}
}
Expand Down
Loading