dev: borrow the document state inside of compiler (#33)

This commit is contained in:
Myriad-Dreamin 2024-03-14 20:37:14 +08:00 committed by GitHub
parent c7825c3174
commit 9d344570b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 34 additions and 27 deletions

View file

@ -11,10 +11,10 @@ impl CompletionRequest {
pub fn request(
self,
world: &TypstSystemWorld,
doc: Option<Arc<TypstDocument>>,
doc: Option<VersionedDocument>,
position_encoding: PositionEncoding,
) -> Option<CompletionResponse> {
let doc = doc.as_deref();
let doc = doc.as_ref().map(|doc| doc.document.as_ref());
let source = get_suitable_source_in_workspace(world, &self.path).ok()?;
let cursor = lsp_to_typst::position(self.position, position_encoding, &source)?;