pub struct DslParser { /* private fields */ }Expand description
Elasticsearch DSL 解析器(基于 Tree-sitter JSON) 注意:DSL 是 JSON 格式,使用 tree-sitter-json 解析
Implementations§
Source§impl DslParser
impl DslParser
pub fn new() -> Self
Sourcepub fn parse(&mut self, dsl: &str) -> Vec<Diagnostic>
pub fn parse(&mut self, dsl: &str) -> Vec<Diagnostic>
解析 Elasticsearch DSL(JSON 格式)
Sourcepub fn parse_with_tree(&mut self, dsl: &str) -> (Option<Tree>, Vec<Diagnostic>)
pub fn parse_with_tree(&mut self, dsl: &str) -> (Option<Tree>, Vec<Diagnostic>)
解析并返回 Tree(用于补全等功能)
Sourcepub fn get_node_at_position<'a>(
&self,
tree: &'a Tree,
position: Position,
) -> Option<Node<'a>>
pub fn get_node_at_position<'a>( &self, tree: &'a Tree, position: Position, ) -> Option<Node<'a>>
获取指定位置的节点
Sourcepub fn node_range(&self, node: Node<'_>) -> Range
pub fn node_range(&self, node: Node<'_>) -> Range
获取节点的范围
Sourcepub fn analyze_completion_context(
&self,
node: Node<'_>,
source: &str,
) -> DslCompletionContext
pub fn analyze_completion_context( &self, node: Node<'_>, source: &str, ) -> DslCompletionContext
分析补全上下文 根据光标位置的 AST 节点,判断应该提供什么类型的补全
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DslParser
impl RefUnwindSafe for DslParser
impl Send for DslParser
impl Sync for DslParser
impl Unpin for DslParser
impl UnwindSafe for DslParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more