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

@ -1,4 +1,5 @@
use nu_protocol::ast::{Block, Expr, Expression, ImportPatternMember, PathMember, Pipeline};
use nu_protocol::DeclId;
use nu_protocol::{engine::StateWorkingSet, Span};
use std::fmt::{Display, Formatter, Result};
@ -28,7 +29,7 @@ pub enum FlatShape {
GlobPattern,
Variable,
Flag,
Custom(String),
Custom(DeclId),
}
impl Display for FlatShape {
@ -76,7 +77,7 @@ pub fn flatten_expression(
expr: &Expression,
) -> Vec<(Span, FlatShape)> {
if let Some(custom_completion) = &expr.custom_completion {
return vec![(expr.span, FlatShape::Custom(custom_completion.clone()))];
return vec![(expr.span, FlatShape::Custom(*custom_completion))];
}
match &expr.expr {