aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libanalysis/src/lib.rs')
-rw-r--r--crates/libanalysis/src/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs
index a0f17a689..c84ab6077 100644
--- a/crates/libanalysis/src/lib.rs
+++ b/crates/libanalysis/src/lib.rs
@@ -27,7 +27,7 @@ use std::{
27}; 27};
28 28
29use libsyntax2::{ 29use libsyntax2::{
30 ParsedFile, 30 File,
31 TextUnit, TextRange, SmolStr, 31 TextUnit, TextRange, SmolStr,
32 ast::{self, AstNode, NameOwner}, 32 ast::{self, AstNode, NameOwner},
33 SyntaxKind::*, 33 SyntaxKind::*,
@@ -132,7 +132,7 @@ impl WorldState {
132 132
133 133
134impl World { 134impl World {
135 pub fn file_syntax(&self, file_id: FileId) -> Result<ParsedFile> { 135 pub fn file_syntax(&self, file_id: FileId) -> Result<File> {
136 let data = self.file_data(file_id)?; 136 let data = self.file_data(file_id)?;
137 Ok(data.syntax().clone()) 137 Ok(data.syntax().clone())
138 } 138 }
@@ -265,7 +265,7 @@ struct WorldData {
265struct FileData { 265struct FileData {
266 text: String, 266 text: String,
267 symbols: OnceCell<FileSymbols>, 267 symbols: OnceCell<FileSymbols>,
268 syntax: OnceCell<ParsedFile>, 268 syntax: OnceCell<File>,
269 lines: OnceCell<LineIndex>, 269 lines: OnceCell<LineIndex>,
270} 270}
271 271
@@ -279,14 +279,14 @@ impl FileData {
279 } 279 }
280 } 280 }
281 281
282 fn syntax(&self) -> &ParsedFile { 282 fn syntax(&self) -> &File {
283 self.syntax 283 self.syntax
284 .get_or_init(|| ParsedFile::parse(&self.text)) 284 .get_or_init(|| File::parse(&self.text))
285 } 285 }
286 286
287 fn syntax_transient(&self) -> ParsedFile { 287 fn syntax_transient(&self) -> File {
288 self.syntax.get().map(|s| s.clone()) 288 self.syntax.get().map(|s| s.clone())
289 .unwrap_or_else(|| ParsedFile::parse(&self.text)) 289 .unwrap_or_else(|| File::parse(&self.text))
290 } 290 }
291 291
292 fn symbols(&self) -> &FileSymbols { 292 fn symbols(&self) -> &FileSymbols {