Skip to content

Commit a6939ae

Browse files
Improve deprecation warning and output. (#258)
Signed-off-by: Jerome Luckenbach <[email protected]>
1 parent a6964e9 commit a6939ae

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Refactor configuration entries (#247)
1212
- Remove 3rd Party references and rename console setting (#247)
1313
- Replace deprecated http library (#247)
14-
- Add update notice prepared for loing term usage (#250)
14+
- Add update notice prepared for loing term usage (#250, #258)
1515
- Remove Changelog from .vscodeignore for better marketplace presentation (#253)
1616
- Dependency update (#254)
1717

client/src/Utils/ConfigManager.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ Please take a look at the current extension settings\nand update to the new conf
3030
this.deprecationWarningShown = false
3131
this.updateConfig()
3232

33-
if(this.hasDeprecatedParameters()){
33+
let deprecatedParameters = this.hasDeprecatedParameters()
34+
35+
if (deprecatedParameters) {
36+
if (Array.isArray(deprecatedParameters)) {
37+
deprecatedParameters.forEach((parameter) => {
38+
utils.appendToOutput(`Usage of deprecated config => openhab.${parameter} <= detected.`)
39+
})
40+
}
41+
3442
this.showDeprecationWarning()
3543
}
3644
}
@@ -102,7 +110,7 @@ Please take a look at the current extension settings\nand update to the new conf
102110

103111
// Output a warning with a "Dismiss" button to prevent warning from showing too often
104112
if(returnValue !== null){
105-
utils.appendToOutput(`Usage of deprecated config ${parameter} detected.`)
113+
utils.appendToOutput(`Usage of deprecated config => openhab.${parameter} <= detected.`)
106114
}
107115

108116
return returnValue
@@ -252,14 +260,13 @@ Please take a look at the current extension settings\nand update to the new conf
252260
private async showDeprecationWarning() {
253261
if(!this.deprecationWarningShown){
254262
this.deprecationWarningShown = true
255-
// const migrateStandardValues = 'Migrate minimal config directly!'
263+
const showOutput = 'Show Output'
256264

257-
// let result = await vscode.window.showWarningMessage(ConfigManager.DEPRECATION_WARNING_MESSAGE, { modal: true }, migrateStandardValues)
258-
vscode.window.showWarningMessage(ConfigManager.DEPRECATION_WARNING_MESSAGE)
265+
let result = await vscode.window.showWarningMessage(ConfigManager.DEPRECATION_WARNING_MESSAGE, showOutput)
259266

260-
// // Action based on user input
261-
// if(result == migrateStandardValues)
262-
// ConfigManager.migrateDeprecatedParameters()
267+
// Action based on user input
268+
if(result == showOutput)
269+
utils.getOutputChannel().show()
263270
}
264271
}
265272
}

0 commit comments

Comments
 (0)