Skip to content

Commit 129857d

Browse files
committed
refactor: eval_expression -> eval_constant
1 parent b2e297f commit 129857d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

crates/nu-cli/src/completions/variable_completions.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use crate::completions::{Completer, CompletionOptions, SemanticSuggestion, SuggestionKind};
2-
use nu_engine::{column::get_columns, eval_expression, eval_variable};
2+
use nu_engine::{column::get_columns, eval_variable};
33
use nu_protocol::{
44
ast::{Expr, FullCellPath, PathMember},
5-
debugger::WithoutDebug,
65
engine::{Stack, StateWorkingSet},
6+
eval_const::eval_constant,
77
Span, Value, VarId,
88
};
99
use reedline::Suggestion;
@@ -124,12 +124,9 @@ impl Completer for CellPathCompletion<'_> {
124124
.get_variable(var_id)
125125
.const_val
126126
.to_owned()
127-
.or(eval_variable(working_set.permanent_state, stack, var_id, span).ok())
127+
.or_else(|| eval_variable(working_set.permanent_state, stack, var_id, span).ok())
128128
} else {
129-
let mut stack = stack.clone();
130-
let mut new_engine = working_set.permanent_state.clone();
131-
let _ = new_engine.merge_delta(working_set.delta.clone());
132-
eval_expression::<WithoutDebug>(&new_engine, &mut stack, &self.full_cell_path.head).ok()
129+
eval_constant(working_set, &self.full_cell_path.head).ok()
133130
}
134131
.unwrap_or_default();
135132

0 commit comments

Comments
 (0)