Skip to content

Commit 8e9b9b0

Browse files
committed
rm glint/getIR command
1 parent ac03de6 commit 8e9b9b0

File tree

7 files changed

+0
-124
lines changed

7 files changed

+0
-124
lines changed

packages/core/src/cli/index.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,13 @@ const argv = yargs(process.argv.slice(2))
6565
'Save .tsbuildinfo files to allow for incremental compilation of projects. Same as the TS `--incremental` flag.',
6666
type: 'boolean',
6767
})
68-
.option('debug-intermediate-representation', {
69-
boolean: false,
70-
description: `When true, writes out a Glint's internal intermediate representation of each file within a GLINT_DEBUG subdirectory of the current working directory. This is intended for debugging Glint itself.`,
71-
})
7268
.version(pkg.version)
7369
.wrap(100)
7470
.strict()
7571
.parseSync();
7672

7773
let cwd = process.cwd();
7874

79-
if (argv['debug-intermediate-representation']) {
80-
const fs = require('fs');
81-
const path = require('path');
82-
(globalThis as any).GLINT_DEBUG_IR = function (filename: string, content: string) {
83-
let target = path.join('GLINT_DEBUG', path.relative(cwd, filename));
84-
fs.mkdirSync(path.dirname(target), { recursive: true });
85-
fs.writeFileSync(target, content);
86-
};
87-
}
88-
8975
if (argv.build) {
9076
// Type signature here so we get a useful error as close to the source of the
9177
// error as possible, rather than at the *use* sites below.
Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,4 @@
1-
import { ProtocolRequestType, TextEdit } from '@volar/language-server';
2-
31
export type Request<Name extends string, T> = {
42
name: Name;
53
type: T;
64
};
7-
8-
export const GetIRRequest = makeRequestType(
9-
'glint/getIR',
10-
ProtocolRequestType<GetIRParams, GetIRResult | null, void, void, void>,
11-
);
12-
13-
export interface GetIRParams {
14-
uri: string;
15-
}
16-
17-
export interface GetIRResult {
18-
contents: string;
19-
uri: string;
20-
}
21-
22-
// This utility allows us to encode type information to enforce that we're using
23-
// a valid request name along with its associated param/response types without
24-
// actually requring the runtime code here to be imported elsewhere.
25-
// See `requestKey` in the Code extension.
26-
function makeRequestType<Name extends string, T>(
27-
name: Name,
28-
RequestType: new (name: Name) => T,
29-
): Request<Name, T> {
30-
return { name, type: new RequestType(name) };
31-
}

packages/core/src/transform/template/rewrite-module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ export function rewriteModule(
4949
let sparseSpans = completeCorrelatedSpans(partialSpans);
5050
let { contents, correlatedSpans } = calculateTransformedSource(script, sparseSpans);
5151

52-
(globalThis as any).GLINT_DEBUG_IR?.(script.filename, contents);
53-
5452
return new TransformedModule(contents, errors, directives, correlatedSpans);
5553
}
5654

packages/vscode/__tests__/smoketest-ember.test.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,6 @@ describe('Smoke test: Ember', () => {
2626
}
2727
});
2828

