Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
95059a9
wip
machty Mar 6, 2025
60e0e19
fix comment
machty Mar 6, 2025
35fb937
get one new-style definition test running
machty Mar 6, 2025
f141748
single passing TS Plugin test
machty Mar 7, 2025
7770a65
get ts hbs test passing
machty Mar 7, 2025
cf251b0
one more passing
machty Mar 7, 2025
d400de7
more
machty Mar 7, 2025
e8c3581
done
machty Mar 7, 2025
577ec63
rm old
machty Mar 7, 2025
cb54094
extract helpers
machty Mar 7, 2025
a0420a4
start references
machty Mar 7, 2025
10abaff
fix reference test cases with on-disk fixture hack
machty Mar 7, 2025
c19d024
rm references
machty Mar 7, 2025
f939b24
wip hover
machty Mar 7, 2025
dd6a493
args
machty Mar 7, 2025
42cf87e
finish hover
machty Mar 7, 2025
4576f5c
completions progress
machty Mar 7, 2025
4fd9d31
wip rmoving old LS code
machty Mar 9, 2025
b83825e
rename to tsserver-plugin
machty Mar 9, 2025
128836d
rework language-server to be closer to vue
machty Mar 9, 2025
9af2d03
further removal of hybrid mode
machty Mar 10, 2025
233cc2b
formatting
machty Mar 10, 2025
b7f270c
skip/fix completion test
machty Mar 10, 2025
dcfc374
rm old completions
machty Mar 10, 2025
669fc4c
dissolve "custom extensions" test into proper files
machty Mar 10, 2025
8dec20c
rm checkStandaloneTemplates
machty Mar 10, 2025
d662c43
passing diagnostics ts plugin test
machty Mar 10, 2025
ea2252a
ai tweaks
machty Mar 10, 2025
8e4029c
expect error ignore
machty Mar 10, 2025
8c67250
resinstate gts
machty Mar 10, 2025
2c4332a
wip
machty Mar 10, 2025
08905a6
comment
machty Mar 10, 2025
77cd3a6
rm diagnostics
machty Mar 10, 2025
1d00c08
rm custom extensions
machty Mar 10, 2025
3a6b3cb
wip diag augmentation
machty Mar 10, 2025
0e7758a
disable debug loop for now
machty Mar 11, 2025
b010fd0
reinstate diagnostic augmentation
machty Mar 11, 2025
8fee92e
one more passing
machty Mar 11, 2025
4816e6a
bad `component`/`helper`/`modifier` arg type
machty Mar 11, 2025
ebf60cc
disable spec
machty Mar 11, 2025
2cb1e2b
rm diag augmentation
machty Mar 11, 2025
28a272c
hopefully fix restart loop
machty Mar 11, 2025
3d50f1d
comment out tsc tests
machty Mar 11, 2025
73b0ece
fix completion specs
machty Mar 11, 2025
2f04cc2
disable rename test
machty Mar 11, 2025
89451cb
leave stubs in delete specs
machty Mar 11, 2025
74f6164
rm old LS smoke test
machty Mar 11, 2025
88e545e
lint
machty Mar 11, 2025
52f1b6f
maybe fix type
machty Mar 11, 2025
041e071
prettier
machty Mar 11, 2025
b712bf2
rename
machty Mar 12, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ test-packages/ephemeral
.eslintcache
*.tsbuildinfo
*.js.map
tsserver.log
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"nohoist:comment": "When running extension host in test-packages/ts-plugin-test-app, we need 1. to be able to use workspace TypeScript, and 2. to use a TS Plugin specified as an npm dependency, both which require typescript and the plugin to be present within the same folder's `node_modules` directory.",
"nohoist": [
"ts-plugin-test-app/typescript",
"ts-plugin-test-app/@glint/typescript-plugin"
"ts-plugin-test-app/@glint/tsserver-plugin"
]
},
"scripts": {
Expand Down
14 changes: 12 additions & 2 deletions packages/core/__tests__/cli/build-watch.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { afterEach, beforeEach, describe, expect, test } from 'vitest';

test('maybe reinstate these tests');

/*
Skipping all of this for now. Now that we've offloaded a lot of this logic to Volar
this is an opportunity to rebuild the test suite to not re-test what Volar already
tests.

import * as os from 'node:os';

import { stripIndent } from 'common-tags';
import stripAnsi = require('strip-ansi');
import { afterEach, beforeEach, describe, expect, test } from 'vitest';

import {
Project,
Expand Down Expand Up @@ -42,7 +50,7 @@ const BUILD_WATCH_TSCONFIG = {
const IS_WINDOWS = os.type() === 'Windows_NT';
const PAUSE_TIME = IS_WINDOWS ? 2_500 : 1_000;

/** Combine `setTimeout` and a `Promise` to defer further work for some time. */
// Combine `setTimeout` and a `Promise` to defer further work for some time.
const pauseForTSBuffering = (): Promise<void> =>
new Promise((resolve) => setTimeout(resolve, PAUSE_TIME));

Expand Down Expand Up @@ -546,3 +554,5 @@ describe('CLI: watched build mode typechecking', () => {
});
});
});

