1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
use crate::semantics::*; use crate::*; mod module_cell; pub use self::module_cell::*; mod server; pub use self::server::*; #[derive(Debug)] pub struct Usage { pub handle: NamedNode, pub declaration: NamedNode, pub references: Vec<NamedNode>, pub imports: Vec<NamedNode>, } impl Usage { pub fn named_nodes(&self) -> Vec<NamedNode> { let mut nodes = self.references.clone(); nodes.push(self.declaration.clone()); nodes.extend(self.imports.iter().cloned()); nodes } pub fn handle_is_aliased(&self) -> bool { self.handle.name != self.declaration.name } pub fn is_method(&self) -> bool { self.declaration.node.is_method() } pub fn is_initializer(&self) -> bool { self.declaration.node.is_initializer() } } #[derive(Debug, Clone)] pub struct NamedNode { pub name: String, pub name_span: Span, pub node: syntax::Node, } #[derive(Debug)] pub enum Completion { Behaviours(String, Vec<Behaviour>), VariablesInScope(String, Vec<Variable>), } #[derive(Debug)] pub struct Variable { pub name: String, pub type_: Type, pub kind: VariableKind, } #[derive(Debug)] pub enum VariableKind { Unknown, Class, Parameter, }