Skip to content

Commit

Permalink
output fully valid json for elp config command
Browse files Browse the repository at this point in the history
Summary:
The initial output was a fragment intended to be inserted into an existing config file.
Rather dump a properly-formed json file, so it can be more easily processed.

Reviewed By: robertoaloi, ir-regular

Differential Revision: D56015653

fbshipit-source-id: cbde7d38e8f057c0230987a1eb78c10994215c28
  • Loading branch information
alanz authored and facebook-github-bot committed Apr 11, 2024
1 parent 55b7e47 commit 9c1a002
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 97 deletions.
5 changes: 3 additions & 2 deletions crates/elp/src/bin/config_stanza.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

use anyhow::Result;
use elp::cli::Cli;
use elp::config::config_schema_json;
use elp::config::Config;

use crate::args::ConfigStanza;

pub fn config_stanza(_args: &ConfigStanza, cli: &mut dyn Cli) -> Result<()> {
Ok(writeln!(cli, "{}", config_schema_json())?)
let schema = format!("{:#}", Config::json_schema());
Ok(writeln!(cli, "{}", schema)?)
}
191 changes: 96 additions & 95 deletions crates/elp/src/resources/test/config_stanza.stdout
Original file line number Diff line number Diff line change
@@ -1,97 +1,98 @@
"elp.ai.enable": {
"default": false,
"markdownDescription": "Enable support for AI-based completions.",
"type": "boolean"
},
"elp.diagnostics.disabled": {
"default": [],
"items": {
{
"elp.ai.enable": {
"default": false,
"markdownDescription": "Enable support for AI-based completions.",
"type": "boolean"
},
"elp.diagnostics.disabled": {
"default": [],
"items": {
"type": "string"
},
"markdownDescription": "List of ELP diagnostics to disable.",
"type": "array",
"uniqueItems": true
},
"elp.diagnostics.enableExperimental": {
"default": false,
"markdownDescription": "Whether to show experimental ELP diagnostics that might\nhave more false positives than usual.",
"type": "boolean"
},
"elp.eqwalizer.all": {
"default": false,
"markdownDescription": "Whether to report Eqwalizer diagnostics for the whole project and not only for opened files.",
"type": "boolean"
},
"elp.eqwalizer.chunkSize": {
"default": 100,
"markdownDescription": "Chunk size to use for project-wide eqwalization.",
"minimum": 0,
"type": "integer"
},
"elp.eqwalizer.maxTasks": {
"default": 32,
"markdownDescription": "Maximum number of tasks to run in parallel for project-wide eqwalization.",
"minimum": 0,
"type": "integer"
},
"elp.hoverActions.docLinks.enable": {
"default": false,
"markdownDescription": "Whether to show Hover Actions of type 'docs'. Only applies when\n`#elp.hoverActions.enable#` is set.",
"type": "boolean"
},
"elp.hoverActions.enable": {
"default": false,
"markdownDescription": "Whether to show Hover Actions.",
"type": "boolean"
},
"elp.inlayHints.parameterHints.enable": {
"default": true,
"markdownDescription": "Whether to show function parameter name inlay hints at the call\nsite.",
"type": "boolean"
},
"elp.lens.debug.enable": {
"default": false,
"markdownDescription": "Whether to show the `Debug` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.lens.enable": {
"default": false,
"markdownDescription": "Whether to show Code Lenses in Erlang files.",
"type": "boolean"
},
"elp.lens.links.enable": {
"default": false,
"markdownDescription": "Whether to show the `Link` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.lens.run.coverage.enable": {
"default": false,
"markdownDescription": "Display code coverage information when running tests via the\nCode Lenses. Only applies when `#elp.lens.enabled` and\n`#elp.lens.run.enable#` are set.",
"type": "boolean"
},
"elp.lens.run.enable": {
"default": false,
"markdownDescription": "Whether to show the `Run` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.lens.run.interactive.enable": {
"default": false,
"markdownDescription": "Whether to show the `Run Interactive` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.log": {
"default": "error",
"markdownDescription": "Configure LSP-based logging using env_logger syntax.",
"type": "string"
},
"markdownDescription": "List of ELP diagnostics to disable.",
"type": "array",
"uniqueItems": true
},
"elp.diagnostics.enableExperimental": {
"default": false,
"markdownDescription": "Whether to show experimental ELP diagnostics that might\nhave more false positives than usual.",
"type": "boolean"
},
"elp.eqwalizer.all": {
"default": false,
"markdownDescription": "Whether to report Eqwalizer diagnostics for the whole project and not only for opened files.",
"type": "boolean"
},
"elp.eqwalizer.chunkSize": {
"default": 100,
"markdownDescription": "Chunk size to use for project-wide eqwalization.",
"minimum": 0,
"type": "integer"
},
"elp.eqwalizer.maxTasks": {
"default": 32,
"markdownDescription": "Maximum number of tasks to run in parallel for project-wide eqwalization.",
"minimum": 0,
"type": "integer"
},
"elp.hoverActions.docLinks.enable": {
"default": false,
"markdownDescription": "Whether to show Hover Actions of type 'docs'. Only applies when\n`#elp.hoverActions.enable#` is set.",
"type": "boolean"
},
"elp.hoverActions.enable": {
"default": false,
"markdownDescription": "Whether to show Hover Actions.",
"type": "boolean"
},
"elp.inlayHints.parameterHints.enable": {
"default": false,
"markdownDescription": "Whether to show function parameter name inlay hints at the call\nsite.",
"type": "boolean"
},
"elp.lens.debug.enable": {
"default": false,
"markdownDescription": "Whether to show the `Debug` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.lens.enable": {
"default": false,
"markdownDescription": "Whether to show Code Lenses in Erlang files.",
"type": "boolean"
},
"elp.lens.links.enable": {
"default": false,
"markdownDescription": "Whether to show the `Link` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.lens.run.coverage.enable": {
"default": false,
"markdownDescription": "Display code coverage information when running tests via the\nCode Lenses. Only applies when `#elp.lens.enabled` and\n`#elp.lens.run.enable#` are set.",
"type": "boolean"
},
"elp.lens.run.enable": {
"default": false,
"markdownDescription": "Whether to show the `Run` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.lens.run.interactive.enable": {
"default": false,
"markdownDescription": "Whether to show the `Run Interactive` lenses. Only applies when\n`#elp.lens.enable#` is set.",
"type": "boolean"
},
"elp.log": {
"default": "error",
"markdownDescription": "Configure LSP-based logging using env_logger syntax.",
"type": "string"
},
"elp.signatureHelp.enable": {
"default": false,
"markdownDescription": "Whether to show Signature Help.",
"type": "boolean"
},
"elp.typesOnHover.enable": {
"default": false,
"markdownDescription": "Display types when hovering over expressions.",
"type": "boolean"
},

"elp.signatureHelp.enable": {
"default": true,
"markdownDescription": "Whether to show Signature Help.",
"type": "boolean"
},
"elp.typesOnHover.enable": {
"default": false,
"markdownDescription": "Display types when hovering over expressions.",
"type": "boolean"
}
}

0 comments on commit 9c1a002

Please sign in to comment.