11import lspStatusBar from "components/lspStatusBar" ;
22import toast from "components/toast" ;
3+ import alert from "dialogs/alert" ;
34import confirm from "dialogs/confirm" ;
45import loader from "dialogs/loader" ;
56import type {
@@ -25,6 +26,17 @@ const STATUS_FAILED: InstallStatus = "failed";
2526
2627const AXS_BINARY = "$PREFIX/axs" ;
2728
29+ function getTerminalRequiredMessage ( ) : string {
30+ return (
31+ strings ?. terminal_required_message_for_lsp ??
32+ "Terminal not installed. Please install Terminal first to use LSP servers."
33+ ) ;
34+ }
35+
36+ interface LspError extends Error {
37+ code ?: string ;
38+ }
39+
2840function getExecutor ( ) : Executor {
2941 const executor = ( globalThis as unknown as { Executor ?: Executor } ) . Executor ;
3042 if ( ! executor ) {
@@ -564,10 +576,6 @@ async function waitForWebSocket(
564576 ) ;
565577}
566578
567- interface LspError extends Error {
568- code ?: string ;
569- }
570-
571579export interface EnsureServerResult {
572580 uuid : string | null ;
573581 /** Port discovered from port file (for auto-port discovery) */
@@ -598,6 +606,23 @@ export async function ensureServerRunning(
598606 // Failed to check, proceed with normal startup
599607 }
600608
609+ const terminal = (
610+ globalThis as unknown as {
611+ Terminal ?: { isInstalled ?: ( ) => Promise < boolean > | boolean } ;
612+ }
613+ ) . Terminal ;
614+ let isTerminalInstalled = false ;
615+ try {
616+ isTerminalInstalled = Boolean ( await terminal ?. isInstalled ?.( ) ) ;
617+ } catch { }
618+ if ( ! isTerminalInstalled ) {
619+ const message = getTerminalRequiredMessage ( ) ;
620+ alert ( strings ?. error , message ) ;
621+ const unavailable : LspError = new Error ( message ) ;
622+ unavailable . code = "LSP_SERVER_UNAVAILABLE" ;
623+ throw unavailable ;
624+ }
625+
601626 const installed = await ensureInstalled ( server ) ;
602627 if ( ! installed ) {
603628 const unavailable : LspError = new Error (
0 commit comments