aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-01-24 00:32:52 +0000
committerLukas Wirth <[email protected]>2021-01-24 00:32:52 +0000
commita872ebf81f20815501299ae562c39bb9c872ba47 (patch)
treeab1e96340ba6717daec0bd0d3051230463c2916f /crates/ide_db/src
parent89fef5307e81d5d23bb65677000f35332190661a (diff)
Support unions in symbol search
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r--crates/ide_db/src/symbol_index.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/ide_db/src/symbol_index.rs b/crates/ide_db/src/symbol_index.rs
index e954bd72e..9ed9568ce 100644
--- a/crates/ide_db/src/symbol_index.rs
+++ b/crates/ide_db/src/symbol_index.rs
@@ -356,15 +356,16 @@ pub struct FileSymbol {
356 356
357#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] 357#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
358pub enum FileSymbolKind { 358pub enum FileSymbolKind {
359 Const,
360 Enum,
359 Function, 361 Function,
362 Macro,
363 Module,
364 Static,
360 Struct, 365 Struct,
361 Enum,
362 Trait, 366 Trait,
363 Module,
364 TypeAlias, 367 TypeAlias,
365 Const, 368 Union,
366 Static,
367 Macro,
368} 369}
369 370
370impl FileSymbolKind { 371impl FileSymbolKind {
@@ -375,6 +376,7 @@ impl FileSymbolKind {
375 | FileSymbolKind::Enum 376 | FileSymbolKind::Enum
376 | FileSymbolKind::Trait 377 | FileSymbolKind::Trait
377 | FileSymbolKind::TypeAlias 378 | FileSymbolKind::TypeAlias
379 | FileSymbolKind::Union
378 ) 380 )
379 } 381 }
380} 382}
@@ -425,6 +427,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
425 ast::Const(it) => decl(it), 427 ast::Const(it) => decl(it),
426 ast::Static(it) => decl(it), 428 ast::Static(it) => decl(it),
427 ast::MacroRules(it) => decl(it), 429 ast::MacroRules(it) => decl(it),
430 ast::Union(it) => decl(it),
428 _ => None, 431 _ => None,
429 } 432 }
430 } 433 }
@@ -443,6 +446,7 @@ fn to_file_symbol(node: &SyntaxNode, file_id: FileId) -> Option<FileSymbol> {
443 CONST => FileSymbolKind::Const, 446 CONST => FileSymbolKind::Const,
444 STATIC => FileSymbolKind::Static, 447 STATIC => FileSymbolKind::Static,
445 MACRO_RULES => FileSymbolKind::Macro, 448 MACRO_RULES => FileSymbolKind::Macro,
449 UNION => FileSymbolKind::Union,
446 kind => unreachable!("{:?}", kind), 450 kind => unreachable!("{:?}", kind),
447 }, 451 },
448 range: node.text_range(), 452 range: node.text_range(),