mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 14:06:40 +02:00
Move completions to DeclId (#4801)
* Move completions to DeclId * fmt * fmt
This commit is contained in:
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user