Track call arguments in a single list (#5125)

* Initial implementation of ordered call args

* Run cargo fmt

* Fix some clippy lints

* Add positional len and nth

* Cargo fmt

* Remove more old nth calls

* Good ole rustfmt

* Add named len

Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
This commit is contained in:
Hristo Filaretov
2022-04-09 04:55:02 +02:00
committed by GitHub
parent 3bac480ca0
commit 683b912263
25 changed files with 263 additions and 190 deletions

View File

@ -1,7 +1,7 @@
use crate::completions::{Completer, CompletionOptions, SortBy};
use nu_engine::eval_call;
use nu_protocol::{
ast::{Call, Expr, Expression},
ast::{Argument, Call, Expr, Expression},
engine::{EngineState, Stack, StateWorkingSet},
PipelineData, Span, Type, Value, CONFIG_VARIABLE_ID,
};
@ -92,21 +92,20 @@ impl Completer for CustomCompletion {
&Call {
decl_id: self.decl_id,
head: span,
positional: vec![
Expression {
arguments: vec![
Argument::Positional(Expression {
span: Span { start: 0, end: 0 },
ty: Type::String,
expr: Expr::String(self.line.clone()),
custom_completion: None,
},
Expression {
}),
Argument::Positional(Expression {
span: Span { start: 0, end: 0 },
ty: Type::Int,
expr: Expr::Int(line_pos as i64),
custom_completion: None,
},
}),
],
named: vec![],
redirect_stdout: true,
redirect_stderr: true,
},