diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 12:15:55 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 12:15:55 +0100 |
commit | f209843e31af7f0e0212aa28ffec2efad2a70c6f (patch) | |
tree | 548227da78a3bea644f57714d075410c0bdf7469 /crates/ra_assists/src/assist_ctx.rs | |
parent | 58d4983ba5745975446d60f2886d96f8d2adf0f2 (diff) | |
parent | d4a66166c002f0a49e41d856a49cb5685ac93202 (diff) |
Merge #1545
1545: migrate ra_syntax to the new rowan API r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Diffstat (limited to 'crates/ra_assists/src/assist_ctx.rs')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 34b207154..e52085f85 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -49,7 +49,7 @@ pub(crate) enum Assist { | |||
49 | pub(crate) struct AssistCtx<'a, DB> { | 49 | pub(crate) struct AssistCtx<'a, DB> { |
50 | pub(crate) db: &'a DB, | 50 | pub(crate) db: &'a DB, |
51 | pub(crate) frange: FileRange, | 51 | pub(crate) frange: FileRange, |
52 | source_file: &'a SourceFile, | 52 | source_file: SourceFile, |
53 | should_compute_edit: bool, | 53 | should_compute_edit: bool, |
54 | assist: Assist, | 54 | assist: Assist, |
55 | } | 55 | } |
@@ -59,7 +59,7 @@ impl<'a, DB> Clone for AssistCtx<'a, DB> { | |||
59 | AssistCtx { | 59 | AssistCtx { |
60 | db: self.db, | 60 | db: self.db, |
61 | frange: self.frange, | 61 | frange: self.frange, |
62 | source_file: self.source_file, | 62 | source_file: self.source_file.clone(), |
63 | should_compute_edit: self.should_compute_edit, | 63 | should_compute_edit: self.should_compute_edit, |
64 | assist: self.assist.clone(), | 64 | assist: self.assist.clone(), |
65 | } | 65 | } |
@@ -104,18 +104,18 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { | |||
104 | Some(self.assist) | 104 | Some(self.assist) |
105 | } | 105 | } |
106 | 106 | ||
107 | pub(crate) fn token_at_offset(&self) -> TokenAtOffset<SyntaxToken<'a>> { | 107 | pub(crate) fn token_at_offset(&self) -> TokenAtOffset<SyntaxToken> { |
108 | find_token_at_offset(self.source_file.syntax(), self.frange.range.start()) | 108 | find_token_at_offset(self.source_file.syntax(), self.frange.range.start()) |
109 | } | 109 | } |
110 | 110 | ||
111 | pub(crate) fn node_at_offset<N: AstNode>(&self) -> Option<&'a N> { | 111 | pub(crate) fn node_at_offset<N: AstNode>(&self) -> Option<N> { |
112 | find_node_at_offset(self.source_file.syntax(), self.frange.range.start()) | 112 | find_node_at_offset(self.source_file.syntax(), self.frange.range.start()) |
113 | } | 113 | } |
114 | pub(crate) fn covering_element(&self) -> SyntaxElement<'a> { | 114 | pub(crate) fn covering_element(&self) -> SyntaxElement { |
115 | find_covering_element(self.source_file.syntax(), self.frange.range) | 115 | find_covering_element(self.source_file.syntax(), self.frange.range) |
116 | } | 116 | } |
117 | 117 | ||
118 | pub(crate) fn covering_node_for_range(&self, range: TextRange) -> SyntaxElement<'a> { | 118 | pub(crate) fn covering_node_for_range(&self, range: TextRange) -> SyntaxElement { |
119 | find_covering_element(self.source_file.syntax(), range) | 119 | find_covering_element(self.source_file.syntax(), range) |
120 | } | 120 | } |
121 | } | 121 | } |
@@ -139,7 +139,7 @@ impl AssistBuilder { | |||
139 | ) { | 139 | ) { |
140 | let mut replace_with = replace_with.into(); | 140 | let mut replace_with = replace_with.into(); |
141 | if let Some(indent) = leading_indent(node) { | 141 | if let Some(indent) = leading_indent(node) { |
142 | replace_with = reindent(&replace_with, indent) | 142 | replace_with = reindent(&replace_with, &indent) |
143 | } | 143 | } |
144 | self.replace(node.range(), replace_with) | 144 | self.replace(node.range(), replace_with) |
145 | } | 145 | } |