-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dedicated class for vscode context keys
- Loading branch information
1 parent
59d4507
commit 0110c96
Showing
2 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
|
||
export function getContextKeys() { | ||
if (instance == undefined) { | ||
instance = new ContextKeys(); | ||
} | ||
|
||
return instance; | ||
} | ||
|
||
let instance: ContextKeys; | ||
|
||
export class ContextKeys { | ||
private _debugFeaturesEnabled!: boolean; | ||
private _languageServerActive!: boolean; | ||
|
||
constructor() { | ||
this.debugFeaturesEnabled = false; | ||
this.languageServerActive = false; | ||
} | ||
|
||
|
||
get debugFeaturesEnabled(): boolean { | ||
return this._debugFeaturesEnabled; | ||
} | ||
|
||
set debugFeaturesEnabled(value: boolean) { | ||
this._debugFeaturesEnabled = value; | ||
this.setContextKey('debugFeaturesEnabled', value); | ||
} | ||
|
||
|
||
get languageServerActive(): boolean { | ||
return this._languageServerActive; | ||
} | ||
|
||
set languageServerActive(value: boolean) { | ||
this._languageServerActive = value; | ||
this.setContextKey('languageServerActive', value); | ||
} | ||
|
||
|
||
private setContextKey(key: string, value: any) { | ||
vscode.commands.executeCommand('setContext', `witcherscript-ide.${key}`, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters