Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ Omit `--install` to print to stdout. Full per-shell install paths and notes:

## What CodeGraph Does (and Doesn't)

**Does:** deterministic code-structure extraction across 32 languages (TypeScript,
**Does:** deterministic code-structure extraction across 33 languages (TypeScript,
Python, Go, Rust, Java, C/C++, C#, Vue, Svelte, GDScript, and more — see
[`docs/languages.md`](docs/languages.md)), cross-file resolution (including
Godot project graphs), graph traversal, FTS5 search, whole-graph export with
Expand All @@ -454,9 +454,9 @@ beyond the fixed `LANGUAGES` set.

## Supported Languages

CodeGraph supports **32 languages** grouped by extraction depth. Quick overview:
CodeGraph supports **33 languages** grouped by extraction depth. Quick overview:

- **Tier 1 — Full symbol extraction (23):** TypeScript, TSX, JavaScript, JSX, Python, Go, Rust, Java, C, C++, C#, PHP, Ruby, Swift, Kotlin, Dart, Scala, Lua, Luau, Objective-C, R, GDScript, Pascal.
- **Tier 1 — Full symbol extraction (24):** TypeScript, TSX, JavaScript, JSX, ArkTS, Python, Go, Rust, Java, C, C++, C#, PHP, Ruby, Swift, Kotlin, Dart, Scala, Lua, Luau, Objective-C, R, GDScript, Pascal.
- **Tier 2 — Embedded / template extraction (6):** Vue, Svelte, Astro, Razor/`.cshtml`, Liquid, XML/MyBatis mapper.
- **Tier 3 — File-level only (3):** YAML, Twig, Properties.

Expand Down
16 changes: 16 additions & 0 deletions crates/codegraph-bench/fixtures/arkts/component.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Foo } from '../foo';

function helper(): void {}

function driver(): void {
helper()
}

@Component
struct MyView {
build() {
helper()
}
}

class Model {}
27 changes: 27 additions & 0 deletions crates/codegraph-bench/tests/equivalence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ fn cuda_db_is_self_equivalent_to_cuda_golden() {
assert_equivalent(&cuda_db(), &cuda_golden_dir()).unwrap();
}

#[test]
fn generated_golden_matches_committed_arkts_fixture() {
// Guards ArkTS extraction (upstream #1186, extraction slice only): the
// `.ets`->ArkTs mapping, `@Component struct`->NodeKind::Struct via the
// dedicated tree-sitter-arkts grammar, function/class/import/call extraction.
let tempdir = TestDir::new("generated-golden-arkts");
write_golden(&arkts_db(), tempdir.path()).unwrap();

let expected = load_golden(&arkts_golden_dir()).unwrap();
let actual = load_golden(tempdir.path()).unwrap();

diff_canonical(&expected, &actual, None).unwrap();
}

#[test]
fn arkts_db_is_self_equivalent_to_arkts_golden() {
assert_equivalent(&arkts_db(), &arkts_golden_dir()).unwrap();
}

#[test]
fn tier1_node_drift_is_reported() {
let expected = load_golden(&mini_golden_dir()).unwrap();
Expand Down Expand Up @@ -210,6 +229,14 @@ fn cuda_golden_dir() -> PathBuf {
workspace_root().join("reference/golden/cuda")
}

fn arkts_db() -> PathBuf {
workspace_root().join("reference/golden/arkts/colby.db")
}

fn arkts_golden_dir() -> PathBuf {
workspace_root().join("reference/golden/arkts")
}

struct TestDir {
path: PathBuf,
}
Expand Down
9 changes: 7 additions & 2 deletions crates/codegraph-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ pub const EDGE_KIND_STRINGS: [&str; 12] = [
"decorates",
];

pub const LANGUAGE_STRINGS: [&str; 36] = [
pub const LANGUAGE_STRINGS: [&str; 37] = [
"typescript",
"javascript",
"tsx",
"jsx",
"arkts",
"python",
"go",
"rust",
Expand Down Expand Up @@ -274,6 +275,8 @@ pub enum Language {
Tsx,
#[serde(rename = "jsx")]
Jsx,
#[serde(rename = "arkts")]
ArkTs,
#[serde(rename = "python")]
Python,
#[serde(rename = "go")]
Expand Down Expand Up @@ -341,11 +344,12 @@ pub enum Language {
}

impl Language {
pub const ALL: [Self; 36] = [
pub const ALL: [Self; 37] = [
Self::TypeScript,
Self::JavaScript,
Self::Tsx,
Self::Jsx,
Self::ArkTs,
Self::Python,
Self::Go,
Self::Rust,
Expand Down Expand Up @@ -386,6 +390,7 @@ impl Language {
Self::JavaScript => "javascript",
Self::Tsx => "tsx",
Self::Jsx => "jsx",
Self::ArkTs => "arkts",
Self::Python => "python",
Self::Go => "go",
Self::Rust => "rust",
Expand Down
1 change: 1 addition & 0 deletions crates/codegraph-extract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ codegraph-core = { path = "../codegraph-core" }
serde_json = { workspace = true }
tracing = { workspace = true }

tree-sitter-arkts = "0.2.0"
tree-sitter-c = "0.24.2"
tree-sitter-c-sharp = "0.23.5"
tree-sitter-cpp = "0.23.4"
Expand Down
14 changes: 13 additions & 1 deletion crates/codegraph-extract/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub fn builtin_language_for_ext(ext: &str) -> Option<Language> {
"tsx" => Language::Tsx,
"js" | "mjs" | "cjs" | "xsjs" | "xsjslib" => Language::JavaScript,
"jsx" => Language::Jsx,
// Only `.ets` maps to ArkTS; plain `.ts` stays TypeScript (matching upstream).
"ets" => Language::ArkTs,
"py" | "pyw" => Language::Python,
"go" => Language::Go,
"rs" => Language::Rust,
Expand Down Expand Up @@ -868,7 +870,17 @@ mod tests {
assert_eq!(detect_language("s.metal"), Language::Cpp);
assert_eq!(detect_language("k.cu"), Language::Cpp);
assert_eq!(detect_language("k.cuh"), Language::Cpp);
assert_eq!(Language::ALL.len(), 36);
assert_eq!(Language::ALL.len(), 37);
}

#[test]
fn arkts_extension_maps_to_arkts() {
assert_eq!(detect_language("view.ets"), Language::ArkTs);
}

#[test]
fn plain_ts_stays_typescript() {
assert_eq!(detect_language("m.ts"), Language::TypeScript);
}

#[test]
Expand Down
Loading
Loading