Skip to content

Commit e3aa6d1

Browse files
committed
fix(vscode): handle fail tsserver requests to avlid memory leak
1 parent d407159 commit e3aa6d1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

extensions/vscode/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@ function launch(context: vscode.ExtensionContext) {
171171
);
172172

173173
client.onNotification('tsserver/request', async ([seq, command, args]) => {
174-
const res = await vscode.commands.executeCommand<{ body: unknown } | undefined>(
174+
vscode.commands.executeCommand<{ body: unknown } | undefined>(
175175
'typescript.tsserverRequest',
176176
command,
177177
args,
178178
{ isAsync: true, lowPriority: true },
179-
);
180-
client.sendNotification('tsserver/response', [seq, res?.body]);
179+
).then(res => {
180+
client.sendNotification('tsserver/response', [seq, res?.body]);
181+
}, () => {
182+
client.sendNotification('tsserver/response', [seq, undefined]);
183+
});
181184
});
182185
client.start();
183186

0 commit comments

Comments
 (0)