diff --git a/packages/extended-services-vscode-extension/src/Validator.ts b/packages/extended-services-vscode-extension/src/Validator.ts index 6048f8355cb..685bb891165 100644 --- a/packages/extended-services-vscode-extension/src/Validator.ts +++ b/packages/extended-services-vscode-extension/src/Validator.ts @@ -57,10 +57,8 @@ export async function validateBPMN(serviceURL: URL, bpmnFile: kieFile.KieFile): ); return createBPMNDiagnostics(validationResponses); } catch (error) { - console.error("An error happened while trying to validate BPMN file: " + kieFile + " with error: " + error.message); - throw new Error( - "An error happened while trying to validate BPMN file: " + kieFile + " with error: " + error.message - ); + console.error(`An error occured while trying to validate DMN file: ${bpmnFile} with error: ${error.message}`); + throw new Error(`An error occured while trying to validate DMN file: ${bpmnFile} with error: ${error.message}`); } } @@ -72,9 +70,7 @@ export async function validateDMN(serviceURL: URL, dmnFile: kieFile.KieFile): Pr ); return createDMNDiagnostics(validationResponses); } catch (error) { - console.error("An error happened while trying to validate DMN file: " + kieFile + " with error: " + error.message); - throw new Error( - "An error happened while trying to validate DMN file: " + kieFile + " with error: " + error.message - ); + console.error(`An error occured while trying to validate DMN file: ${dmnFile} with error: ${error.message}`); + throw new Error(`An error occured while trying to validate DMN file: ${dmnFile} with error: ${error.message}`); } } diff --git a/packages/extended-services-vscode-extension/src/configurations/Configuration.ts b/packages/extended-services-vscode-extension/src/configurations/Configuration.ts index 9269bbbd533..dc83a97c882 100644 --- a/packages/extended-services-vscode-extension/src/configurations/Configuration.ts +++ b/packages/extended-services-vscode-extension/src/configurations/Configuration.ts @@ -41,14 +41,14 @@ function fetchExtendedServicesURL(): URL { try { return new URL(extendedServicesURL); } catch (error) { - throw new Error("URL configuration " + extendedServicesURL + " is invalid: " + error.message); + throw new Error(`URL configuration ${extendedServicesURL} is invalid: ${error.message}`); } } const getConfigurationPropertyValue = (property: string, defaultValue: T): T => { const value = vscode.workspace.getConfiguration().get(property) as T; if (value == null) { - console.warn("Property: " + property + " is missing, using the default: " + defaultValue); + console.warn(`Property: ${property} is missing, using the default: ${defaultValue}`); value == defaultValue; } return value; diff --git a/packages/extended-services-vscode-extension/src/extension/extension-browser.ts b/packages/extended-services-vscode-extension/src/extension/extension-browser.ts index 0aa1ba687ed..b9d7ade2089 100644 --- a/packages/extended-services-vscode-extension/src/extension/extension-browser.ts +++ b/packages/extended-services-vscode-extension/src/extension/extension-browser.ts @@ -74,24 +74,24 @@ function startExtendedServices(): void { try { configuration = fetchConfiguration(); } catch (error) { - console.error("[Extended Services Extension] Extension configuration is wrong: " + error.message); + console.error(`[Extended Services Extension] Extension configuration is wrong: ${error.message}`); vscode.window.showErrorMessage( - "Extension configuration is wrong: " + error.message + " Please fix your local extension's setting" + `Extension configuration is wrong: ${error.message}. Please fix your local extension's setting` ); return; } try { console.debug( - "[Extended Services Extension] Connecting with the Extended Service located: " + configuration.extendedServicesURL + `[Extended Services Extension] Connecting with the Extended Services located: ${configuration.extendedServicesURL}` ); connection.start(configuration.extendedServicesURL, configuration.connectionHeartbeatIntervalinSecs); } catch (error) { stopExtendedServices(); console.error( - "[Extended Services Extension] An error happened while trying to start the local service:" + error.message + `[Extended Services Extension] An error happened while trying to start the local service: ${error.message}` ); - vscode.window.showErrorMessage("An error happened while trying to start the local service:" + error.message); + vscode.window.showErrorMessage(`An error happened while trying to start the local service: ${error.message}`); } } @@ -111,36 +111,30 @@ async function validate(extendedServicesURL: URL) { for (const bpmnFile of bpmnFiles) { try { - console.debug("[Extended Services Extension] Validating BPMN file: " + bpmnFile.uri.path); + console.debug(`[Extended Services Extension] Validating DMN file: ${bpmnFile.uri.path}`); const bpmnDiagnostics: vscode.Diagnostic[] = await validator.validateBPMN(extendedServicesURL, bpmnFile); diagnosticCollection.set(bpmnFile.uri, bpmnDiagnostics); } catch (error) { console.error( - "[Extended Services Extension] An error happened while trying to validate " + - bpmnFile.uri.path + - ": " + - error.message + `[Extended Services Extension] An error happened while trying to validate ${bpmnFile.uri.path}: ${error.message}` ); vscode.window.showErrorMessage( - "An error happened while trying to validate " + bpmnFile.uri.path + ": " + error.message + `An error happened while trying to validate ${bpmnFile.uri.path}: ${error.message}` ); } } for (const dmnFile of dmnFiles) { try { - console.debug("[Extended Services Extension] Validating DMN file: " + dmnFile.uri.path); + console.debug(`[Extended Services Extension] Validating DMN file: ${dmnFile.uri.path}`); const dmnDiagnostics: vscode.Diagnostic[] = await validator.validateDMN(extendedServicesURL, dmnFile); diagnosticCollection.set(dmnFile.uri, dmnDiagnostics); } catch (error) { console.error( - "[Extended Services Extension] An error happened while trying to validate " + - dmnFile.uri.path + - ": " + - error.message + `[Extended Services Extension] An error happened while trying to validate ${dmnFile.uri.path}: ${error.message}` ); vscode.window.showErrorMessage( - "An error happened while trying to validate " + dmnFile.uri.path + ": " + error.message + `An error happened while trying to validate ${dmnFile.uri.path}: ${error.message}` ); } } @@ -160,8 +154,9 @@ export function activate(context: vscode.ExtensionContext) { kieFilesWatcher.subscribeKieFilesOpened(() => { console.debug( - "[Extended Services Extension] A KIE file has been opened. Current opened KIE files: " + + `[Extended Services Extension] A KIE file has been opened. Current opened KIE files: ${ kieFilesWatcher.watchedKieFiles.length + }` ); if (!disconnectedByUser && isConnected && configuration) { validate(configuration.extendedServicesURL); @@ -203,7 +198,7 @@ export function activate(context: vscode.ExtensionContext) { stopExtendedServices(); isConnected = false; console.error("[Extended Services Extension] Connection lost with Extended Services"); - vscode.window.showErrorMessage("Connection error: " + errorMessage); + vscode.window.showErrorMessage(`Connection error: ${errorMessage}`); }); connection.subscribeDisconnected(() => { diff --git a/packages/extended-services-vscode-extension/src/extension/extension-main.ts b/packages/extended-services-vscode-extension/src/extension/extension-main.ts index 6bf0248bdfa..9f8e1e5f2ae 100644 --- a/packages/extended-services-vscode-extension/src/extension/extension-main.ts +++ b/packages/extended-services-vscode-extension/src/extension/extension-main.ts @@ -43,7 +43,7 @@ let configurationWatcher: ConfigurationWatcher; let connection: Connection; let localService: LocalExtendedServices; -/* Determines if the extension is corrected with the Extended Services Backend */ +/* Determines if the extension is connected with the Extended Services Backend */ let isConnected = false; /* Determines the user explicitely disconnected the Extension from the Extended Services Backend */ let disconnectedByUser: boolean = false; @@ -107,24 +107,24 @@ function stopExtendedServices(configuration: Configuration | null) { } function startLocalExtendedServices(configuration: Configuration, context: vscode.ExtensionContext): void { - console.debug("[Extended Services Extension] Starting a Local Extended Service process"); + console.debug("[Extended Services Extension] Starting a Local Extended Services process"); try { localService.start(configuration.extendedServicesURL, context.extensionPath); } catch (error) { stopExtendedServices(configuration); console.error( - "[Extended Services Extension] An error happened while trying to start the Local Extended Service process:" + + "[Extended Services Extension] An error happened while trying to start the Local Extended Services process:" + error.message ); vscode.window.showErrorMessage( - "An error happened while trying to start the Local Extended Service process:" + error.message + "An error happened while trying to start the Local Extended Services process:" + error.message ); } } function startConnection(configuration: Configuration) { console.debug( - "[Extended Services Extension] Connecting with the Extended Service located: " + configuration.extendedServicesURL + "[Extended Services Extension] Connecting with the Extended Services located: " + configuration.extendedServicesURL ); try { connection.start(configuration.extendedServicesURL, configuration.connectionHeartbeatIntervalinSecs);