about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTopGunSnake <tjwebster@crimson.ua.edu>2022-07-18 20:48:01 -0500
committerTopGunSnake <tjwebster@crimson.ua.edu>2022-07-18 20:48:01 -0500
commit09da74a35d7d037bc78f964c69982f8d3ffa03e6 (patch)
treeadc6ac81bdc40ec923521af265dac1db7cc35b52
parent3cb78ffa82328a9a67cedc614da75092026d2890 (diff)
downloadrust-09da74a35d7d037bc78f964c69982f8d3ffa03e6.tar.gz
rust-09da74a35d7d037bc78f964c69982f8d3ffa03e6.zip
Added case for const
-rw-r--r--crates/ide-assists/src/handlers/extract_module.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ide-assists/src/handlers/extract_module.rs b/crates/ide-assists/src/handlers/extract_module.rs
index cf7d35d673d..2b2e1e9bbd3 100644
--- a/crates/ide-assists/src/handlers/extract_module.rs
+++ b/crates/ide-assists/src/handlers/extract_module.rs
@@ -389,6 +389,7 @@ impl Module {
                     | SyntaxKind::ENUM_KW
                     | SyntaxKind::TRAIT_KW
                     | SyntaxKind::TYPE_KW
+                    | SyntaxKind::CONST_KW
                     | SyntaxKind::MOD_KW => true,
                     // If we didn't find a keyword, we want to cover the record fields in a struct
                     SyntaxKind::NAME => true,
@@ -1682,7 +1683,10 @@ mod modname {
                 A,
                 /// Another variant
                 B { x: i32, y: i32 }
-            }$0
+            }
+
+            /// Documented const
+            const MY_CONST: i32 = 0;$0
         ",
             r"
             mod modname {
@@ -1765,6 +1769,9 @@ mod modname {
                     /// Another variant
                     B { x: i32, y: i32 }
                 }
+
+                /// Documented const
+                pub(crate) const MY_CONST: i32 = 0;
             }
         ",
         )