1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! LSP client infrastructure for the AI coding agent
//!
//! This crate provides Language Server Protocol (LSP) integration, enabling
//! the agent to leverage code intelligence from language servers like
//! rust-analyzer, typescript-language-server, pyright, and gopls.
//!
//! # Architecture
//!
//! The crate is organized into several modules:
//!
//! - [`server`]: LSP server definitions and spawning
//! - [`client`]: LSP client with JSON-RPC communication
//! - [`facade`]: High-level API with lazy initialization and caching
//! - [`types`]: LSP types and utilities
//! - [`language`]: File extension to language ID mappings
//!
//! # Usage
//!
//! ```rust,ignore
//! use codive_lsp::facade::{init, lsp};
//! use std::path::PathBuf;
//!
//! // Initialize the LSP subsystem
//! let working_dir = PathBuf::from("/path/to/project");
//! init(working_dir);
//!
//! // Get the LSP instance
//! let lsp = lsp().unwrap();
//!
//! // Touch a file to notify LSP servers
//! lsp.touch_file(Path::new("src/main.rs"), true).await?;
//!
//! // Go to definition
//! let locations = lsp.definition(Path::new("src/main.rs"), 10, 5).await?;
//! ```
//!
//! # Supported Language Servers
//!
//! | Language | Server | Extensions |
//! |----------|--------|------------|
//! | Rust | rust-analyzer | .rs |
//! | TypeScript/JavaScript | typescript-language-server | .ts, .tsx, .js, .jsx |
//! | Python | pyright | .py, .pyi |
//! | Go | gopls | .go |
//!
//! # LSP Operations
//!
//! The following LSP operations are supported:
//!
//! - `goToDefinition` - Find where a symbol is defined
//! - `findReferences` - Find all references to a symbol
//! - `hover` - Get hover information (documentation, types)
//! - `documentSymbol` - Get all symbols in a document
//! - `workspaceSymbol` - Search for symbols across the workspace
//! - `goToImplementation` - Find implementations of a trait/interface
//! - `prepareCallHierarchy` - Get call hierarchy item at a position
//! - `incomingCalls` - Find all callers of a function
//! - `outgoingCalls` - Find all functions called by a function
// Re-export commonly used items
pub use LspClient;
pub use ;
pub use ;
pub use ;
/// Convert an LSP Uri to a file path
/// Error types for LSP operations