aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r--crates/ra_ide_api/src/lib.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 452407e8e..2fe46cd13 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -314,7 +314,7 @@ impl Analysis {
314 314
315 /// Gets the syntax tree of the file. 315 /// Gets the syntax tree of the file.
316 pub fn parse(&self, file_id: FileId) -> TreeArc<SourceFile> { 316 pub fn parse(&self, file_id: FileId) -> TreeArc<SourceFile> {
317 self.db.parse(file_id).clone() 317 self.db.parse(file_id).tree
318 } 318 }
319 319
320 /// Gets the file's `LineIndex`: data structure to convert between absolute 320 /// Gets the file's `LineIndex`: data structure to convert between absolute
@@ -331,7 +331,7 @@ impl Analysis {
331 /// Returns position of the matching brace (all types of braces are 331 /// Returns position of the matching brace (all types of braces are
332 /// supported). 332 /// supported).
333 pub fn matching_brace(&self, position: FilePosition) -> Option<TextUnit> { 333 pub fn matching_brace(&self, position: FilePosition) -> Option<TextUnit> {
334 let file = self.db.parse(position.file_id); 334 let file = self.db.parse(position.file_id).tree;
335 matching_brace::matching_brace(&file, position.offset) 335 matching_brace::matching_brace(&file, position.offset)
336 } 336 }
337 337
@@ -344,7 +344,7 @@ impl Analysis {
344 /// Returns an edit to remove all newlines in the range, cleaning up minor 344 /// Returns an edit to remove all newlines in the range, cleaning up minor
345 /// stuff like trailing commas. 345 /// stuff like trailing commas.
346 pub fn join_lines(&self, frange: FileRange) -> SourceChange { 346 pub fn join_lines(&self, frange: FileRange) -> SourceChange {
347 let file = self.db.parse(frange.file_id); 347 let file = self.db.parse(frange.file_id).tree;
348 let file_edit = SourceFileEdit { 348 let file_edit = SourceFileEdit {
349 file_id: frange.file_id, 349 file_id: frange.file_id,
350 edit: join_lines::join_lines(&file, frange.range), 350 edit: join_lines::join_lines(&file, frange.range),
@@ -362,7 +362,7 @@ impl Analysis {
362 /// this works when adding `let =`. 362 /// this works when adding `let =`.
363 // FIXME: use a snippet completion instead of this hack here. 363 // FIXME: use a snippet completion instead of this hack here.
364 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> { 364 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
365 let file = self.db.parse(position.file_id); 365 let file = self.db.parse(position.file_id).tree;
366 let edit = typing::on_eq_typed(&file, position.offset)?; 366 let edit = typing::on_eq_typed(&file, position.offset)?;
367 Some(SourceChange::source_file_edit( 367 Some(SourceChange::source_file_edit(
368 "add semicolon", 368 "add semicolon",
@@ -378,13 +378,13 @@ impl Analysis {
378 /// Returns a tree representation of symbols in the file. Useful to draw a 378 /// Returns a tree representation of symbols in the file. Useful to draw a
379 /// file outline. 379 /// file outline.
380 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { 380 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
381 let file = self.db.parse(file_id); 381 let file = self.db.parse(file_id).tree;
382 file_structure(&file) 382 file_structure(&file)
383 } 383 }
384 384
385 /// Returns the set of folding ranges. 385 /// Returns the set of folding ranges.
386 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> { 386 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
387 let file = self.db.parse(file_id); 387 let file = self.db.parse(file_id).tree;
388 folding_ranges::folding_ranges(&file) 388 folding_ranges::folding_ranges(&file)
389 } 389 }
390 390