dev: intern completion code (#124)

* dev: intern completion code

* dev: change completion kind of symbols to FIELD

* fix: accept hash

* fix: reduce redundant information
This commit is contained in:
Myriad-Dreamin 2024-03-29 19:46:10 +08:00 committed by GitHub
parent 858c100146
commit 0eae40dec6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 1437 additions and 33 deletions

View file

@ -1,4 +1,4 @@
use crate::{prelude::*, StatefulRequest};
use crate::{prelude::*, upstream::autocomplete, StatefulRequest};
/// The [`textDocument/completion`] request is sent from the client to the
/// server to compute completion items at a given cursor position.
@ -57,8 +57,7 @@ impl StatefulRequest for CompletionRequest {
// assume that the completion is not explicit.
let explicit = false;
let (offset, completions) =
typst_ide::autocomplete(ctx.world(), doc, &source, cursor, explicit)?;
let (offset, completions) = autocomplete(ctx.world(), doc, &source, cursor, explicit)?;
let lsp_start_position = ctx.to_lsp_pos(offset, &source);
let replace_range = LspRange::new(lsp_start_position, self.position);