-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
elp explain
, show links to Erlang Error Index
Summary: Introduce a `elp explain` command which, given a diagnostic code, returns a link to the respective entry in the Erlang Error Index. Also enable links to the index from diagnostics. Later on we will probably want to show the actual content instead of just the link. Reviewed By: alanz Differential Revision: D49230473 fbshipit-source-id: 63b4d10eae3ed9f8ba31a52718db60be0e2be1e5
- Loading branch information
1 parent
29794ce
commit 0731696
Showing
8 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under both the MIT license found in the | ||
* LICENSE-MIT file in the root directory of this source tree and the Apache | ||
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory | ||
* of this source tree. | ||
*/ | ||
|
||
use anyhow::Result; | ||
use elp::cli::Cli; | ||
use elp_ide::diagnostics::DiagnosticCode; | ||
|
||
use crate::args::Explain; | ||
|
||
pub fn explain(args: &Explain, cli: &mut dyn Cli) -> Result<()> { | ||
if let Some(code) = DiagnosticCode::maybe_from_string(&args.code) { | ||
if let Some(uri) = DiagnosticCode::as_uri(&code) { | ||
let label = code.as_label(); | ||
return Ok(writeln!(cli, "{uri} ({label})")?); | ||
} | ||
} | ||
Ok(writeln!(cli, "Unkwnown code: {}", args.code)?) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/erlang-error-index/w/W0005 (mutable_variable_bug) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Usage: --code CODE | ||
|
||
Available options: | ||
--code <CODE> Error code to explain | ||
-h, --help Prints help information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Unkwnown code: does_not_exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters