[forgive][ez] Tweak logging (#33011)
Just some tweaks --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33011). * #33012 * __->__ #33011 * #33010
lauren committed
Apr 24, 2025 at 13:30 UTC
2af218a7287e3ed5d41ff0ba6cb826850646f47c
1 file changed
+6
-3
compiler/packages/react-forgive/server/src/index.ts
+6
-3
@@ -132,7 +132,7 @@ connection.onInitialized(() => {
132
});
133
134
documents.onDidChangeContent(async event => {
135
- connection.console.info(`Changed: ${event.document.uri}`);
135
+ connection.console.info(`Compiling: ${event.document.uri}`);
136
resetState();
137
if (SUPPORTED_LANGUAGE_IDS.has(event.document.languageId)) {
138
const text = event.document.getText();
@@ -143,8 +143,11 @@ documents.onDidChangeContent(async event => {
143
options: compilerOptions,
144
});
145
} catch (err) {
146
+ connection.console.error('Failed to compile');
147
if (err instanceof Error) {
147
- connection.console.error(err.stack ?? '');
148
+ connection.console.error(err.stack ?? err.message);
149
+ } else {
150
+ connection.console.error(JSON.stringify(err, null, 2));
151
}
152
}
153
}
@@ -192,7 +195,6 @@ connection.onCodeLensResolve(lens => {
195
});
196
197
connection.onCodeAction(params => {
195
- connection.console.log('onCodeAction');
198
const codeActions: Array<CodeAction> = [];
199
for (const codeActionEvent of codeActionEvents) {
200
if (
@@ -242,6 +244,7 @@ connection.onRequest(AutoDepsDecorationsRequest.type, async params => {
244
});
245
246
function resetState() {
247
+ connection.console.debug('Clearing state');
248
compiledFns.clear();
249
autoDepsDecorations = [];
250
codeActionEvents = [];