diff options
author | Aleksey Kladov <[email protected]> | 2018-08-11 14:20:37 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-11 14:20:37 +0100 |
commit | 56aa6e20e0279c69e0130905573b1607056cfaf9 (patch) | |
tree | 814d6201390b46f64ea0f9571c6b2fcff52fa016 /crates/libeditor | |
parent | fe1fe866f3fd0a7bb542debaae782470f107b7c1 (diff) |
More symbols
Diffstat (limited to 'crates/libeditor')
-rw-r--r-- | crates/libeditor/src/symbols.rs | 3 | ||||
-rw-r--r-- | crates/libeditor/tests/test.rs | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/crates/libeditor/src/symbols.rs b/crates/libeditor/src/symbols.rs index 3faf96868..5cd781c80 100644 --- a/crates/libeditor/src/symbols.rs +++ b/crates/libeditor/src/symbols.rs | |||
@@ -63,5 +63,8 @@ fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> { | |||
63 | .visit(decl::<ast::Enum<_>>) | 63 | .visit(decl::<ast::Enum<_>>) |
64 | .visit(decl::<ast::Trait<_>>) | 64 | .visit(decl::<ast::Trait<_>>) |
65 | .visit(decl::<ast::Module<_>>) | 65 | .visit(decl::<ast::Module<_>>) |
66 | .visit(decl::<ast::TypeItem<_>>) | ||
67 | .visit(decl::<ast::ConstItem<_>>) | ||
68 | .visit(decl::<ast::StaticItem<_>>) | ||
66 | .accept(node)? | 69 | .accept(node)? |
67 | } | 70 | } |
diff --git a/crates/libeditor/tests/test.rs b/crates/libeditor/tests/test.rs index ba7181ab8..dedca49a4 100644 --- a/crates/libeditor/tests/test.rs +++ b/crates/libeditor/tests/test.rs | |||
@@ -70,6 +70,9 @@ mod m { | |||
70 | } | 70 | } |
71 | 71 | ||
72 | enum E { X, Y(i32) } | 72 | enum E { X, Y(i32) } |
73 | type T = (); | ||
74 | static S: i32 = 92; | ||
75 | const C: i32 = 92; | ||
73 | "#); | 76 | "#); |
74 | let symbols = file_symbols(&file); | 77 | let symbols = file_symbols(&file); |
75 | dbg_eq( | 78 | dbg_eq( |
@@ -77,7 +80,10 @@ enum E { X, Y(i32) } | |||
77 | r#"[FileSymbol { parent: None, name: "Foo", name_range: [8; 11), node_range: [1; 26), kind: STRUCT }, | 80 | r#"[FileSymbol { parent: None, name: "Foo", name_range: [8; 11), node_range: [1; 26), kind: STRUCT }, |
78 | FileSymbol { parent: None, name: "m", name_range: [32; 33), node_range: [28; 53), kind: MODULE }, | 81 | FileSymbol { parent: None, name: "m", name_range: [32; 33), node_range: [28; 53), kind: MODULE }, |
79 | FileSymbol { parent: Some(1), name: "bar", name_range: [43; 46), node_range: [40; 51), kind: FUNCTION }, | 82 | FileSymbol { parent: Some(1), name: "bar", name_range: [43; 46), node_range: [40; 51), kind: FUNCTION }, |
80 | FileSymbol { parent: None, name: "E", name_range: [60; 61), node_range: [55; 75), kind: ENUM }]"#, | 83 | FileSymbol { parent: None, name: "E", name_range: [60; 61), node_range: [55; 75), kind: ENUM }, |
84 | FileSymbol { parent: None, name: "T", name_range: [81; 82), node_range: [76; 88), kind: TYPE_ITEM }, | ||
85 | FileSymbol { parent: None, name: "S", name_range: [96; 97), node_range: [89; 108), kind: STATIC_ITEM }, | ||
86 | FileSymbol { parent: None, name: "C", name_range: [115; 116), node_range: [109; 127), kind: CONST_ITEM }]"#, | ||
81 | ) | 87 | ) |
82 | } | 88 | } |
83 | 89 | ||