Skip to content

fix(syntax): resolve extensionless includes to their default .th target - #2

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 27, 2026

Copy link
Copy Markdown
Owner

Fixes #1.

Problem

Therion's input / source commands default an omitted include extension to .th (ThBook, input command: *"Default extension is .th' and may be omitted"*), so input 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:

  • stopped the workspace BFS load at the unresolved node (nothing below it was parsed),
  • made the orphan / reachability audit under-count, and
  • made project entry-point auto-discovery miss the parent .thconfig.

Fix

  • Apply the default extension at the single resolution chokepoint, SourceGraph.DependencySites, through a new shared SourceGraph.WithDefaultIncludeExtension helper. 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.
  • Route the editor's "Create missing file" quick-fix (TherionCodeActions) through the same helper, so it creates B.th — and clears the very diagnostic it targets — instead of an extensionless stub. Previously the quick-fix and the diagnostic disagreed.
  • Tokens that already carry an extension (B.th, a .th2 scrap) are left untouched, so there is never a double append.

Known limitation

Therion opens the literal name first and only falls back to .th / .th2 when the file is missing on disk. SourceGraph lives in the pure syntax layer and must not touch the filesystem, so it appends .th whenever the extension is omitted. This diverges from Therion only in the non-idiomatic case where a file literally named B (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; thconfig source; explicit .th / .th2 left untouched; raw tokens stay verbatim.
  • DanglingIncludeTests (new cases): the Does not recognize the default extension #1 symptom — input B with B.th present raises no warning; and, as a guard against over-suppression, input B with no .th on disk still warns on the input line.
  • Full suites green: Therion.Syntax.Tests 839/839, Therion.Semantics.Tests 230/230; ThIDE app builds.

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
apgeo merged commit 2808843 into main Jul 29, 2026
3 checks passed
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)
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.

Does not recognize the default extension

1 participant