-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove colors from Bend diagnostic output
Related to issue #1
- Loading branch information
Showing
6 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,19 @@ | ||
// Parts of this code are based on https://github.com/Aloso/to-html/blob/main/LICENSE, | ||
// which is MIT-licensed. | ||
|
||
use lazy_static::lazy_static; | ||
use regex::Regex; | ||
|
||
lazy_static! { | ||
pub static ref ANSI_REGEX: Regex = | ||
Regex::new(r"\u{1b}(\[[0-9;?]*[A-HJKSTfhilmnsu]|\(B)").unwrap(); | ||
} | ||
|
||
/// This function receives a string with color and highlighting information | ||
/// in ANSI color code format and treats them to be reported by the language server. | ||
/// | ||
/// As tracked in issue #1, diagnostic highlighting still does not implement color | ||
/// information in VSCode, so for now we just remove color codes. | ||
pub fn treat_colors(text: &str) -> String { | ||
ANSI_REGEX.replace_all(text, "").to_string() | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub(crate) mod lsp_log; | ||
pub(crate) mod color_wrapper; |