*/
15 changes: 13 additions & 2 deletions packages/core/__tests__/cli/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import { afterEach, beforeEach, describe, expect, test } from 'vitest';

test('maybe reinstate these tests');

/*
Skipping all of this for now. Now that we've offloaded a lot of this logic to Volar
this is an opportunity to rebuild the test suite to not re-test what Volar already
tests.


import { existsSync, statSync } from 'fs';

import { stripIndent } from 'common-tags';
Expand All @@ -15,7 +25,7 @@ import {
setupCompositeProject,
} from 'glint-monorepo-test-utils';

describe('CLI: single-pass build mode typechecking', () => {
describe.skip('CLI: single-pass build mode typechecking', () => {
describe('simple projects using `--build`', () => {
let project!: Project;
beforeEach(async () => {
Expand All @@ -26,7 +36,7 @@ describe('CLI: single-pass build mode typechecking', () => {
await project.destroy();
});

test('passes a valid basic project', async () => {
test.only('passes a valid basic project', async () => {
let code = stripIndent`
import '@glint/environment-ember-template-imports';
import Component from '@glimmer/component';
Expand Down Expand Up @@ -1681,3 +1691,4 @@ describe('CLI: --build --dry', () => {
});
});
});
*/
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,100 @@ describe('CLI: watched typechecking', () => {

await watch.terminate();
});

test('reporting watched diagnostics', async () => {
let code = 'let identifier: string = 123;';

project.setGlintConfig({ environment: 'ember-template-imports' });
project.write('index.gts', code);

let watch = project.checkWatch();
let output = await watch.awaitOutput('Watching for file changes.');

await watch.terminate();

let stripped = stripAnsi(output);
let error = stripped.slice(
stripped.indexOf('index.gts'),
stripped.lastIndexOf(`~~~${os.EOL}`) + 3,
);

expect(output).toMatch('Found 1 error.');
expect(error.replace(/\r/g, '')).toMatchInlineSnapshot(`
"index.gts:1:5 - error TS2322: Type 'number' is not assignable to type 'string'.

1 let identifier: string = 123;let identifier: string = 123;
~~~~~~~~~~"
`);
});

// A number of issues with these tests:
//
// - `.gjs` (untyped) file not yet supported
// - extension-less imports are causing issues specifically with `--watch` even though they work in non-watch mode
// - Discussing/tracking here: https://discord.com/channels/1192759067815464990/1192759067815464993/1258084777618178159
// - (I noticed this after changing other.gjs to other.gts)
describe.skip('external file changes', () => {
beforeEach(() => {
project.setGlintConfig({ environment: 'ember-template-imports' });
project.write(
'index.gts',
stripIndent`
import { foo } from "./other";
console.log(foo - 1);
`,
);
});

test('adding a missing module', async () => {
let watch = project.checkWatch();
let output = await watch.awaitOutput('Watching for file changes.');

expect(output).toMatch('Found 1 error.');
expect(output).toMatch(
"Cannot find module './other' or its corresponding type declarations.",
);

project.write('other.gjs', 'export const foo = 123;');

await watch.awaitOutput('Found 0 errors.');
await watch.terminate();
});

test('changing an imported module', async () => {
project.write('other.gjs', 'export const foo = 123;');

let watch = project.checkWatch();
let output = await watch.awaitOutput('Watching for file changes.');

expect(output).toMatch('Found 0 errors.');

project.write('other.gjs', 'export const foo = "hi";');
output = await watch.awaitOutput('Watching for file changes.');

expect(output).toMatch('Found 1 error.');
expect(output).toMatch('TS2362');

await watch.terminate();
});

test('removing an imported module', async () => {
project.write('other.gjs', 'export const foo = 123;');

let watch = project.checkWatch();
let output = await watch.awaitOutput('Watching for file changes.');

expect(output).toMatch('Found 0 errors.');

project.remove('other.gjs');
output = await watch.awaitOutput('Watching for file changes.');

expect(output).toMatch('Found 1 error.');
expect(output).toMatch(
"Cannot find module './other' or its corresponding type declarations.",
);

await watch.terminate();
});
});
});
21 changes: 21 additions & 0 deletions packages/core/__tests__/cli/check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,25 @@ describe('CLI: single-pass typechecking', () => {
"
`);
});

test('reporting one-shot diagnostics', async () => {
let code = 'let identifier: string = 123;';

project.setGlintConfig({ environment: 'ember-template-imports' });
project.write('index.gts', code);

let result = await project.check({ reject: false });

expect(result.exitCode).not.toBe(0);
expect(stripAnsi(result.stdout)).toMatchInlineSnapshot(`
"index.gts:1:5 - error TS2322: Type 'number' is not assignable to type 'string'.

1 let identifier: string = 123;let identifier: string = 123;
~~~~~~~~~~


Found 1 error in index.gts:1
"
`);
});
});
135 changes: 0 additions & 135 deletions packages/core/__tests__/cli/custom-extensions.test.ts

This file was deleted.

10 changes: 10 additions & 0 deletions packages/core/__tests__/cli/incremental.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { afterEach, beforeEach, describe, expect, test } from 'vitest';

test('maybe reinstate these tests');

/*
Skipping all of this for now. Now that we've offloaded a lot of this logic to Volar
this is an opportunity to rebuild the test suite to not re-test what Volar already
tests.

import { existsSync, statSync, readFileSync } from 'fs';

import { stripIndent } from 'common-tags';
Expand Down Expand Up @@ -166,3 +175,4 @@ describe('CLI: --incremental', () => {
});
});
});
*/
4 changes: 0 additions & 4 deletions packages/core/__tests__/config/load-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe('Config: loadConfig', () => {
JSON.stringify({
glint: {
environment: 'kaboom',
checkStandaloneTemplates: false,
},
}),
);
Expand All @@ -50,7 +49,6 @@ describe('Config: loadConfig', () => {

expect(config.rootDir).toBe(normalizePath(`${testDir}/deeply`));
expect(config.environment.getConfiguredTemplateTags()).toEqual({ test: {} });
expect(config.checkStandaloneTemplates).toBe(false);
});

test('locates config in package', () => {
Expand All @@ -77,7 +75,6 @@ describe('Config: loadConfig', () => {
JSON.stringify({
glint: {
environment: 'kaboom',
checkStandaloneTemplates: false,
},
}),
);
Expand All @@ -95,6 +92,5 @@ describe('Config: loadConfig', () => {

expect(config.rootDir).toBe(normalizePath(`${directory}`));
expect(config.environment.getConfiguredTemplateTags()).toEqual({ test: {} });
expect(config.checkStandaloneTemplates).toBe(false);
});
});
Loading