Skip to main content

codelens_engine/lsp/
types.rs

1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4#[derive(Debug, Clone)]
5pub struct LspRequest {
6    pub command: String,
7    pub args: Vec<String>,
8    pub file_path: String,
9    pub line: usize,
10    pub column: usize,
11    pub max_results: usize,
12}
13
14#[derive(Debug, Clone)]
15pub struct LspDiagnosticRequest {
16    pub command: String,
17    pub args: Vec<String>,
18    pub file_path: String,
19    pub max_results: usize,
20}
21
22#[derive(Debug, Clone)]
23pub struct LspWorkspaceSymbolRequest {
24    pub command: String,
25    pub args: Vec<String>,
26    pub query: String,
27    pub max_results: usize,
28}
29
30#[derive(Debug, Clone)]
31pub struct LspTypeHierarchyRequest {
32    pub command: String,
33    pub args: Vec<String>,
34    pub query: String,
35    pub relative_path: Option<String>,
36    pub hierarchy_type: String,
37    pub depth: usize,
38}
39
40#[derive(Debug, Clone)]
41pub struct LspRenamePlanRequest {
42    pub command: String,
43    pub args: Vec<String>,
44    pub file_path: String,
45    pub line: usize,
46    pub column: usize,
47    pub new_name: Option<String>,
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
51pub struct LspReference {
52    pub file_path: String,
53    pub line: usize,
54    pub column: usize,
55    pub end_line: usize,
56    pub end_column: usize,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
60pub struct LspDiagnostic {
61    pub file_path: String,
62    pub line: usize,
63    pub column: usize,
64    pub end_line: usize,
65    pub end_column: usize,
66    pub severity: Option<u8>,
67    pub severity_label: Option<String>,
68    pub code: Option<String>,
69    pub source: Option<String>,
70    pub message: String,
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
74pub struct LspWorkspaceSymbol {
75    pub name: String,
76    pub kind: Option<u32>,
77    pub kind_label: Option<String>,
78    pub container_name: Option<String>,
79    pub file_path: String,
80    pub line: usize,
81    pub column: usize,
82    pub end_line: usize,
83    pub end_column: usize,
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
87pub struct LspTypeHierarchyNode {
88    pub name: String,
89    pub fully_qualified_name: String,
90    pub kind: String,
91    pub members: HashMap<String, Vec<String>>,
92    pub type_parameters: Vec<HashMap<String, String>>,
93    #[serde(skip_serializing_if = "Vec::is_empty")]
94    pub supertypes: Vec<LspTypeHierarchyNode>,
95    #[serde(skip_serializing_if = "Vec::is_empty")]
96    pub subtypes: Vec<LspTypeHierarchyNode>,
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
100pub struct LspRenamePlan {
101    pub file_path: String,
102    pub line: usize,
103    pub column: usize,
104    pub end_line: usize,
105    pub end_column: usize,
106    pub current_name: String,
107    pub placeholder: Option<String>,
108    pub new_name: Option<String>,
109}