29-
describe('debugging commands', () => {
30-
test('showing IR in the backing file', async () => {
31-
let scriptURI = Uri.file(`${rootDir}/app/components/colocated-layout.ts`);
32-
let editor = await window.showTextDocument(scriptURI, { viewColumn: ViewColumn.One });
33-
34-
await commands.executeCommand('glint.show-debug-ir');
35-
await waitUntil(() => editor.document.getText().includes('𝚪'));
36-
37-
expect(editor.document.getText()).toMatch('𝚪.this.message');
38-
});
39-
40-
test('showing IR from a template', async () => {
41-
let templateURI = Uri.file(`${rootDir}/app/components/colocated-layout.hbs`);
42-
let scriptURI = Uri.file(`${rootDir}/app/components/colocated-layout.ts`);
43-
44-
await window.showTextDocument(templateURI, { viewColumn: ViewColumn.One });
45-
await commands.executeCommand('glint.show-debug-ir');
46-
await waitUntil(() => window.activeTextEditor?.document.getText().includes('𝚪'));
47-
48-
expect(window.activeTextEditor?.document.uri.toString()).toEqual(scriptURI.toString());
49-
expect(window.activeTextEditor?.document.getText()).toMatch('𝚪.this.message');
50-
});
51-
});
52-
5329
describe('diagnostics for errors', () => {
5430
test('component template', async () => {
5531
let scriptURI = Uri.file(`${rootDir}/app/components/colocated-layout.ts`);

packages/vscode/__tests__/smoketest-template-imports.test.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ describe('Smoke test: ETI Environment', () => {
5151
]);
5252
});
5353

54-
describe('debugging commands', () => {
55-
test('showing IR in a custom file type', async () => {
56-
let scriptURI = Uri.file(`${rootDir}/src/Greeting.gts`);
57-
let editor = await window.showTextDocument(scriptURI, { viewColumn: ViewColumn.One });
58-
59-
await commands.executeCommand('glint.show-debug-ir');
60-
await waitUntil(() => editor.document.getText().includes('𝚪'));
61-
62-
expect(editor.document.getText()).toMatch('𝚪.this.message');
63-
});
64-
});
65-
6654
describe('codeactions args', () => {
6755
test('adds missing args from template into Args type', async () => {
6856
let scriptURI = Uri.file(`${rootDir}/src/Greeting.gts`);

packages/vscode/package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,6 @@
178178
{
179179
"title": "Glint: Restart Glint Server",
180180
"command": "glint.restart-language-server"
181-
},
182-
{
183-
"title": "Glint: Show IR for Debugging",
184-
"command": "glint.show-debug-ir",
185-
"enablement": "config.glint.debug == true"
186181
}
187182
],
188183
"menus": {
@@ -202,11 +197,6 @@
202197
"order": 1,
203198
"type": "string"
204199
},
205-
"glint.debug": {
206-
"description": "Enable debugging commands for Glint.",
207-
"type": "boolean",
208-
"default": false
209-
},
210200
"glint.trace.server": {
211201
"description": "Traces communication between VS Code and the Glint language server.",
212202
"type": "string",

packages/vscode/src/extension.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
} from '@volar/vscode';
2525

2626
import { Disposable, LanguageClient, ServerOptions } from '@volar/vscode/node.js';
27-
import type { Request, GetIRRequest } from '@glint/core/lsp-messages';
2827

2928
///////////////////////////////////////////////////////////////////////////////
3029
// Setup and extension lifecycle
@@ -43,7 +42,6 @@ export function activate(context: ExtensionContext): LabsInfo {
4342
context.subscriptions.push(fileWatcher, createConfigWatcher());
4443
context.subscriptions.push(
4544
commands.registerCommand('glint.restart-language-server', restartClients),
46-
commands.registerTextEditorCommand('glint.show-debug-ir', showDebugIR),
4745
);
4846

4947
// TODO: how to each multiple workspace reloads with VolarLabs?
@@ -78,32 +76,6 @@ async function restartClients(): Promise<void> {
7876
await Promise.all([...clients.values()].map((client) => client.restart()));
7977
}
8078

81-
async function showDebugIR(editor: TextEditor): Promise<void> {
82-
let workspaceFolder = workspace.getWorkspaceFolder(editor.document.uri);
83-
if (!workspaceFolder) {
84-
return;
85-
}
86-
87-
let sourceURI = editor.document.uri;
88-
let client = clients.get(workspaceFolder.uri.fsPath);
89-
let request = requestKey<typeof GetIRRequest>('glint/getIR');
90-
let response = await client?.sendRequest(request, { uri: sourceURI.toString() });
91-
92-
// Just don't support this command for older @glint/core versions
93-
if (!response || typeof response === 'string') return;
94-
95-
let { contents, uri } = response;
96-
let targetEditor = await window.showTextDocument(Uri.parse(uri));
97-
let { document } = targetEditor;
98-
99-
let start = document.positionAt(0);
100-
let end = document.positionAt(document.getText().length);
101-
102-
await targetEditor.edit((edit) => {
103-
edit.replace(new Range(start, end), contents);
104-
});
105-
}
106-
10779
///////////////////////////////////////////////////////////////////////////////
10880
// Workspace folder management
10981

@@ -216,13 +188,6 @@ function createConfigWatcher(): Disposable {
216188
return configWatcher;
217189
}
218190

219-
// This allows us to just use a bare string key for performing a request while maintaining
220-
// type information for the request _without_ forcing us to import runtime code from
221-
// `@glint/core` into the extension.
222-
function requestKey<R extends Request<string, unknown>>(name: R['name']): R['type'] {
223-
return name as unknown as R['type'];
224-
}
225-
226191
// Loads the TypeScript and JavaScript formating options from the workspace and subsets them to
227192
// pass to the language server.
228193
function getOptions(config: WorkspaceConfiguration, key: string): object {

0 commit comments

Comments
 (0)