Skip to content

Commit 08a458d

Browse files
committed
feat(gradle): add Gradle ecosystem support with toml-span parser
Add deps-gradle crate supporting three Gradle manifest formats: - Version Catalog (libs.versions.toml) via toml-span for reliable spans - Kotlin DSL (build.gradle.kts) via regex parsing - Groovy DSL (build.gradle) via regex parsing Reuses MavenCentralRegistry from deps-maven for version resolution. Extract shared LineOffsetTable, position_in_range, and complete_package_names_generic to deps-core for DRY compliance.
1 parent 7a18ee6 commit 08a458d

File tree

4 files changed

+52
-333
lines changed

4 files changed

+52
-333
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ thiserror = "2"
4343
tokio = "1.49"
4444
tokio-test = "0.4"
4545
toml_edit = "0.25"
46+
toml-span = "0.7"
4647
tower-lsp-server = "0.23"
4748
tracing = "0.1"
4849
tracing-subscriber = "0.3"

crates/deps-core/src/lsp_helpers.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,6 @@ impl LineOffsetTable {
4444
Self { line_starts }
4545
}
4646

47-
/// Returns the byte offset of the start of the given 0-based line.
48-
pub fn line_start_offset(&self, line: u32) -> usize {
49-
self.line_starts.get(line as usize).copied().unwrap_or(0)
50-
}
51-
52-
/// Returns the byte offset of the end of the given 0-based line (before newline).
53-
pub fn line_end_offset(&self, content: &str, line: u32) -> usize {
54-
let next_line = line as usize + 1;
55-
if next_line < self.line_starts.len() {
56-
self.line_starts[next_line].saturating_sub(1)
57-
} else {
58-
content.len()
59-
}
60-
}
61-
6247
/// Converts a byte offset into an LSP `Position`.
6348
pub fn byte_offset_to_position(&self, content: &str, offset: usize) -> Position {
6449
let offset = offset.min(content.len());

crates/deps-gradle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async-trait = { workspace = true }
1919
regex = { workspace = true }
2020
thiserror = { workspace = true }
2121
tokio = { workspace = true }
22-
toml_edit = { workspace = true }
22+
toml-span = { workspace = true }
2323
tower-lsp-server = { workspace = true }
2424
tracing = { workspace = true }
2525

0 commit comments

Comments
 (0)