diff --git a/package.json b/package.json index 31d72d8..8785270 100644 --- a/package.json +++ b/package.json @@ -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": [], diff --git a/src/context_mapping.ts b/src/context_mapping.ts index f2c902b..02295c4 100644 --- a/src/context_mapping.ts +++ b/src/context_mapping.ts @@ -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(); } diff --git a/src/options.ts b/src/options.ts index bc2f6c9..e4df778 100644 --- a/src/options.ts +++ b/src/options.ts @@ -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'); } diff --git a/src/utils/converter.ts b/src/utils/converter.ts index b41bbc6..3e39af1 100644 --- a/src/utils/converter.ts +++ b/src/utils/converter.ts @@ -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 `); - } + insertScript !== undefined && options.push('-c', `EXTRA_HEAD `); this.addIncludePaths(this.options.includePaths, options); this.defineVariables(this.options.variables, options); this.includeCustomCSS(this.options.customCSS, options);