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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- In Go, calls into a module whose `go.mod` is not at the project root now resolve, whether it is a `server/` backend next to a `web/` frontend or one of several modules side by side as in etcd, so calls like `store.New()` and `s.db.CreateItem()` find their targets instead of being treated as calls into a third-party package. A name written through a package, like a `job.OPCommand` result type or a field of type `artifact.Manager`, now links to that package's symbol rather than a same-named one elsewhere, which also corrects links in projects with a single `go.mod`. Re-index Go projects after upgrading. Thanks @GoDiao for the report and @danusha2345 for the fix. (#2322)
- Indexing a project that includes large bundled JavaScript files, such as a copy of pdf.js or d3, is fast again: since 1.6.2, resolving the calls in a JavaScript or TypeScript file re-read the file's text above each call, so a single bundled library could add many seconds to an index. The graph it builds is unchanged. Thanks @bompus for the report. (#2334)
- The time `codegraph init` and `codegraph index` print beside the node and edge counts now covers the whole run, resolving references and linking included, and `codegraph sync` reports its whole run the same way. Before, it counted only reading and parsing the files, which can be a small part of an index, so a slow index looked fast. Thanks @bompus for the report. (#2334)
- In Rust, code that uses an enum only through its variants, like `mode::Mode::A` in an expression, a `Mode::B =>` match arm or `Self::A` inside the enum's own `impl`, now shows up in that enum's callers and impact, linked to the enum that actually declares the variant rather than to a same-named type elsewhere. Standard-library variants like `Ordering::Less` or `Option::Some` and associated items like `Foo::new()` or `Foo::MAX` don't count as using a project enum. Re-index Rust projects after upgrading. Thanks @mg-mg-mg for the report and @danusha2345. (#2328)

## [1.6.2] - 2026-10-03

Expand Down
40 changes: 40 additions & 0 deletions __tests__/kernel-rustlang-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,46 @@ fn next() {}
assertParity('commands.rs', source.replace(/\n/g, '\r\n'));
});

it('variant paths reference their receiver (#2328)', () => {
const source = `
use crate::mode::{self, Mode};
const DEFAULT: Mode = Mode::A;
impl Mode {
fn flip(&self) -> u8 {
let _s = "ü"; let _x = Self::B;
match self { Self::A => 1, Mode::C(x) => *x, mode::Mode::D { x } => *x, _ => 0 }
}
}
trait Tr { fn t(&self) { let _ = Self::K; } }
fn uses() {
use crate::mode::Mode::A;
let _a = crate::mode::Mode::A; let _b = Mode::C(1); let _c = Mode::D { x: 2 };
let _d = Mode::new(); let _e = util::take(3); let _f = u8::MAX; let _g = Limits::MAX;
let _h = xs.map(Mode::C); let _i = Option::<u8>::None; let _j = Mode::A.flip();
if let Mode::C(x) | Mode::B = m {}
match o { Option::Some(_) => std::cmp::Ordering::Less, _ => cmp::Ordering::Greater };
}
`;
assertParity('variants.rs', source);
assertParity('variants.rs', source.replace(/\n/g, '\r\n'));

// Not vacuous: each path to a capitalized member outside a call's callee,
// a struct literal and a `use` is a `references` ref to its receiver
// (`Self` read as the impl's type; none in a trait). The resolver decides
// which of them name a project enum's variant.
process.env.CODEGRAPH_KERNEL = '0';
const refs = extractFromSource('variants.rs', source, 'rust').unresolvedReferences;
delete process.env.CODEGRAPH_KERNEL;
const lines = source.split('\n');
const paths = refs
.filter((r) => r.referenceKind === 'references' && /^\w+\s*::/.test(lines[r.line - 1]!.slice(r.column)))
.map((r) => `${r.referenceName}:${r.line}`);
expect(paths.sort()).toEqual([
'Limits:14', 'Mode:13', 'Mode:15', 'Mode:15', 'Mode:16', 'Mode:16', 'Mode:3', 'Mode:6',
'Mode:7', 'Mode:7', 'Mode:7', 'Option:17', 'Ordering:17', 'Ordering:17',
]);
});

it('torture fixture: impl/trait quirks, use bindings, chains, fn-refs, value-refs, route macros', () => {
const file = path.join(FIXTURE_DIR, 'torture.rs');
assertParity('fixtures/torture.rs', fs.readFileSync(file, 'utf8'), 20);
Expand Down
Loading