Enhance logging and documentation across utility tools and TUI overlays

- Added tracing instrumentation and improved logging messages in the Pong, Todofinish, and Todowrite tools for better debugging and monitoring.
- Enhanced documentation comments for clarity on tool functionalities and workflows.
- Implemented tracing in WorkflowRun, NoteFinding, ReadFindings, and HiveMind tools to track execution phases and findings.
- Updated TUI overlays (e.g., Bash, Clear Confirm, Editor, Effort Level, Help, Key Input, Learning, Loading, MCP, Model Selector, Plan, Quit Confirm, Rewind, Settings, Todo, Usage) with debug logging to capture rendering details.
- Improved the status bar and workflow panel rendering with additional debug information.
- Added tracing to various utility functions to facilitate better performance monitoring and error tracking.
This commit is contained in:
asepharyana
2026-07-20 15:53:43 +07:00
parent f84dfb8476
commit 16494d4b1e
69 changed files with 637 additions and 30 deletions
@@ -1,9 +1,17 @@
//! Get completion suggestions from LSP.
//!
//! Sends a `textDocument/completion` request to the connected language
//! server for a given file position.
use crate::tools::{Tool, ToolCtx};
use anyhow::Result;
use serde_json::{json, Value};
use tracing::{info, error, instrument};
/// Tool that requests code completion suggestions from an LSP server.
///
/// Flow: parse language/path/line/character → lock LSP manager → find client
/// → send `textDocument/completion` → return pretty-printed JSON response.
pub struct LspCompletion;
impl Tool for LspCompletion {
@@ -40,16 +48,19 @@ impl Tool for LspCompletion {
})
}
#[instrument(skip(self, ctx, args))]
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let language = crate::tools::arg_str(args, "language")?;
let path = crate::tools::arg_str(args, "path")?;
let line = args.get("line").and_then(|v| v.as_i64()).unwrap_or(0);
let character = args.get("character").and_then(|v| v.as_i64()).unwrap_or(0);
info!(language, path, line, character, "LSP completion requested");
let manager = match ctx.lsp_manager.lock() {
Ok(g) => g,
Err(poisoned) => {
tracing::error!("LSP manager mutex poisoned, recovering");
error!("LSP manager mutex poisoned, recovering");
poisoned.into_inner()
}
};