Skip to content

Commit

Permalink
enable loose mode for TS Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
machty committed Jul 16, 2024
1 parent 7828ae5 commit 895c20f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
16 changes: 8 additions & 8 deletions packages/core/src/volar/ember-language-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ export function createEmberLanguagePlugin<T extends URI | string>(
},

// When does this get called?
createVirtualCode(scriptId: URI | string, languageId, snapshot /*, codegenContext */) {
createVirtualCode(scriptId: URI | string, languageId, snapshot, codegenContext) {
const scriptIdStr = String(scriptId);

// See: https://github.com/JetBrains/intellij-plugins/blob/11a9149e20f4d4ba2c1600da9f2b81ff88bd7c97/Angular/src/angular-service/src/index.ts#L31
if (
glintConfig.enableTsPlugin &&
languageId === 'typescript' &&
!scriptIdStr.endsWith('.d.ts') &&
scriptIdStr.indexOf('/node_modules/') < 0
) {
// NOTE: scriptId might not be a path when we convert this plugin:
// https://github.com/withastro/language-tools/blob/eb7215cc0ab3a8f614455528cd71b81ea994cf68/packages/ts-plugin/src/language.ts#L19
// TODO: commented out for now because support for ember-loose is blocking behind converting to TS Plugin and this will just slow things down
// return new LooseModeBackingComponentClassVirtualCode(
// glintConfig,
// snapshot,
// scriptId,
// codegenContext,
// );
return new LooseModeBackingComponentClassVirtualCode(
glintConfig,
snapshot,
scriptId,
codegenContext,
);
}

if (languageId === 'glimmer-ts' || languageId === 'glimmer-js') {
Expand Down
7 changes: 6 additions & 1 deletion test-packages/ts-plugin-test-app/src/ember-component.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{{foo}}
{{! TODO: this isn't working yet }}
{{foo}}

<div>
{{this.bar}}
</div>

0 comments on commit 895c20f

Please sign in to comment.