From a303896fd9a915db6ebcd6d9baf47afcc3162189 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Tue, 5 Nov 2024 10:24:44 +0100 Subject: [PATCH] New knitr will support `#| message: NA` to suppress messages in the output and show in console This is specific support for Quarto as using the R `NA` can't be done in YAML. Knitr will convert `"NA"` to `NA` to set the option correctly. --- src/resources/editor/tools/vs-code.mjs | 24 ++++++++++++++----- src/resources/editor/tools/yaml/web-worker.js | 24 ++++++++++++++----- .../yaml/yaml-intelligence-resources.json | 24 ++++++++++++++----- src/resources/schema/cell-textoutput.yml | 10 ++++++-- 4 files changed, 62 insertions(+), 20 deletions(-) diff --git a/src/resources/editor/tools/vs-code.mjs b/src/resources/editor/tools/vs-code.mjs index bb2d371af3d..108580040ec 100644 --- a/src/resources/editor/tools/vs-code.mjs +++ b/src/resources/editor/tools/vs-code.mjs @@ -8220,9 +8220,18 @@ var require_yaml_intelligence_resources = __commonJS({ tags: { engine: "knitr" }, - schema: "boolean", + schema: { + enum: [ + true, + false, + "NA" + ] + }, default: true, - description: "Include messages in rendered output." + description: { + short: "Include messages in rendered output.", + long: "Include messages in rendered output. Possible values are `true`, `false`, or `NA`. \nIf `true`, messages are included in the output. If `false`, messages are not included. \nIf `NA`, messages are not included in output but shown in the knitr log to console.\n" + } }, { name: "results", @@ -22035,7 +22044,10 @@ var require_yaml_intelligence_resources = __commonJS({ short: "Location of output relative to the code that generated it\n(default, fragment, slide,\ncolumn, or column-location)", long: "Location of output relative to the code that generated it. The\npossible values are as follows:" }, - "Include messages in rendered output.", + { + short: "Include messages in rendered output.", + long: "Include messages in rendered output. Possible values are\ntrue, false, or NA. If\ntrue, messages are included in the output. If\nfalse, messages are not included. If NA,\nmessages are not included in output but shown in the knitr log to\nconsole." + }, { short: "How to display text results", long: "How to display text results. Note that this option only applies to\nnormal text output (not warnings, messages, or errors). The possible\nvalues are as follows:" @@ -24134,12 +24146,12 @@ var require_yaml_intelligence_resources = __commonJS({ mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 193399, + _internalId: 193475, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 193391, + _internalId: 193467, type: "enum", enum: [ "png", @@ -24155,7 +24167,7 @@ var require_yaml_intelligence_resources = __commonJS({ exhaustiveCompletions: true }, theme: { - _internalId: 193398, + _internalId: 193474, type: "anyOf", anyOf: [ { diff --git a/src/resources/editor/tools/yaml/web-worker.js b/src/resources/editor/tools/yaml/web-worker.js index 877fc79c071..28d5fa642a3 100644 --- a/src/resources/editor/tools/yaml/web-worker.js +++ b/src/resources/editor/tools/yaml/web-worker.js @@ -8221,9 +8221,18 @@ try { tags: { engine: "knitr" }, - schema: "boolean", + schema: { + enum: [ + true, + false, + "NA" + ] + }, default: true, - description: "Include messages in rendered output." + description: { + short: "Include messages in rendered output.", + long: "Include messages in rendered output. Possible values are `true`, `false`, or `NA`. \nIf `true`, messages are included in the output. If `false`, messages are not included. \nIf `NA`, messages are not included in output but shown in the knitr log to console.\n" + } }, { name: "results", @@ -22036,7 +22045,10 @@ try { short: "Location of output relative to the code that generated it\n(default, fragment, slide,\ncolumn, or column-location)", long: "Location of output relative to the code that generated it. The\npossible values are as follows:" }, - "Include messages in rendered output.", + { + short: "Include messages in rendered output.", + long: "Include messages in rendered output. Possible values are\ntrue, false, or NA. If\ntrue, messages are included in the output. If\nfalse, messages are not included. If NA,\nmessages are not included in output but shown in the knitr log to\nconsole." + }, { short: "How to display text results", long: "How to display text results. Note that this option only applies to\nnormal text output (not warnings, messages, or errors). The possible\nvalues are as follows:" @@ -24135,12 +24147,12 @@ try { mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 193399, + _internalId: 193475, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 193391, + _internalId: 193467, type: "enum", enum: [ "png", @@ -24156,7 +24168,7 @@ try { exhaustiveCompletions: true }, theme: { - _internalId: 193398, + _internalId: 193474, type: "anyOf", anyOf: [ { diff --git a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json index 3e8126dd1e6..bc497a9a186 100644 --- a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json +++ b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json @@ -1192,9 +1192,18 @@ "tags": { "engine": "knitr" }, - "schema": "boolean", + "schema": { + "enum": [ + true, + false, + "NA" + ] + }, "default": true, - "description": "Include messages in rendered output." + "description": { + "short": "Include messages in rendered output.", + "long": "Include messages in rendered output. Possible values are `true`, `false`, or `NA`. \nIf `true`, messages are included in the output. If `false`, messages are not included. \nIf `NA`, messages are not included in output but shown in the knitr log to console.\n" + } }, { "name": "results", @@ -15007,7 +15016,10 @@ "short": "Location of output relative to the code that generated it\n(default, fragment, slide,\ncolumn, or column-location)", "long": "Location of output relative to the code that generated it. The\npossible values are as follows:" }, - "Include messages in rendered output.", + { + "short": "Include messages in rendered output.", + "long": "Include messages in rendered output. Possible values are\ntrue, false, or NA. If\ntrue, messages are included in the output. If\nfalse, messages are not included. If NA,\nmessages are not included in output but shown in the knitr log to\nconsole." + }, { "short": "How to display text results", "long": "How to display text results. Note that this option only applies to\nnormal text output (not warnings, messages, or errors). The possible\nvalues are as follows:" @@ -17106,12 +17118,12 @@ "mermaid": "%%" }, "handlers/mermaid/schema.yml": { - "_internalId": 193399, + "_internalId": 193475, "type": "object", "description": "be an object", "properties": { "mermaid-format": { - "_internalId": 193391, + "_internalId": 193467, "type": "enum", "enum": [ "png", @@ -17127,7 +17139,7 @@ "exhaustiveCompletions": true }, "theme": { - "_internalId": 193398, + "_internalId": 193474, "type": "anyOf", "anyOf": [ { diff --git a/src/resources/schema/cell-textoutput.yml b/src/resources/schema/cell-textoutput.yml index 69dde901e74..c6453a203c1 100644 --- a/src/resources/schema/cell-textoutput.yml +++ b/src/resources/schema/cell-textoutput.yml @@ -72,9 +72,15 @@ - name: message tags: engine: knitr - schema: boolean + schema: + enum: [true, false, NA] default: true - description: Include messages in rendered output. + description: + short: Include messages in rendered output. + long: | + Include messages in rendered output. Possible values are `true`, `false`, or `NA`. + If `true`, messages are included in the output. If `false`, messages are not included. + If `NA`, messages are not included in output but shown in the knitr log to console. - name: results tags: