Repository navigation
fix(syntax): resolve extensionless includes to their default .th target - #2
Merged
Merged
Conversation
Therion's `input`/`source` default an omitted include extension to `.th` (ThBook: "Default extension is `.th' and may be omitted"), so `input B` targets `B.th`. SourceGraph resolved the token literally, so an extensionless include never matched on disk: the workspace BFS stopped at that node, the orphan audit under-counted reachability, entry-point discovery failed to link the file, and TH_SEM_014 raised a false "File not found: 'B'". Apply the default extension at the single resolution chokepoint (DependencySites) via a shared WithDefaultIncludeExtension helper, leaving the raw-token accessors verbatim. Route the editor's "create missing file" quick-fix through the same helper so it creates B.th -- and clears the very diagnostic it targets -- instead of an extensionless stub. Tokens that already carry an extension (B.th, a .th2 scrap) are left untouched, so there is never a double append.
apgeo
added a commit
that referenced
this pull request
Jul 29, 2026
fix(syntax): resolve includes in Therion's literal->.th->.th2 order (follow-up to #2)
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.
Fixes #1.
Problem
Therion's
input/sourcecommands default an omitted include extension to.th(ThBook,inputcommand: *"Default extension is.th' and may be omitted"*), soinput Brefers toB.th. ThIDE resolved the include token **literally**, so an extensionless include never matched on disk. The visible symptom reported in #1 is a false **"File not found"** warning (TH_SEM_014`), but the same gap also:.thconfig.Fix
SourceGraph.DependencySites, through a new sharedSourceGraph.WithDefaultIncludeExtensionhelper. Every include-graph consumer (workspace load, reachability, entry discovery, the file-graph / dangling-include diagnostic) funnels through here, so they stay consistent. The raw-token accessors (DependencyTokens) stay verbatim — the UI still shows the path as written.TherionCodeActions) through the same helper, so it createsB.th— and clears the very diagnostic it targets — instead of an extensionless stub. Previously the quick-fix and the diagnostic disagreed.B.th, a.th2scrap) are left untouched, so there is never a double append.Known limitation
Therion opens the literal name first and only falls back to
.th/.th2when the file is missing on disk.SourceGraphlives in the pure syntax layer and must not touch the filesystem, so it appends.thwhenever the extension is omitted. This diverges from Therion only in the non-idiomatic case where a file literally namedB(no extension) exists on disk — not standard Therion usage, and not what this issue is about.Tests
SourceGraphResolutionTests(new):input B→B.th; sub-directory includes; thconfigsource; explicit.th/.th2left untouched; raw tokens stay verbatim.DanglingIncludeTests(new cases): the Does not recognize the default extension #1 symptom —input BwithB.thpresent raises no warning; and, as a guard against over-suppression,input Bwith no.thon disk still warns on theinputline.Therion.Syntax.Tests839/839,Therion.Semantics.Tests230/230; ThIDE app builds.