feat(lsp): implement LSP client and server management
- Added LspClient for handling communication with LSP servers, including methods for initialization, notifications, and requests. - Introduced LspManager to manage multiple LSP server connections, allowing for connection, disconnection, and retrieval of server capabilities. - Created tools for connecting to LSP servers, retrieving diagnostics, hover information, code completion, definitions, and references. - Enhanced UI rendering to display token usage and settings in the overlay. - Updated status bar to show current token usage and selected provider/model.
This commit is contained in:
@@ -277,6 +277,8 @@ pub struct MiscState {
|
||||
pub selected_index: usize,
|
||||
pub editor: Option<super::super::mode::editor::EditorState>,
|
||||
pub api_connected: bool,
|
||||
#[allow(dead_code)]
|
||||
pub api_context_length: Option<u32>,
|
||||
pub tick_count: u64,
|
||||
pub todo_content: String,
|
||||
}
|
||||
@@ -294,6 +296,7 @@ impl MiscState {
|
||||
selected_index: 0,
|
||||
editor: None,
|
||||
api_connected: false,
|
||||
api_context_length: None,
|
||||
tick_count: 0,
|
||||
todo_content: String::new(),
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ use tokio::sync::RwLock;
|
||||
use super::misc::{DirCache, InputState, MiscState, ScrollState};
|
||||
use super::runtime::{SessionRuntime, TurnEvent};
|
||||
use super::types::{Origin, Toast, TranscriptCache};
|
||||
use crate::app::lsp::LspManager;
|
||||
use crate::app::mcp::manager::McpManager;
|
||||
use crate::app::workflow::engine::WorkflowEngine;
|
||||
use crate::model::app_config::AppConfig;
|
||||
@@ -66,6 +67,7 @@ pub struct AppStateRest {
|
||||
pub abort_flag: Arc<std::sync::atomic::AtomicBool>,
|
||||
pub workflow_engine: WorkflowEngine,
|
||||
pub mcp_manager: McpManager,
|
||||
pub lsp_manager: Arc<Mutex<LspManager>>,
|
||||
pub dirty: bool,
|
||||
pub quit: bool,
|
||||
}
|
||||
@@ -117,6 +119,7 @@ impl AppStateRest {
|
||||
session_runtime: Some(SessionRuntime::new(session_dir.clone())),
|
||||
workflow_engine: WorkflowEngine::new(),
|
||||
mcp_manager: McpManager::new(),
|
||||
lsp_manager: Arc::new(Mutex::new(LspManager::new())),
|
||||
sessions: Vec::new(),
|
||||
transcript_cache: TranscriptCache::new(200),
|
||||
scroll: ScrollState::new(),
|
||||
@@ -196,6 +199,7 @@ impl AppStateRest {
|
||||
dir_cache: self.dir_cache.clone(),
|
||||
origin,
|
||||
graduated_checks: Vec::new(),
|
||||
lsp_manager: self.lsp_manager.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct UsageStats {
|
||||
pub tokens_in: u64,
|
||||
pub tokens_out: u64,
|
||||
#[serde(default)]
|
||||
pub last_tokens_in: u64,
|
||||
#[serde(default)]
|
||||
pub last_tokens_out: u64,
|
||||
pub api_calls: u64,
|
||||
pub review_tokens: u64,
|
||||
pub total_ms: u64,
|
||||
@@ -96,6 +100,7 @@ pub enum TurnEvent {
|
||||
tokens_in: u64,
|
||||
tokens_out: u64,
|
||||
},
|
||||
Compacted(Vec<crate::dto::chat::message::ChatMessage>),
|
||||
Error(String),
|
||||
Done,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user