mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-24 21:19:37 +00:00
refactor: simplify and document lsp_typst_boundary crate (#1049)
This commit is contained in:
parent
5db1cf984a
commit
497a1e0aea
18 changed files with 205 additions and 233 deletions
|
|
@ -33,7 +33,7 @@ impl SyntaxRequest for OnEnterRequest {
|
|||
position_encoding: PositionEncoding,
|
||||
) -> Option<Self::Response> {
|
||||
let root = LinkedNode::new(source.root());
|
||||
let rng = lsp_to_typst::range(self.range, position_encoding, source)?;
|
||||
let rng = to_typst_range(self.range, position_encoding, source)?;
|
||||
let cursor = rng.end;
|
||||
let leaf = root.leaf_at_compat(cursor)?;
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ impl OnEnterWorker<'_> {
|
|||
// todo: remove_trailing_whitespace
|
||||
|
||||
let edit = TextEdit {
|
||||
range: typst_to_lsp::range(rng, self.source, self.position_encoding),
|
||||
range: to_lsp_range(rng, self.source, self.position_encoding),
|
||||
new_text: format!("\n{indent}{comment_prefix} $0"),
|
||||
};
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ impl OnEnterWorker<'_> {
|
|||
|
||||
let indent = self.indent_of(o.start);
|
||||
let edit = TextEdit {
|
||||
range: typst_to_lsp::range(rng, self.source, self.position_encoding),
|
||||
range: to_lsp_range(rng, self.source, self.position_encoding),
|
||||
// todo: read indent configuration
|
||||
new_text: if !content.contains('\n') {
|
||||
format!("\n{indent} $0\n{indent}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue