forked from extern/nushell
In Nu we have variables (E.g. $var-name) and these contain `Value` types. This means we can bind to variables any structured data and column path syntax (E.g. `$variable.path.to`) allows flexibility for "querying" said structures. Here we offer completions for these. For example, in a Nushell session the variable `$nu` contains environment values among other things. If we wanted to see in the screen some environment variable (say the var `SHELL`) we do: ``` > echo $nu.env.SHELL ``` with completions we can now do: `echo $nu.env.S[\TAB]` and we get suggestions that start at the column path `$nu.env` with vars starting with the letter `S` in this case `SHELL` appears in the suggestions.
22 lines
545 B
Rust
22 lines
545 B
Rust
use nu_protocol::hir::Block;
|
|
use nu_source::Spanned;
|
|
use std::{fmt::Debug, sync::Arc};
|
|
|
|
pub trait ParserScope: Debug {
|
|
fn get_signature(&self, name: &str) -> Option<nu_protocol::Signature>;
|
|
|
|
fn has_signature(&self, name: &str) -> bool;
|
|
|
|
fn add_definition(&self, block: Arc<Block>);
|
|
|
|
fn get_definitions(&self) -> Vec<Arc<Block>>;
|
|
|
|
fn get_alias(&self, name: &str) -> Option<Vec<Spanned<String>>>;
|
|
|
|
fn add_alias(&self, name: &str, replacement: Vec<Spanned<String>>);
|
|
|
|
fn enter_scope(&self);
|
|
|
|
fn exit_scope(&self);
|
|
}
|