Update configuration options.

This commit is contained in:
CismonX 2021-04-29 20:17:49 +08:00
parent c0f1a64ab8
commit c09d267d66
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
4 changed files with 15 additions and 15 deletions

View File

@ -154,6 +154,11 @@
"default": true,
"description": "When snippet is enabled, hide the snippets' corresponding commands from completion items."
},
"texinfo.diagnosis.noWarnings": {
"type": "boolean",
"default": false,
"description": "Do not show warnings in diagnosis."
},
"texinfo.enableCodeLens": {
"type": "boolean",
"default": true,
@ -202,11 +207,6 @@
"default": false,
"description": "Supress node cross-reference validation."
},
"texinfo.preview.noWarnings": {
"type": "boolean",
"default": false,
"description": "Suppress warnings."
},
"texinfo.preview.variables": {
"type": "array",
"default": [],

View File

@ -102,9 +102,11 @@ export default class ContextMapping implements vscode.Disposable {
const document = editor.document;
// Only show preview for saved files, as we're not gonna send document content to `makeinfo` via STDIN.
// Instead, the file will be loaded from disk.
if (document.isUntitled) {
if (!await prompt('Save this document to display preview.', 'Save')) return;
if (!await document.save()) return;
if (document.isUntitled && !await prompt('Save this document to display preview.', 'Save')) {
return;
}
if (document.isDirty && !await document.save()) {
return;
}
this.getDocumentContext(document).initPreview().show();
}

View File

@ -36,6 +36,10 @@ export default class Options {
return this.getBoolean('completion.hideSnippetCommands');
}
get noWarnings() {
return this.getBoolean('diagnosis.noWarnings');
}
get enableCodeLens() {
return this.getBoolean('enableCodeLens');
}
@ -72,10 +76,6 @@ export default class Options {
return this.getBoolean('preview.noValidation');
}
get noWarnings() {
return this.getBoolean('preview.noWarnings');
}
get variables() {
return this.getArray('preview.variables');
}

View File

@ -39,9 +39,7 @@ export default class Converter {
this.options.noNumberSections && options.push('--no-number-sections');
this.options.noValidation && options.push('--no-validate');
this.options.noWarnings && options.push('--no-warn');
if (insertScript !== undefined) {
options.push('--set-customization-variable', `EXTRA_HEAD <script>${insertScript}</script>`);
}
insertScript !== undefined && options.push('-c', `EXTRA_HEAD <script>${insertScript}</script>`);
this.addIncludePaths(this.options.includePaths, options);
this.defineVariables(this.options.variables, options);
this.includeCustomCSS(this.options.customCSS, options);