Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{
// For this to work, make sure you're runninc `tsc --build --watch` at the root, AND
// `yarn bundle:watch` from within vscode directory.
"name": "Debug Extension (TS Plugin Only)",
"name": "Debug Extension (TS Plugin, .gts)",
"type": "extensionHost",
"request": "launch",
// "preLaunchTask": "npm: build",
Expand All @@ -71,10 +71,29 @@
],
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode",
"--disable-extensions", // uncomment to activate your local extensions
"--disable-extensions", // comment to activate your local extensions
"${workspaceFolder}/test-packages/ts-plugin-test-app"
]
},
{
// For this to work, make sure you're runninc `tsc --build --watch` at the root, AND
// `yarn bundle:watch` from within vscode directory.
"name": "Debug Extension (TS Plugin, ember-app-loose-and-gts)",
"type": "extensionHost",
"request": "launch",
// "preLaunchTask": "npm: build",
"autoAttachChildProcesses": true,
"runtimeExecutable": "${execPath}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode",
"--disable-extensions", // comment to activate your local extensions
"${workspaceFolder}/packages/vscode/__fixtures__/ember-app-loose-and-gts/"
]
},
{
"name": "Attach to TS Server",
"type": "node",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@glint/environment-ember-loose';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Component from '@glimmer/component';

export interface GreetingSignature {
Args: { target: string };
}

export default class Greeting extends Component<GreetingSignature> {
private message = 'Hello';

<template>
{{this.message}}, {{@target}}!
</template>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{! This reference is correct; no errors }}
{{this.message}}

{{! This reference has a typo. Error expected }}
{{this.messageeee}}

{{!
If I reload VSCode via `Developer: Reload Window` (or fully restart the debugging session),
then the error diagnostics will be correctly calculated, but do not update/go away when I
fix the errors (and newly introduced errors do not show up).

Perhaps there is some TS Plugin caching issue with associated files?
}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Component from '@glimmer/component';

export default class ColocatedLayoutComponent extends Component {
private message = 'hello';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Component from '@glimmer/component';

export default class ColocatedLayoutComponent extends Component {
private message = 'hello';
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@glimmer/component';

export default class ClassicLayoutComponent extends Component {
export default class PodLayoutComponent extends Component {
private message = 'hello';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{this.message}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{@foo}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Controller from '@ember/controller';

export default class PodController extends Controller {
declare model: { message: string };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Controller from '@ember/controller';

export default class ClassicController extends Controller {
declare model: { message: string };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Route from '@ember/routing/route';

export default class PodControllerRoute extends Route {
async model(): Promise<{ message: string }> {
return { message: 'hello' };
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{@model.message}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Route from '@ember/routing/route';

export default class PodLoneRoute extends Route {
async model(): Promise<{ message: string }> {
return { message: 'hello' };
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{@model.message}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Route from '@ember/routing/route';

export default class ClassicControllerRoute extends Route {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Route from '@ember/routing/route';

export default class ClassicLoneRoute extends Route {
async model(): Promise<{ message: string }> {
return { message: 'hello' };
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{@model.message}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{@model.message}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "test-ember-app-loose-and-gts",
"private": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import 'qunit-dom';

module('Integration | component test', function (hooks) {
setupRenderingTest(hooks);

interface MyTestContext {
message: string;
}

test('typechecking', async function (this: MyTestContext, assert) {
this.message = 'hi';

await render<MyTestContext>(hbs`
{{this.message}}
`);

assert.dom().hasText('message');
});
});
13 changes: 13 additions & 0 deletions packages/vscode/__fixtures__/ember-app-loose-and-gts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"strict": true,
"target": "es2019",
"module": "es2015",
"moduleResolution": "bundler",
"skipLibCheck": true
},
"glint": {
"environment": ["ember-loose", "ember-template-imports"],
"enableTsPlugin": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,6 @@ describe.skip('Smoke test: Ember', () => {
});

describe('component layout', () => {
test('classic', async () => {
let scriptURI = Uri.file(`${rootDir}/app/components/classic-layout.ts`);
let templateURI = Uri.file(`${rootDir}/app/templates/components/classic-layout.hbs`);

await window.showTextDocument(templateURI);

await waitUntil(() => extensions.getExtension('typed-ember.glint-vscode')?.isActive);

let positions = (await commands.executeCommand(
'vscode.executeDefinitionProvider',
templateURI,
new Position(0, 11),
)) as Array<Location>;

expect(positions.length).toBe(1);
expect(positions[0].uri.fsPath).toEqual(scriptURI.fsPath);
expect(positions[0].range).toEqual(new Range(3, 10, 3, 17));
});

test('colocated', async () => {
let scriptURI = Uri.file(`${rootDir}/app/components/colocated-layout.ts`);
let templateURI = Uri.file(`${rootDir}/app/components/colocated-layout.hbs`);
Expand Down