Skip to content

fix(syntax): resolve includes in Therion's literal->.th->.th2 order (follow-up to #2) - #3

Merged
apgeo merged 1 commit into
mainfrom
fix/issue-1-default-extension
Jul 29, 2026
Merged

apgeo merged 1 commit into
mainfrom
fix/issue-1-default-extension

Conversation

@apgeo

@apgeo apgeo commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Follow-up hardening for #1, on top of the merged #2.

#2 fixed the reported symptom by defaulting an omitted include extension to .th. This refines that resolution to match Therion's actual thinput open sequence and makes every surface agree.

What changed

  • SourceGraph gains IncludeCandidates (the single definition of Therion's order: literal name → .th → .th2) and ResolveIncludePath(path, exists). DependencySites / Dependencies take an optional exists probe: with it, an include resolves to the first candidate that actually exists; without it, the plain .th default is kept (so diagnostics and the create-file quick-fix still name the canonical target). The syntax layer stays I/O-free — callers inject the probe.
  • Consumers pass their probe: File.Exists for the workspace BFS load, reachability audit, and entry-point discovery; loaded-snapshot membership for the semantic file graph / TH_SEM_014 (every snapshot entry was already File.Exists-gated on load, so "in the snapshot" means "on disk" without this layer touching the filesystem).
  • Editor ctrl-click (FindExisting) now resolves through the same IncludeCandidates list, so go-to-file and the project's file-not-found checks can never disagree.

Effect

An extensionless input B that points at an on-disk B.th2 is now loaded, reachable, navigable, and no longer flagged "File not found" — closing the ctrl-click-vs-diagnostic gap noted during #2's review. .th still wins over a .th2 sibling, and an explicit input B.th is never satisfied by B.th2.

Tests

  • SourceGraphResolutionTests: candidate order + probe (literal-first, .th over .th2, explicit-extension never falls back, .th default when nothing exists).
  • WorkspaceReachabilityTests (new file), WorkspaceTests: end-to-end BFS resolves to the on-disk .th2 and prefers .th.
  • DanglingIncludeTests: .th2-backed extensionless input is not reported; explicit .th still warns.
  • Green: Therion.Syntax.Tests 845, Therion.Semantics.Tests 234, Therion.Workspace.Tests 65; ThIDE app builds.

Follow-up to the .th default-extension fix: instead of unconditionally
appending .th, resolve an include target the way Therion's thinput does --
try the literal name, then .th, then .th2 -- via a shared IncludeCandidates
list and a ResolveIncludePath(exists) probe. The pure syntax layer still
does no I/O: callers inject the probe (File.Exists for the workspace BFS,
reachability and entry discovery; loaded-snapshot membership for the
semantic file graph / TH_SEM_014). With no probe, DependencySites keeps the
plain .th default, so diagnostics and the create-file quick-fix still name
the canonical target.

Every include-graph consumer now agrees with the editor's ctrl-click, which
shares the same IncludeCandidates order -- so an extensionless `input B`
pointing at an on-disk B.th2 is loaded, reachable, navigable and no longer
flagged "File not found", while `input B.th` is never satisfied by a B.th2
sibling.

Tests: SourceGraphResolutionTests (probe order), WorkspaceReachabilityTests
(new), WorkspaceTests (BFS .th2 / .th preference), DanglingIncludeTests
(.th2-backed input). Syntax 845, Semantics 234, Workspace 65 green.
@apgeo
apgeo merged commit 196730e into main Jul 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant