Fix excessive console logging + remove unnecessary try catch (#5860)
This commit is contained in:
parent
344ee29f77
commit
9ac62565a0
|
@ -83,16 +83,11 @@ async function getIdeStatusMessageWithFiles(ideClient: IdeClient): Promise<{
|
||||||
switch (connection.status) {
|
switch (connection.status) {
|
||||||
case IDEConnectionStatus.Connected: {
|
case IDEConnectionStatus.Connected: {
|
||||||
let content = `🟢 Connected to ${ideClient.getDetectedIdeDisplayName()}`;
|
let content = `🟢 Connected to ${ideClient.getDetectedIdeDisplayName()}`;
|
||||||
try {
|
const context = ideContext.getIdeContext();
|
||||||
const context = await ideContext.getIdeContext();
|
|
||||||
const openFiles = context?.workspaceState?.openFiles;
|
const openFiles = context?.workspaceState?.openFiles;
|
||||||
|
|
||||||
if (openFiles && openFiles.length > 0) {
|
if (openFiles && openFiles.length > 0) {
|
||||||
content += formatFileList(openFiles);
|
content += formatFileList(openFiles);
|
||||||
}
|
}
|
||||||
} catch (_e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
messageType: 'info',
|
messageType: 'info',
|
||||||
content,
|
content,
|
||||||
|
|
|
@ -211,16 +211,16 @@ export class IdeClient {
|
||||||
this.state.status === IDEConnectionStatus.Disconnected &&
|
this.state.status === IDEConnectionStatus.Disconnected &&
|
||||||
status === IDEConnectionStatus.Disconnected;
|
status === IDEConnectionStatus.Disconnected;
|
||||||
|
|
||||||
// Only update details if the state wasn't already disconnected, so that
|
// Only update details & log to console if the state wasn't already
|
||||||
// the first detail message is preserved.
|
// disconnected, so that the first detail message is preserved.
|
||||||
if (!isAlreadyDisconnected) {
|
if (!isAlreadyDisconnected) {
|
||||||
this.state = { status, details };
|
this.state = { status, details };
|
||||||
}
|
|
||||||
|
|
||||||
if (status === IDEConnectionStatus.Disconnected) {
|
|
||||||
if (logToConsole) {
|
if (logToConsole) {
|
||||||
logger.error(details);
|
logger.error(details);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status === IDEConnectionStatus.Disconnected) {
|
||||||
logger.debug(details);
|
logger.debug(details);
|
||||||
ideContext.clearIdeContext();
|
ideContext.clearIdeContext();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue