This commit is contained in:
agra
2026-02-14 21:27:51 +02:00
parent 0e777e9d2e
commit e7d2abdf0c
5 changed files with 338 additions and 78 deletions

View File

@@ -24,6 +24,8 @@ pub const Document = struct {
root: ?*sx.ast.Node,
/// Sema results for this file (references are relative to this source).
sema: ?sx.sema.SemaResult,
/// Last successful sema (preserved across parse failures for completions).
last_good_sema: ?sx.sema.SemaResult = null,
/// Import declarations parsed from this file.
imports: []const Import,
@@ -199,6 +201,9 @@ pub const DocumentStore = struct {
// Run sema on this file's own AST
doc.sema = analyzer.analyze(root) catch null;
if (doc.sema != null) {
doc.last_good_sema = doc.sema;
}
}
pub fn get(self: *const DocumentStore, path: []const u8) ?*Document {