Signed-off-by: Kuba Wolanin <hi@kubawolanin.com>pull/45/head
parent
27bff8f446
commit
2b102cb081
|
@ -64,12 +64,13 @@ export class ItemsModel {
|
|||
}.bind(this))
|
||||
.catch(async err => {
|
||||
let config = workspace.getConfiguration('openhab')
|
||||
const openSettings = 'Open Settings'
|
||||
const setHost = 'Set openHAB host'
|
||||
const disableRest = 'Disable REST API'
|
||||
const result = await window.showErrorMessage('Error while connecting to openHAB REST API. ', openSettings, disableRest)
|
||||
const result = await window.showErrorMessage('Error while connecting to openHAB REST API. ', setHost, disableRest)
|
||||
switch (result) {
|
||||
case openSettings:
|
||||
commands.executeCommand('workbench.action.openGlobalSettings')
|
||||
case setHost:
|
||||
config.update('host', 'localhost')
|
||||
commands.executeCommand('workbench.action.openWorkspaceSettings')
|
||||
break
|
||||
case disableRest:
|
||||
config.update('useRestApi', false)
|
||||
|
|
|
@ -74,6 +74,15 @@ export function hasExtension(name: string): Thenable<boolean> {
|
|||
})
|
||||
}
|
||||
|
||||
export function getSitemaps(): Thenable<any[]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
request(getHost() + '/rest/sitemaps')
|
||||
.then((response) => {
|
||||
resolve(JSON.parse(response))
|
||||
}).catch(() => reject([]))
|
||||
})
|
||||
}
|
||||
|
||||
export function openHtml(uri: Uri, title) {
|
||||
return commands.executeCommand('vscode.previewHtml', uri, ViewColumn.Two, title)
|
||||
.then((success) => {
|
||||
|
|
|
@ -433,7 +433,7 @@
|
|||
"name": "keyword.control.openhab"
|
||||
},
|
||||
{
|
||||
"match": "\\b(return|break|case|continue|default|do|while|for|switch|if|else)\\b",
|
||||
"match": "\\b((?!<)(return|break|case|continue|default|do|while|for|switch|if|else)(?!>))\\b",
|
||||
"name": "keyword.control.openhab"
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue