style(lsp): apply rustfmt to commands.rs
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1176,9 +1176,9 @@ fn workspace_find_orphans(backend: &Backend, args: Vec<Value>) -> Result<Option<
|
||||
})?))
|
||||
}
|
||||
|
||||
/// Return the end-of-file `LspPosition` (1-based lines; 0-based
|
||||
/// character column) for the given text, suitable for appending.
|
||||
fn eof_position(text: &str) -> LspPosition {
|
||||
/// Return the end-of-file `LspPosition` (1-based lines; 0-based
|
||||
/// character column) for the given text, suitable for appending.
|
||||
fn eof_position(text: &str) -> LspPosition {
|
||||
let mut line = 0u32;
|
||||
let mut last_nl_col = 0u32;
|
||||
let mut col = 0u32;
|
||||
@@ -1191,12 +1191,15 @@ fn workspace_find_orphans(backend: &Backend, args: Vec<Value>) -> Result<Option<
|
||||
col = (i + 1 - last_nl_col as usize) as u32;
|
||||
}
|
||||
}
|
||||
LspPosition { line, character: col }
|
||||
LspPosition {
|
||||
line,
|
||||
character: col,
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Pure operations =====
|
||||
// ===== Pure operations =====
|
||||
|
||||
pub mod ops {
|
||||
pub mod ops {
|
||||
use super::*;
|
||||
use crate::edits::text_edit_replace;
|
||||
use nuwiki_core::ast::{
|
||||
@@ -1877,10 +1880,7 @@ fn workspace_find_orphans(backend: &Backend, args: Vec<Value>) -> Result<Option<
|
||||
None => {
|
||||
let with_sep = format!("{new_text}\n");
|
||||
let insert_pos = eof_position(text);
|
||||
b.edit(
|
||||
uri.clone(),
|
||||
text_edit_insert(insert_pos, with_sep),
|
||||
);
|
||||
b.edit(uri.clone(), text_edit_insert(insert_pos, with_sep));
|
||||
}
|
||||
}
|
||||
Some(b.build())
|
||||
@@ -2947,10 +2947,7 @@ fn workspace_find_orphans(backend: &Backend, args: Vec<Value>) -> Result<Option<
|
||||
None => {
|
||||
let with_sep = format!("{body}\n");
|
||||
let insert_pos = eof_position(text);
|
||||
b.edit(
|
||||
uri.clone(),
|
||||
text_edit_insert(insert_pos, with_sep),
|
||||
);
|
||||
b.edit(uri.clone(), text_edit_insert(insert_pos, with_sep));
|
||||
}
|
||||
}
|
||||
Some(b.build())
|
||||
|
||||
Reference in New Issue
Block a user