Skip to content

Commit 7928440

Browse files
committed
feat: Implement LSP handlers for TypeScript version and unhandled notifications
1 parent 5ce297c commit 7928440

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/cm/lsp/clientManager.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,56 @@ export class LspClientManager {
478478
);
479479
return true;
480480
},
481+
"$/typescriptVersion": (
482+
_client: LSPClient,
483+
params: unknown,
484+
): boolean => {
485+
interface TypeScriptVersionParams {
486+
version?: string;
487+
source?: string;
488+
}
489+
const versionParams = params as TypeScriptVersionParams;
490+
if (!versionParams?.version) return false;
491+
492+
const serverLabel = server.label || server.id;
493+
const source = versionParams.source || "bundled";
494+
console.info(
495+
`[LSP:${server.id}] TypeScript ${versionParams.version} (${source})`,
496+
);
497+
498+
// Show briefly in status bar
499+
lspStatusBar.show({
500+
message: `TypeScript ${versionParams.version}`,
501+
title: serverLabel,
502+
type: "info",
503+
icon: "code",
504+
duration: 3000,
505+
});
506+
return true;
507+
},
481508
};
482509

510+
// Log unhandled notifications to help debug what servers are sending
511+
const unhandledNotificationKey =
512+
"unhandledNotification" as keyof typeof clientConfig;
513+
if (!(unhandledNotificationKey in clientConfig)) {
514+
(
515+
clientConfig as Record<
516+
string,
517+
(client: LSPClient, method: string, params: unknown) => void
518+
>
519+
).unhandledNotification = (
520+
_client: LSPClient,
521+
method: string,
522+
params: unknown,
523+
) => {
524+
console.info(
525+
`[LSP:${server.id}] Unhandled notification: ${method}`,
526+
params,
527+
);
528+
};
529+
}
530+
483531
if (!clientConfig.workspace) {
484532
clientConfig.workspace = (client: LSPClient) =>
485533
new AcodeWorkspace(client, workspaceOptions);

0 commit comments

Comments
 (0)