Very early proof-of-concept git branch completion

This commit is contained in:
JT
2021-09-14 16:59:46 +12:00
parent 7b54e5c4ab
commit b4f918b889
11 changed files with 293 additions and 4 deletions

View File

@ -6,6 +6,7 @@ pub struct Expression {
pub expr: Expr,
pub span: Span,
pub ty: Type,
pub custom_completion: Option<String>,
}
impl Expression {
@ -14,6 +15,7 @@ impl Expression {
expr: Expr::Garbage,
span,
ty: Type::Unknown,
custom_completion: None,
}
}

View File

@ -69,6 +69,9 @@ pub enum SyntaxShape {
/// A general expression, eg `1 + 2` or `foo --bar`
Expression,
/// A custom shape with custom completion logic
Custom(Box<SyntaxShape>, String),
}
impl SyntaxShape {
@ -77,6 +80,7 @@ impl SyntaxShape {
SyntaxShape::Any => Type::Unknown,
SyntaxShape::Block(_) => Type::Block,
SyntaxShape::CellPath => Type::Unknown,
SyntaxShape::Custom(custom, _) => custom.to_type(),
SyntaxShape::Duration => Type::Duration,
SyntaxShape::Expression => Type::Unknown,
SyntaxShape::FilePath => Type::FilePath,