Prepare beta extension (#218)

* Updated changelog. Improved sign off docs due to DCO Check usage.

Signed-off-by: Jerome Luckenbach <github@luckenba.ch>

* Prepare for a later beta extension.

Signed-off-by: Jerome Luckenbach <github@luckenba.ch>

* Fix extension name.

Signed-off-by: Jerome Luckenbach <github@luckenba.ch>

* Prevent beta from getting deactivated too.

Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
pull/219/head
Jerome Luckenbach 2020-12-27 15:59:29 +01:00 committed by GitHub
parent 1d2bd40d65
commit 0689d1f721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -3,6 +3,7 @@
import {
commands,
Disposable,
extensions,
ExtensionContext,
languages,
window,
@ -29,7 +30,7 @@ import { HoverProvider } from './HoverProvider/HoverProvider'
import * as _ from 'lodash'
import * as ncp from 'copy-paste'
import * as path from 'path'
import { SSL_OP_EPHEMERAL_RSA } from 'constants'
import * as fs from 'fs'
let _extensionPath: string
let ohStatusBarItem: StatusBarItem
@ -206,6 +207,16 @@ async function init(disposables: Disposable[], config, context): Promise<void> {
// This method is called when the extension is activated
export function activate(context: ExtensionContext) {
// Keep the stable extension deactivated, when beta version is installed
let thisExtension = JSON.parse(fs.readFileSync(path.join(context.extensionPath, "package.json"), 'utf8')).name
let betaExtension = extensions.getExtension('openhab.openhab-beta')
// When beta is available and we are not beta itself, this extension should not get activated
if(betaExtension !== undefined && thisExtension !== "openhab-beta"){
console.log(`openHAB vscode extension stays deactivated.\nDetected an installed beta version.`)
return
}
// Prepare disposables array, context and config
const disposables: Disposable[] = []
_extensionPath = context.extensionPath