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/hover.rs17
-rw-r--r--crates/ra_ide_api/src/lib.rs5
2 files changed, 19 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index 38671b394..c62683ad4 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -164,6 +164,23 @@ mod tests {
164 } 164 }
165 165
166 #[test] 166 #[test]
167 fn hover_some() {
168 let (analysis, position) = single_file_with_position(
169 "
170 enum Option<T> { Some(T) }
171 use Option::Some;
172
173 fn main() {
174 So<|>me(12);
175 }
176 ",
177 );
178 let hover = analysis.hover(position).unwrap().unwrap();
179 // not the nicest way to show it currently
180 assert_eq!(hover.info, "Some<i32>(T) -> Option<T>");
181 }
182
183 #[test]
167 fn hover_for_local_variable() { 184 fn hover_for_local_variable() {
168 let (analysis, position) = single_file_with_position("fn func(foo: i32) { fo<|>o; }"); 185 let (analysis, position) = single_file_with_position("fn func(foo: i32) { fo<|>o; }");
169 let hover = analysis.hover(position).unwrap().unwrap(); 186 let hover = analysis.hover(position).unwrap().unwrap();
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 57a490fa7..4b9fc9372 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -38,7 +38,7 @@ mod marks;
38 38
39use std::sync::Arc; 39use std::sync::Arc;
40 40
41use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit}; 41use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit, AstNode};
42use ra_text_edit::TextEdit; 42use ra_text_edit::TextEdit;
43use ra_db::{ 43use ra_db::{
44 SourceDatabase, CheckCanceled, 44 SourceDatabase, CheckCanceled,
@@ -244,8 +244,7 @@ impl Analysis {
244 /// Returns a syntax tree represented as `String`, for debug purposes. 244 /// Returns a syntax tree represented as `String`, for debug purposes.
245 // FIXME: use a better name here. 245 // FIXME: use a better name here.
246 pub fn syntax_tree(&self, file_id: FileId) -> String { 246 pub fn syntax_tree(&self, file_id: FileId) -> String {
247 let file = self.db.parse(file_id); 247 self.db.parse(file_id).syntax().debug_dump()
248 ra_ide_api_light::syntax_tree(&file)
249 } 248 }
250 249
251 /// Returns an edit to remove all newlines in the range, cleaning up minor 250 /// Returns an edit to remove all newlines in the range, cleaning up minor