From 8b24f158f75e4496cfc7f8edf9aa41b10dbac9b3 Mon Sep 17 00:00:00 2001 From: Aleksander Vognild Burkow Date: Sat, 29 Dec 2018 20:09:42 +0100 Subject: Add support for formatting entire document with rustfmt Attempting to format a document when rustfmt isn't installed will result in an error being returned to the frontend. An alternative implementation would be returning zero replacements. --- crates/ra_analysis/src/imp.rs | 3 +++ crates/ra_analysis/src/lib.rs | 3 +++ 2 files changed, 6 insertions(+) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index fcb4cd957..bff2e00c9 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -140,6 +140,9 @@ impl fmt::Debug for AnalysisImpl { } impl AnalysisImpl { + pub fn file_text(&self, file_id: FileId) -> Arc { + self.db.file_text(file_id) + } pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { self.db.source_file(file_id) } diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 67b1c1482..9f5e9f358 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -274,6 +274,9 @@ pub struct Analysis { } impl Analysis { + pub fn file_text(&self, file_id: FileId) -> Arc { + self.imp.file_text(file_id) + } pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { self.imp.file_syntax(file_id).clone() } -- cgit v1.2.3