aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-02 08:48:59 +0100
committerAleksey Kladov <[email protected]>2019-04-02 08:48:59 +0100
commit3f3ff2f0f4c188c606a96506325d96726c842239 (patch)
tree318d41ba567cf7ce1c5b4ead1857da64aa24242f /crates
parent99e6438660d665c9aa4d2831560ba2287becb13f (diff)
fix comment naming
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap9
-rw-r--r--crates/ra_syntax/src/ast/tokens.rs19
2 files changed, 15 insertions, 13 deletions
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
index 70ea96e1b..daccd9fba 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
@@ -1,6 +1,6 @@
1--- 1---
2created: "2019-02-18T09:22:24.062138085Z" 2created: "2019-04-02T07:43:12.954637543Z"
3creator: insta@0.6.2 3creator: insta@0.7.4
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
@@ -33,6 +33,9 @@ expression: kind_completions
33 delete: [180; 180), 33 delete: [180; 180),
34 insert: "S", 34 insert: "S",
35 kind: EnumVariant, 35 kind: EnumVariant,
36 detail: "(S)" 36 detail: "(S)",
37 documentation: Documentation(
38 ""
39 )
37 } 40 }
38] 41]
diff --git a/crates/ra_syntax/src/ast/tokens.rs b/crates/ra_syntax/src/ast/tokens.rs
index c830cdccf..76a12cd64 100644
--- a/crates/ra_syntax/src/ast/tokens.rs
+++ b/crates/ra_syntax/src/ast/tokens.rs
@@ -24,9 +24,9 @@ impl<'a> Comment<'a> {
24 pub fn flavor(&self) -> CommentFlavor { 24 pub fn flavor(&self) -> CommentFlavor {
25 let text = self.text(); 25 let text = self.text();
26 if text.starts_with("///") { 26 if text.starts_with("///") {
27 CommentFlavor::Doc 27 CommentFlavor::OuterDoc
28 } else if text.starts_with("//!") { 28 } else if text.starts_with("//!") {
29 CommentFlavor::ModuleDoc 29 CommentFlavor::InnerDoc
30 } else if text.starts_with("//") { 30 } else if text.starts_with("//") {
31 CommentFlavor::Line 31 CommentFlavor::Line
32 } else { 32 } else {
@@ -46,25 +46,24 @@ impl<'a> Comment<'a> {
46#[derive(Debug, PartialEq, Eq)] 46#[derive(Debug, PartialEq, Eq)]
47pub enum CommentFlavor { 47pub enum CommentFlavor {
48 Line, 48 Line,
49 Doc, 49 OuterDoc,
50 ModuleDoc, 50 InnerDoc,
51 Multiline, 51 Multiline,
52} 52}
53 53
54impl CommentFlavor { 54impl CommentFlavor {
55 pub fn prefix(&self) -> &'static str { 55 pub fn prefix(&self) -> &'static str {
56 use self::CommentFlavor::*;
57 match *self { 56 match *self {
58 Line => "//", 57 CommentFlavor::Line => "//",
59 Doc => "///", 58 CommentFlavor::OuterDoc => "///",
60 ModuleDoc => "//!", 59 CommentFlavor::InnerDoc => "//!",
61 Multiline => "/*", 60 CommentFlavor::Multiline => "/*",
62 } 61 }
63 } 62 }
64 63
65 pub fn is_doc_comment(&self) -> bool { 64 pub fn is_doc_comment(&self) -> bool {
66 match self { 65 match self {
67 CommentFlavor::Doc | CommentFlavor::ModuleDoc => true, 66 CommentFlavor::OuterDoc | CommentFlavor::InnerDoc => true,
68 _ => false, 67 _ => false,
69 } 68 }
70 } 69 }