Skip to content

Commit eed089a

Browse files
hyperpolymathclaude
andcommitted
feat: add core library, interface crate, and update workspace structure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5ec6ef9 commit eed089a

10 files changed

Lines changed: 642 additions & 36 deletions

File tree

Cargo.lock

Lines changed: 587 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ vqlut-lint = { path = "src/interface/lint" }
1818
[workspace]
1919
members = [
2020
".",
21+
"src/core",
22+
"src/interface",
2123
"src/interface/fmt",
2224
"src/interface/lint",
25+
"src/interface/lsp",
26+
"src/interface/dap",
2327
]

src/core/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
[package]
3+
name = "vqlut-core"
4+
version = "0.1.0"
5+
edition = "2021"
6+
license = "PMPL-1.0-or-later"
7+
authors = ["Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"]
8+
repository = "https://github.com/hyperpolymath/vql-ut"
9+
description = "VQL-UT Core: Idris-based type checker and grammar"
10+
11+
[lib]
12+
path = "lib.rs"
13+
crate-type = ["cdylib", "rlib"]
14+
15+
[dependencies]

src/core/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Dummy lib.rs for Rust compatibility
2+
// Actual implementation is in Idris files

src/interface/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
[package]
3+
name = "vqlut-interface"
4+
version = "0.1.0"
5+
edition = "2021"
6+
license = "PMPL-1.0-or-later"
7+
authors = ["Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"]
8+
repository = "https://github.com/hyperpolymath/vql-ut"
9+
description = "VQL-UT Interface: Common interface types"
10+
11+
[lib]
12+
path = "lib.rs"
13+
crate-type = ["cdylib", "rlib"]
14+
15+
[dependencies]

src/interface/dap/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Dummy lib.rs for Rust compatibility
2+
// Actual implementation is in main.rs

src/interface/dap/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ fn handle_client(stream: TcpStream) -> Result<(), Box<dyn std::error::Error>> {
167167
"continue" => {
168168
// TODO: Execute the query using database-mcp cartridge
169169
// For now, return a dummy response
170-
let query = request.arguments.and_then(|args| args.get("query")).and_then(|q| q.as_str()).unwrap_or("");
171-
let result = execute_vql_query(query);
170+
let query = if let Some(args) = &request.arguments {
171+
args.get("query").and_then(|q| q.as_str()).unwrap_or("").to_string()
172+
} else {
173+
"".to_string()
174+
};
175+
let result = execute_vql_query(&query);
172176
serde_json::to_string(&DapResponse {
173177
seq: 9,
174178
r#type: "response".to_string(),

src/interface/fmt/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn main() {
3131

3232
// Write the output file
3333
let output_path = args.output.unwrap_or(input_path);
34-
fs::write(output_path, formatted).expect("Unable to write file");
34+
fs::write(&output_path, formatted).expect("Unable to write file");
3535

3636
println!("Formatted {}", output_path.display());
3737
}

src/interface/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Dummy lib.rs for Rust compatibility
2+
// Actual implementation is in subdirectories

src/interface/lsp/src/lib.rs

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ impl VqlutLsp {
5151
// TODO: Parse the VQL-UT file at the given position to find the table/column
5252
// For now, return a dummy response with schema-based navigation
5353
if let Some((table, _)) = self.schema.iter().next() {
54-
Some(GotoDefinitionResponse::Scalar(GotoDefinitionLink {
55-
target_uri: uri,
56-
target_range: Range {
54+
Some(GotoDefinitionResponse::Scalar(Location {
55+
uri,
56+
range: Range {
5757
start: Position {
5858
line: line as u32,
5959
character: character as u32,
@@ -63,22 +63,11 @@ impl VqlutLsp {
6363
character: character as u32 + table.len() as u32,
6464
},
6565
},
66-
target_selection_range: Some(Range {
67-
start: Position {
68-
line: line as u32,
69-
character: character as u32,
70-
},
71-
end: Position {
72-
line: line as u32,
73-
character: character as u32 + table.len() as u32,
74-
},
75-
}),
76-
origin_selection_range: None,
7766
}))
7867
} else {
79-
Some(GotoDefinitionResponse::Scalar(GotoDefinitionLink {
80-
target_uri: uri,
81-
target_range: Range {
68+
Some(GotoDefinitionResponse::Scalar(Location {
69+
uri,
70+
range: Range {
8271
start: Position {
8372
line: line as u32,
8473
character: character as u32,
@@ -88,17 +77,6 @@ impl VqlutLsp {
8877
character: character as u32 + 10,
8978
},
9079
},
91-
target_selection_range: Some(Range {
92-
start: Position {
93-
line: line as u32,
94-
character: character as u32,
95-
},
96-
end: Position {
97-
line: line as u32,
98-
character: character as u32 + 10,
99-
},
100-
}),
101-
origin_selection_range: None,
10280
}))
10381
}
10482
}
@@ -130,7 +108,7 @@ impl VqlutLsp {
130108

131109
pub fn handle_completion(&self, params: CompletionParams) -> Option<CompletionResponse> {
132110
// Extract the position from the params
133-
let position = params.text_document_position_params.position;
111+
let position = params.text_document_position.position;
134112
let line = position.line as usize;
135113
let character = position.character as usize;
136114

@@ -175,9 +153,6 @@ impl VqlutLsp {
175153
}
176154
}
177155

178-
Some(CompletionResponse {
179-
is_incomplete: false,
180-
items,
181-
})
156+
Some(CompletionResponse::Array(items))
182157
}
183158
}

0 commit comments

Comments
 (0)