Move completions to DeclId (#4801)

* Move completions to DeclId

* fmt

* fmt
This commit is contained in:
JT
2022-03-10 02:49:02 -05:00
committed by GitHub
parent 643cce8a6f
commit 12bf23faa6
8 changed files with 37 additions and 30 deletions

View File

@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
use super::{Expr, Operator};
use crate::ast::ImportPattern;
use crate::DeclId;
use crate::{engine::StateWorkingSet, BlockId, Signature, Span, Type, VarId, IN_VARIABLE_ID};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
@ -9,7 +10,7 @@ pub struct Expression {
pub expr: Expr,
pub span: Span,
pub ty: Type,
pub custom_completion: Option<String>,
pub custom_completion: Option<DeclId>,
}
impl Expression {

View File

@ -2,7 +2,7 @@ use std::fmt::Display;
use serde::{Deserialize, Serialize};
use crate::Type;
use crate::{DeclId, Type};
/// The syntactic shapes that values must match to be passed into a command. You can think of this as the type-checking that occurs when you call a function.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@ -90,7 +90,7 @@ pub enum SyntaxShape {
Record,
/// A custom shape with custom completion logic
Custom(Box<SyntaxShape>, String),
Custom(Box<SyntaxShape>, DeclId),
}
impl SyntaxShape {

View File

@ -51,7 +51,7 @@ impl Type {
Type::Unknown => SyntaxShape::Any,
Type::Error => SyntaxShape::Any,
Type::Binary => SyntaxShape::Binary,
Type::Custom => SyntaxShape::Custom(Box::new(SyntaxShape::Any), String::new()),
Type::Custom => SyntaxShape::Any,
Type::Signature => SyntaxShape::Signature,
}
}