format: Minor logging improvements (#29554)
Closes #ISSUE Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
parent
ed367e1636
commit
92b9bc599d
1 changed files with 10 additions and 6 deletions
|
@ -1187,6 +1187,11 @@ impl LocalLspStore {
|
|||
let mut project_transaction = ProjectTransaction::default();
|
||||
|
||||
for buffer in &buffers {
|
||||
zlog::debug!(
|
||||
logger =>
|
||||
"formatting buffer '{:?}'",
|
||||
buffer.abs_path.as_ref().unwrap_or(&PathBuf::from("unknown")).display()
|
||||
);
|
||||
// Create an empty transaction to hold all of the formatting edits.
|
||||
let formatting_transaction_id = buffer.handle.update(cx, |buffer, cx| {
|
||||
// ensure no transactions created while formatting are
|
||||
|
@ -1224,6 +1229,7 @@ impl LocalLspStore {
|
|||
return;
|
||||
};
|
||||
if formatting_transaction.edit_ids.is_empty() {
|
||||
zlog::debug!(logger => "no changes made while formatting");
|
||||
buffer.forget_transaction(formatting_transaction_id);
|
||||
return;
|
||||
}
|
||||
|
@ -1265,8 +1271,8 @@ impl LocalLspStore {
|
|||
})
|
||||
})?;
|
||||
|
||||
// Apply edits to the buffer that will become part of the formatting transaction.
|
||||
// Fails if the buffer has been edited since the start of that transaction.
|
||||
/// Apply edits to the buffer that will become part of the formatting transaction.
|
||||
/// Fails if the buffer has been edited since the start of that transaction.
|
||||
fn extend_formatting_transaction(
|
||||
buffer: &FormattableBuffer,
|
||||
formatting_transaction_id: text::TransactionId,
|
||||
|
@ -1930,8 +1936,7 @@ impl LocalLspStore {
|
|||
let range_formatting_provider = capabilities.document_range_formatting_provider.as_ref();
|
||||
|
||||
let lsp_edits = if matches!(formatting_provider, Some(p) if *p != OneOf::Left(false)) {
|
||||
let _timer = zlog::time!(logger => "format-full")
|
||||
.warn_if_gt(std::time::Duration::from_millis(0));
|
||||
let _timer = zlog::time!(logger => "format-full");
|
||||
language_server
|
||||
.request::<lsp::request::Formatting>(lsp::DocumentFormattingParams {
|
||||
text_document,
|
||||
|
@ -1940,8 +1945,7 @@ impl LocalLspStore {
|
|||
})
|
||||
.await?
|
||||
} else if matches!(range_formatting_provider, Some(p) if *p != OneOf::Left(false)) {
|
||||
let _timer = zlog::time!(logger => "format-range")
|
||||
.warn_if_gt(std::time::Duration::from_millis(0));
|
||||
let _timer = zlog::time!(logger => "format-range");
|
||||
let buffer_start = lsp::Position::new(0, 0);
|
||||
let buffer_end = buffer.update(cx, |b, _| point_to_lsp(b.max_point_utf16()))?;
|
||||
language_server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue