-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for reading air.toml in the CLI and LSP
- Loading branch information
1 parent
5446d7e
commit 8045f6c
Showing
38 changed files
with
1,616 additions
and
168 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
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,3 @@ | ||
mod magic_line_break; | ||
|
||
pub use magic_line_break::*; |
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,44 @@ | ||
use std::fmt::Display; | ||
use std::str::FromStr; | ||
|
||
#[derive(Debug, Default, Clone, Copy, Eq, Hash, PartialEq)] | ||
pub enum MagicLineBreak { | ||
/// Respect | ||
#[default] | ||
Respect, | ||
/// Ignore | ||
Ignore, | ||
} | ||
|
||
impl MagicLineBreak { | ||
/// Returns `true` if magic line breaks should be respected. | ||
pub const fn is_respect(&self) -> bool { | ||
matches!(self, MagicLineBreak::Respect) | ||
} | ||
|
||
/// Returns `true` if magic line breaks should be ignored. | ||
pub const fn is_ignore(&self) -> bool { | ||
matches!(self, MagicLineBreak::Ignore) | ||
} | ||
} | ||
|
||
impl FromStr for MagicLineBreak { | ||
type Err = &'static str; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s { | ||
"respect" => Ok(Self::Respect), | ||
"ignore" => Ok(Self::Ignore), | ||
_ => Err("Unsupported value for this option"), | ||
} | ||
} | ||
} | ||
|
||
impl Display for MagicLineBreak { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
MagicLineBreak::Respect => std::write!(f, "Respect"), | ||
MagicLineBreak::Ignore => std::write!(f, "Ignore"), | ||
} | ||
} | ||
} |
Oops, something went wrong.