aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap9
-rw-r--r--crates/ra_ide_api/src/extend_selection.rs12
-rw-r--r--crates/ra_ide_api/src/folding_ranges.rs10
-rw-r--r--crates/ra_ide_api/src/join_lines.rs4
-rw-r--r--crates/ra_ide_api/src/typing.rs2
5 files changed, 20 insertions, 17 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_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs
index e743bf0fe..7293ba359 100644
--- a/crates/ra_ide_api/src/extend_selection.rs
+++ b/crates/ra_ide_api/src/extend_selection.rs
@@ -1,9 +1,9 @@
1use ra_db::SourceDatabase; 1use ra_db::SourceDatabase;
2use ra_syntax::{ 2use ra_syntax::{
3 Direction, SyntaxNode, TextRange, TextUnit, AstNode, SyntaxElement, 3 Direction, SyntaxNode, TextRange, TextUnit, SyntaxElement,
4 algo::{find_covering_element, find_token_at_offset, TokenAtOffset}, 4 algo::{find_covering_element, find_token_at_offset, TokenAtOffset},
5 SyntaxKind::*, SyntaxToken, 5 SyntaxKind::*, SyntaxToken,
6 ast::Comment, 6 ast::{self, AstNode, AstToken},
7}; 7};
8 8
9use crate::{FileRange, db::RootDatabase}; 9use crate::{FileRange, db::RootDatabase};
@@ -55,7 +55,7 @@ fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange
55 if token.range() != range { 55 if token.range() != range {
56 return Some(token.range()); 56 return Some(token.range());
57 } 57 }
58 if let Some(comment) = Comment::cast(token) { 58 if let Some(comment) = ast::Comment::cast(token) {
59 if let Some(range) = extend_comments(comment) { 59 if let Some(range) = extend_comments(comment) {
60 return Some(range); 60 return Some(range);
61 } 61 }
@@ -176,7 +176,7 @@ fn extend_list_item(node: &SyntaxNode) -> Option<TextRange> {
176 None 176 None
177} 177}
178 178
179fn extend_comments(comment: Comment) -> Option<TextRange> { 179fn extend_comments(comment: ast::Comment) -> Option<TextRange> {
180 let prev = adj_comments(comment, Direction::Prev); 180 let prev = adj_comments(comment, Direction::Prev);
181 let next = adj_comments(comment, Direction::Next); 181 let next = adj_comments(comment, Direction::Next);
182 if prev != next { 182 if prev != next {
@@ -186,14 +186,14 @@ fn extend_comments(comment: Comment) -> Option<TextRange> {
186 } 186 }
187} 187}
188 188
189fn adj_comments(comment: Comment, dir: Direction) -> Comment { 189fn adj_comments(comment: ast::Comment, dir: Direction) -> ast::Comment {
190 let mut res = comment; 190 let mut res = comment;
191 for element in comment.syntax().siblings_with_tokens(dir) { 191 for element in comment.syntax().siblings_with_tokens(dir) {
192 let token = match element.as_token() { 192 let token = match element.as_token() {
193 None => break, 193 None => break,
194 Some(token) => token, 194 Some(token) => token,
195 }; 195 };
196 if let Some(c) = Comment::cast(token) { 196 if let Some(c) = ast::Comment::cast(token) {
197 res = c 197 res = c
198 } else if token.kind() != WHITESPACE || token.text().contains("\n\n") { 198 } else if token.kind() != WHITESPACE || token.text().contains("\n\n") {
199 break; 199 break;
diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs
index a6fe8a5d5..eada0b7de 100644
--- a/crates/ra_ide_api/src/folding_ranges.rs
+++ b/crates/ra_ide_api/src/folding_ranges.rs
@@ -1,9 +1,9 @@
1use rustc_hash::FxHashSet; 1use rustc_hash::FxHashSet;
2 2
3use ra_syntax::{ 3use ra_syntax::{
4 AstNode, SourceFile, SyntaxNode, TextRange, Direction, SyntaxElement, 4 SourceFile, SyntaxNode, TextRange, Direction, SyntaxElement,
5 SyntaxKind::{self, *}, 5 SyntaxKind::{self, *},
6 ast::{self, VisibilityOwner, Comment}, 6 ast::{self, AstNode, AstToken, VisibilityOwner},
7}; 7};
8 8
9#[derive(Debug, PartialEq, Eq)] 9#[derive(Debug, PartialEq, Eq)]
@@ -139,8 +139,8 @@ fn contiguous_range_for_group_unless<'a>(
139} 139}
140 140
141fn contiguous_range_for_comment<'a>( 141fn contiguous_range_for_comment<'a>(
142 first: Comment<'a>, 142 first: ast::Comment<'a>,
143 visited: &mut FxHashSet<Comment<'a>>, 143 visited: &mut FxHashSet<ast::Comment<'a>>,
144) -> Option<TextRange> { 144) -> Option<TextRange> {
145 visited.insert(first); 145 visited.insert(first);
146 146
@@ -157,7 +157,7 @@ fn contiguous_range_for_comment<'a>(
157 continue; 157 continue;
158 } 158 }
159 } 159 }
160 if let Some(c) = Comment::cast(token) { 160 if let Some(c) = ast::Comment::cast(token) {
161 if c.flavor() == group_flavor { 161 if c.flavor() == group_flavor {
162 visited.insert(c); 162 visited.insert(c);
163 last = c; 163 last = c;
diff --git a/crates/ra_ide_api/src/join_lines.rs b/crates/ra_ide_api/src/join_lines.rs
index 57b6f8384..598717311 100644
--- a/crates/ra_ide_api/src/join_lines.rs
+++ b/crates/ra_ide_api/src/join_lines.rs
@@ -1,9 +1,9 @@
1use itertools::Itertools; 1use itertools::Itertools;
2use ra_syntax::{ 2use ra_syntax::{
3 SourceFile, TextRange, TextUnit, AstNode, SyntaxNode, SyntaxElement, SyntaxToken, 3 SourceFile, TextRange, TextUnit, SyntaxNode, SyntaxElement, SyntaxToken,
4 SyntaxKind::{self, WHITESPACE, COMMA, R_CURLY, R_PAREN, R_BRACK}, 4 SyntaxKind::{self, WHITESPACE, COMMA, R_CURLY, R_PAREN, R_BRACK},
5 algo::{find_covering_element, non_trivia_sibling}, 5 algo::{find_covering_element, non_trivia_sibling},
6 ast, 6 ast::{self, AstNode, AstToken},
7 Direction, 7 Direction,
8}; 8};
9use ra_fmt::{ 9use ra_fmt::{
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs
index 4510d663d..aeeeea082 100644
--- a/crates/ra_ide_api/src/typing.rs
+++ b/crates/ra_ide_api/src/typing.rs
@@ -2,7 +2,7 @@ use ra_syntax::{
2 AstNode, SourceFile, SyntaxKind::*, 2 AstNode, SourceFile, SyntaxKind::*,
3 TextUnit, TextRange, SyntaxToken, 3 TextUnit, TextRange, SyntaxToken,
4 algo::{find_node_at_offset, find_token_at_offset, TokenAtOffset}, 4 algo::{find_node_at_offset, find_token_at_offset, TokenAtOffset},
5 ast::{self}, 5 ast::{self, AstToken},
6}; 6};
7use ra_fmt::leading_indent; 7use ra_fmt::leading_indent;
8use ra_text_edit::{TextEdit, TextEditBuilder}; 8use ra_text_edit::{TextEdit, TextEditBuilder};