typed-ember / glint

TypeScript powered tooling for Glimmer templates
https://typed-ember.gitbook.io/glint
MIT License
109 stars 51 forks source link

Files with unicode in a non-last component breaks Glint #756

Open NullVoxPopuli opened 1 month ago

NullVoxPopuli commented 1 month ago

in app/templates/index.gts

I import './page' (another .gts file), and get these errors:

app/templates/index.gts:8:45 - error TS2306: File '<..>/app/templates/page.ts' is not a module.

8 import { Article, InternalLink, Link } from './page';
                                              ~~~~~~~~

app/templates/index.gts:8:45 - error TS5012: Cannot read file '<..>/app/templates/page.ts': 
  Internal error: missing location info for template.

8 import { Article, InternalLink, Link } from './page';
                                              ~~~~~~~~

A Glint internal error:

Diagnostics:
1. Glint encountered an error computing diagnostics for this file. This is likely a bug in Glint; please file an issue, including any code and/or steps to follow to reproduce the error.

   Error: Internal error: missing location info for template
       at findTemplateLocation (<.pnpm>/@glint+environment-ember-template-imports@1.4.0_@glint+environment-ember-loose@1.4.0_@glimmer_t3wvtjr7nz6nk3exr6znfvvq6u/node_modules/@glint/environment-ember-template-imports/-private/environment/transform.js:104:15)
       at transformNode (<.pnpm>/@glint+environment-ember-template-imports@1.4.0_@glint+environment-ember-loose@1.4.0_@glimmer_t3wvtjr7nz6nk3exr6znfvvq6u/node_modules/@glint/environment-ember-template-imports/-private/environment/transform.js:27:28)
       at visit (<.pnpm>/@glint+environment-ember-template-imports@1.4.0_@glint+environment-ember-loose@1.4.0_@glimmer_t3wvtjr7nz6nk3exr6znfvvq6u/node_modules/@glint/environment-ember-template-imports/-private/environment/transform.js:12:31)
       at visitNode (<.pnpm>/typescript@5.5.4/node_modules/typescript/lib/typescript.js:92459:19)
       at visitEachChildOfVariableDeclaration (<.pnpm>/typescript@5.5.4/node_modules/typescript/lib/typescript.js:93407:7)
       at Object.visitEachChild (<.pnpm>/typescript@5.5.4/node_modules/typescript/lib/typescript.js:92707:33)
       at visit (<.pnpm>/@glint+environment-ember-template-imports@1.4.0_@glint+environment-ember-loose@1.4.0_@glimmer_t3wvtjr7nz6nk3exr6znfvvq6u/node_modules/@glint/environment-ember-template-imports/-private/environment/transform.js:11:30)
       at visitArrayWorker (<.pnpm>/typescript@5.5.4/node_modules/typescript/lib/typescript.js:92521:49)
       at visitNodes2 (<.pnpm>/typescript@5.5.4/node_modules/typescript/lib/typescript.js:92492:19)
       at visitEachChildOfVariableDeclarationList (<.pnpm>/typescript@5.5.4/node_modules/typescript/lib/typescript.js:93413:7)

This could be due to unicode remapping from content-tag, as described here:

Which I 100% confirm via deleting a "🎉" (or by moving the component-containing :tada: to the end of the file).

I suspect this also needs to be fixed on main as well.