mirror of
https://github.com/nushell/nushell.git
synced 2025-08-11 08:05:34 +02:00
Signature improves, sorted completions (#545)
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::Type;
|
||||
@ -116,3 +118,37 @@ impl SyntaxShape {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for SyntaxShape {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
SyntaxShape::Keyword(kw, shape) => {
|
||||
write!(f, "\"{}\" {}", String::from_utf8_lossy(kw), shape)
|
||||
}
|
||||
SyntaxShape::Any => write!(f, "any"),
|
||||
SyntaxShape::String => write!(f, "string"),
|
||||
SyntaxShape::CellPath => write!(f, "cellpath"),
|
||||
SyntaxShape::FullCellPath => write!(f, "cellpath"),
|
||||
SyntaxShape::Number => write!(f, "number"),
|
||||
SyntaxShape::Range => write!(f, "range"),
|
||||
SyntaxShape::Int => write!(f, "int"),
|
||||
SyntaxShape::Filepath => write!(f, "path"),
|
||||
SyntaxShape::GlobPattern => write!(f, "glob"),
|
||||
SyntaxShape::ImportPattern => write!(f, "import"),
|
||||
SyntaxShape::Block(_) => write!(f, "block"),
|
||||
SyntaxShape::Table => write!(f, "table"),
|
||||
SyntaxShape::List(x) => write!(f, "list<{}>", x),
|
||||
SyntaxShape::Filesize => write!(f, "filesize"),
|
||||
SyntaxShape::Duration => write!(f, "duration"),
|
||||
SyntaxShape::Operator => write!(f, "operator"),
|
||||
SyntaxShape::RowCondition => write!(f, "condition"),
|
||||
SyntaxShape::MathExpression => write!(f, "variable"),
|
||||
SyntaxShape::Variable => write!(f, "var"),
|
||||
SyntaxShape::VarWithOptType => write!(f, "vardecl"),
|
||||
SyntaxShape::Signature => write!(f, "signature"),
|
||||
SyntaxShape::Expression => write!(f, "expression"),
|
||||
SyntaxShape::Boolean => write!(f, "bool"),
|
||||
SyntaxShape::Custom(x, _) => write!(f, "custom<{}>", x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user