added file to support extension specific config

This commit is contained in:
mburleigh 2019-03-15 14:59:32 -04:00
Родитель 04f98c45bd
Коммит bab48c5ff5
1 изменённых файлов: 50 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,50 @@
import { Event, EventEmitter, window, workspace } from 'vscode';
export interface IAzureCliToolsSettings {
showResponseInDifferentTab: boolean;
}
export class AzureCliToolsSettings implements IAzureCliToolsSettings {
public showResponseInDifferentTab: boolean = false;
private static _instance: AzureCliToolsSettings;
public static get Instance(): AzureCliToolsSettings {
if (!AzureCliToolsSettings._instance) {
AzureCliToolsSettings._instance = new AzureCliToolsSettings();
}
return AzureCliToolsSettings._instance;
}
public readonly configurationUpdateEventEmitter = new EventEmitter<void>();
public get onDidChangeConfiguration(): Event<void> {
return this.configurationUpdateEventEmitter.event;
}
private constructor() {
workspace.onDidChangeConfiguration(() => {
this.initializeSettings();
this.configurationUpdateEventEmitter.fire();
});
window.onDidChangeActiveTextEditor(e => {
if (e) {
this.initializeSettings();
this.configurationUpdateEventEmitter.fire();
}
});
this.initializeSettings();
}
private initializeSettings() {
const editor = window.activeTextEditor;
const document = editor && editor.document;
const azureCliToolsSettings = workspace.getConfiguration("ms-azurecli", document ? document.uri : null);
this.showResponseInDifferentTab = azureCliToolsSettings.get<boolean>("showResponseInDifferentTab", false);
}
}