mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-23 04:35:00 +00:00
fix: wrong checked prefix on completing strings (#422)
This commit is contained in:
parent
134bd063be
commit
8413c66c51
3 changed files with 4 additions and 4 deletions
|
@ -199,8 +199,7 @@ impl StatefulRequest for CompletionRequest {
|
|||
|
||||
replace_range = ctx.to_lsp_range(rng, &source);
|
||||
} else {
|
||||
let lsp_start_position = ctx.to_lsp_pos(offset, &source);
|
||||
replace_range = LspRange::new(lsp_start_position, self.position);
|
||||
replace_range = ctx.to_lsp_range(offset..cursor, &source);
|
||||
}
|
||||
|
||||
let completions = completions.iter().map(|typst_completion| {
|
||||
|
|
|
@ -36,7 +36,7 @@ input_file: crates/tinymist-query/src/fixtures/completion/modify_string.typ
|
|||
"label": "\"New Computer Modern\"",
|
||||
"sortText": "003",
|
||||
"textEdit": {
|
||||
"newText": "New Computer Modern",
|
||||
"newText": "\"New Computer Modern",
|
||||
"range": {
|
||||
"end": {
|
||||
"character": 17,
|
||||
|
|
|
@ -1197,7 +1197,8 @@ impl<'a, 'w> CompletionContext<'a, 'w> {
|
|||
*apply_label = trimmed;
|
||||
}
|
||||
}
|
||||
if apply_label.starts_with('"') && self.before.ends_with('"') {
|
||||
let from_before = slice_at(self.text, 0..self.from);
|
||||
if apply_label.starts_with('"') && from_before.ends_with('"') {
|
||||
if let Some(trimmed) = apply_label.strip_prefix('"') {
|
||||
*apply_label = trimmed;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue