mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-23 12:46:43 +00:00
feat: handle enters in list or enum items (#1442)
* test: add tests about `onEnter` * feat: handle enters in list or enum items
This commit is contained in:
parent
78b80d41e4
commit
f13b632ad2
19 changed files with 200 additions and 17 deletions
|
|
@ -11,6 +11,7 @@ use std::{
|
|||
use once_cell::sync::Lazy;
|
||||
use serde_json::{ser::PrettyFormatter, Serializer, Value};
|
||||
use tinymist_project::{CompileFontArgs, ExportTarget};
|
||||
use tinymist_std::debug_loc::LspRange;
|
||||
use tinymist_std::typst::TypstDocument;
|
||||
use tinymist_world::package::PackageSpec;
|
||||
use tinymist_world::vfs::WorkspaceResolver;
|
||||
|
|
@ -203,7 +204,12 @@ pub fn run_with_sources<T>(source: &str, f: impl FnOnce(&mut LspUniverse, PathBu
|
|||
f(&mut verse, pw)
|
||||
}
|
||||
|
||||
pub fn find_test_range(s: &Source) -> Range<usize> {
|
||||
pub fn find_test_range(s: &Source) -> LspRange {
|
||||
let range = find_test_range_(s);
|
||||
crate::to_lsp_range(range, s, PositionEncoding::Utf16)
|
||||
}
|
||||
|
||||
pub fn find_test_range_(s: &Source) -> Range<usize> {
|
||||
// /* range -3..-1 */
|
||||
fn find_prefix(s: &str, sub: &str, left: bool) -> Option<(usize, usize, bool)> {
|
||||
Some((s.find(sub)?, sub.len(), left))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue