89 lines
2.2 KiB
TypeScript
89 lines
2.2 KiB
TypeScript
/**
|
|
* options.ts
|
|
*
|
|
* Copyright (C) 2020,2021 CismonX <admin@cismon.net>
|
|
*
|
|
* This file is part of vscode-texinfo.
|
|
*
|
|
* vscode-texinfo is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation, either version 3 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
* vscode-texinfo is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* vscode-texinfo. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import * as vscode from 'vscode';
|
|
|
|
/**
|
|
* Fetch extension option values.
|
|
*
|
|
* See the `contributes.configuration` entry in package.json for details.
|
|
*/
|
|
export default class Options {
|
|
|
|
get enableSnippets() {
|
|
return this.getBoolean('completion.enableSnippets');
|
|
}
|
|
|
|
get hideSnippetCommands() {
|
|
return this.getBoolean('completion.hideSnippetCommands');
|
|
}
|
|
|
|
get enableCodeLens() {
|
|
return this.getBoolean('enableCodeLens');
|
|
}
|
|
|
|
get makeinfo() {
|
|
return this.getString('makeinfo');
|
|
}
|
|
|
|
get customCSS() {
|
|
return this.getString('preview.customCSS');
|
|
}
|
|
|
|
get errorLimit() {
|
|
return this.getNumber('preview.errorLimit');
|
|
}
|
|
|
|
get localImage() {
|
|
return this.getBoolean('preview.localImage');
|
|
}
|
|
|
|
get maxSize() {
|
|
return this.getNumber('preview.maxSize') * 1024 * 1024;
|
|
}
|
|
|
|
get noHeaders() {
|
|
return this.getBoolean('preview.noHeaders');
|
|
}
|
|
|
|
get noValidation() {
|
|
return this.getBoolean('preview.noValidation');
|
|
}
|
|
|
|
get noWarnings() {
|
|
return this.getBoolean('preview.noWarnings');
|
|
}
|
|
|
|
private readonly configuration = vscode.workspace.getConfiguration('texinfo');
|
|
|
|
private getBoolean(section: string) {
|
|
return this.configuration.get(section, false);
|
|
}
|
|
|
|
private getNumber(section: string) {
|
|
return this.configuration.get(section, 0);
|
|
}
|
|
|
|
private getString(section: string) {
|
|
return this.configuration.get(section, '');
|
|
}
|
|
}
|