chtenb 2025-06-14 23:57:52 +03:00 committed by GitHub
commit ee14b55f15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View File

@ -24,9 +24,9 @@ pub enum IndentStyle {
Spaces(u8),
}
// 16 spaces
// 128 spaces
const INDENTS: &str = " ";
pub const MAX_INDENT: u8 = 16;
pub const MAX_INDENT: u8 = 128;
impl IndentStyle {
/// Creates an `IndentStyle` from an indentation string.

View File

@ -1,4 +1,4 @@
use crate::{auto_pairs::AutoPairs, diagnostic::Severity, Language};
use crate::{auto_pairs::AutoPairs, diagnostic::Severity, indent::MAX_INDENT, Language};
use globset::GlobSet;
use helix_stdx::rope;
@ -595,12 +595,13 @@ where
D: serde::Deserializer<'de>,
{
usize::deserialize(deserializer).and_then(|n| {
if n > 0 && n <= 16 {
if n > 0 && n <= MAX_INDENT.into() {
Ok(n)
} else {
Err(serde::de::Error::custom(
"tab width must be a value from 1 to 16 inclusive",
))
Err(serde::de::Error::custom(format!(
"tab width must be a value from 1 to {} inclusive",
MAX_INDENT
)))
}
})
}