aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrkun Tokdemir <orkun.tokdemir@qt.io>2024-12-13 13:41:16 +0100
committerOrkun Tokdemir <orkun.tokdemir@qt.io>2024-12-13 14:47:41 +0000
commit4acc9e68af4f1932e0fcd499aee3574e098de96e (patch)
treeb6b45f8dbf46b03f10298eaba240c6bdc36611d5
parentf7fa5e7812861967a91e51831528ca60e6a09756 (diff)
Enhance logging for coreAPI notifications and config initialization
* Improve logging for coreAPI notifications * Introduce `toString()` method for `QtWorkspaceConfigMessage` Change-Id: I7e82196ca641a93ea2a960230203fe21a38c8b4e Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
-rw-r--r--qt-core/src/installation-root.ts2
-rw-r--r--qt-core/src/project.ts1
-rw-r--r--qt-cpp/src/project.ts18
-rw-r--r--qt-lib/src/core-api.ts10
4 files changed, 29 insertions, 2 deletions
diff --git a/qt-core/src/installation-root.ts b/qt-core/src/installation-root.ts
index a1765b2..4460b36 100644
--- a/qt-core/src/installation-root.ts
+++ b/qt-core/src/installation-root.ts
@@ -196,6 +196,7 @@ export function onQtInsRootUpdated(
const message = new QtWorkspaceConfigMessage(folder);
coreAPI?.setValue(folder, QtInsRootConfigName, newQtInstallationRoot);
message.config.add(QtInsRootConfigName);
+ logger.info(`Notifying coreAPI with message: ${message.toString()}`);
coreAPI?.notify(message);
}
@@ -219,5 +220,6 @@ export function onAdditionalQtPathsUpdated(
const message = new QtWorkspaceConfigMessage(folder);
coreAPI?.setValue(folder, AdditionalQtPathsName, newPaths);
message.config.add(AdditionalQtPathsName);
+ logger.info(`Notifying coreAPI with message: ${message.toString()}`);
coreAPI?.notify(message);
}
diff --git a/qt-core/src/project.ts b/qt-core/src/project.ts
index 06e59f6..5a438a0 100644
--- a/qt-core/src/project.ts
+++ b/qt-core/src/project.ts
@@ -106,6 +106,7 @@ export class CoreProject implements Project {
logger.info(
`Setting additional Qt paths for ${folder.uri.fsPath} to: ${additionalQtPaths.join(', ')}`
);
+ logger.info('Config values initialized for:', folder.uri.fsPath);
}
dispose() {
diff --git a/qt-cpp/src/project.ts b/qt-cpp/src/project.ts
index 38e3550..b326642 100644
--- a/qt-cpp/src/project.ts
+++ b/qt-cpp/src/project.ts
@@ -78,6 +78,9 @@ export class CppProject implements Project {
selectedQtPaths
);
message.config.add('selectedQtPaths');
+ logger.info(
+ `Notifying coreAPI with message: ${message.toString()}`
+ );
coreAPI?.notify(message);
}
}
@@ -95,6 +98,9 @@ export class CppProject implements Project {
const message = new QtWorkspaceConfigMessage(this.folder);
coreAPI?.setValue(this.folder, 'buildDir', currentBuildDir);
message.config.add('buildDir');
+ logger.info(
+ `Notifying coreAPI with message: ${message.toString()}`
+ );
coreAPI?.notify(message);
}
}
@@ -109,7 +115,6 @@ export class CppProject implements Project {
}
const folder = this.folder;
const kit = await getSelectedKit(folder, true);
- const message = new QtWorkspaceConfigMessage(folder);
const selectedKitPath = kit ? getQtInsRoot(kit) : undefined;
logger.info(
`Setting selected kit path for ${folder.uri.fsPath} to ${selectedKitPath}`
@@ -117,9 +122,18 @@ export class CppProject implements Project {
coreAPI.setValue(folder, 'selectedKitPath', selectedKitPath);
const selectedQtPaths = kit ? getQtPathsExe(kit) : undefined;
coreAPI.setValue(folder, 'selectedQtPaths', selectedQtPaths);
+ logger.info(
+ `Setting selected Qt paths for ${folder.uri.fsPath} to ${selectedQtPaths}`
+ );
coreAPI.setValue(folder, 'workspaceType', QtWorkspaceType.CMakeExt);
+ logger.info(
+ `Setting workspace type for ${folder.uri.fsPath} to ${QtWorkspaceType.CMakeExt}`
+ );
coreAPI.setValue(folder, 'buildDir', this.buildDir);
- logger.info('Updating coreAPI with message:', message as unknown as string);
+ logger.info(
+ `Setting build directory for ${folder.uri.fsPath} to ${this.buildDir}`
+ );
+ logger.info('Config values initialized for:', folder.uri.fsPath);
}
public getStateManager() {
return this._stateManager;
diff --git a/qt-lib/src/core-api.ts b/qt-lib/src/core-api.ts
index 2630c4a..85b168d 100644
--- a/qt-lib/src/core-api.ts
+++ b/qt-lib/src/core-api.ts
@@ -43,6 +43,16 @@ export class QtWorkspaceConfigMessage {
this.workspaceFolder = folder ?? 'global';
this.config = new Set() as MessageConfigs;
}
+ toString(): string {
+ const configs = Array.from(this.config).join(', ');
+ let folder: vscode.WorkspaceFolder | string;
+ if (typeof this.workspaceFolder === 'string') {
+ folder = this.workspaceFolder;
+ } else {
+ folder = this.workspaceFolder.name;
+ }
+ return `[${folder}]: ${configs}`;
+ }
}
export enum QtWorkspaceType {