Repository navigation
fix(syntax): resolve includes in Therion's literal->.th->.th2 order (follow-up to #2) - #3
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 actualthinputopen sequence and makes every surface agree.What changed
SourceGraphgainsIncludeCandidates(the single definition of Therion's order: literal name →.th→.th2) andResolveIncludePath(path, exists).DependencySites/Dependenciestake an optionalexistsprobe: with it, an include resolves to the first candidate that actually exists; without it, the plain.thdefault 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.File.Existsfor 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 alreadyFile.Exists-gated on load, so "in the snapshot" means "on disk" without this layer touching the filesystem).FindExisting) now resolves through the sameIncludeCandidateslist, so go-to-file and the project's file-not-found checks can never disagree.Effect
An extensionless
input Bthat points at an on-diskB.th2is now loaded, reachable, navigable, and no longer flagged "File not found" — closing the ctrl-click-vs-diagnostic gap noted during #2's review..thstill wins over a.th2sibling, and an explicitinput B.this never satisfied byB.th2.Tests
SourceGraphResolutionTests: candidate order + probe (literal-first,.thover.th2, explicit-extension never falls back,.thdefault when nothing exists).WorkspaceReachabilityTests(new file),WorkspaceTests: end-to-end BFS resolves to the on-disk.th2and prefers.th.DanglingIncludeTests:.th2-backed extensionlessinputis not reported; explicit.thstill warns.Therion.Syntax.Tests845,Therion.Semantics.Tests234,Therion.Workspace.Tests65; ThIDE app builds.