mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-30 16:13:43 +00:00
refactor: enclose contextual information in CompletionCursor
(#1078)
* refactor: reduce some useless code * refactor: move contextual things to a context * refactor: force range calculation in place
This commit is contained in:
parent
282b1d7b4d
commit
451dc9dbdd
3 changed files with 781 additions and 624 deletions
|
@ -1,6 +1,7 @@
|
|||
use lsp_types::CompletionList;
|
||||
|
||||
use crate::{analysis::CompletionWorker, prelude::*, StatefulRequest};
|
||||
use crate::analysis::{CompletionCursor, CompletionWorker};
|
||||
use crate::prelude::*;
|
||||
|
||||
pub(crate) mod snippet;
|
||||
|
||||
|
@ -71,11 +72,11 @@ impl StatefulRequest for CompletionRequest {
|
|||
let doc = doc.as_ref().map(|doc| doc.document.as_ref());
|
||||
let source = ctx.source_by_path(&self.path).ok()?;
|
||||
let cursor = ctx.to_typst_pos_offset(&source, self.position, 0)?;
|
||||
let mut cursor = CompletionCursor::new(ctx.shared_(), &source, cursor)?;
|
||||
|
||||
let worker =
|
||||
CompletionWorker::new(ctx, doc, &source, cursor, explicit, self.trigger_character)?;
|
||||
let worker = CompletionWorker::new(ctx, doc, explicit, self.trigger_character)?;
|
||||
|
||||
let (worker_incomplete, items) = worker.work()?;
|
||||
let (worker_incomplete, items) = worker.work(&mut cursor)?;
|
||||
|
||||
// todo: define it well, we were needing it because we wanted to do interactive
|
||||
// path completion, but now we've scanned all the paths at the same time.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue