diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-30 10:16:22 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-30 10:16:22 +0000 |
commit | 8d1df9834c96bd464c309383afdd8edea0576ae0 (patch) | |
tree | 1836353cc58c9aeede832bb18872c37af312f377 /crates/ra_analysis/src | |
parent | 75acc25c5a5df2ac0a8978be2972187ee974a754 (diff) | |
parent | 0cb270e75d9501dff9ac6633354ae12d9c0f4260 (diff) |
Merge #358
358: Add support for formatting entire document with rustfmt r=matklad a=aleksanb
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.
Part of https://github.com/rust-analyzer/rust-analyzer/issues/160.
Co-authored-by: Aleksander Vognild Burkow <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 3 | ||||
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 3 |
2 files changed, 6 insertions, 0 deletions
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 { | |||
140 | } | 140 | } |
141 | 141 | ||
142 | impl AnalysisImpl { | 142 | impl AnalysisImpl { |
143 | pub fn file_text(&self, file_id: FileId) -> Arc<String> { | ||
144 | self.db.file_text(file_id) | ||
145 | } | ||
143 | pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { | 146 | pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { |
144 | self.db.source_file(file_id) | 147 | self.db.source_file(file_id) |
145 | } | 148 | } |
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 { | |||
274 | } | 274 | } |
275 | 275 | ||
276 | impl Analysis { | 276 | impl Analysis { |
277 | pub fn file_text(&self, file_id: FileId) -> Arc<String> { | ||
278 | self.imp.file_text(file_id) | ||
279 | } | ||
277 | pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { | 280 | pub fn file_syntax(&self, file_id: FileId) -> SourceFileNode { |
278 | self.imp.file_syntax(file_id).clone() | 281 | self.imp.file_syntax(file_id).clone() |
279 | } | 282 | } |