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 {
@@ -24,6 +25,11 @@ const STATUS_DECLINED: InstallStatus = "declined";
2425const STATUS_FAILED : InstallStatus = "failed" ;
2526
2627const AXS_BINARY = "$PREFIX/axs" ;
28+ const TERMINAL_REQUIRED_MESSAGE = strings . terminal_required_message_for_lsp ;
29+
30+ interface LspError extends Error {
31+ code ?: string ;
32+ }
2733
2834function getExecutor ( ) : Executor {
2935 const executor = ( globalThis as unknown as { Executor ?: Executor } ) . Executor ;
@@ -564,10 +570,6 @@ async function waitForWebSocket(
564570 ) ;
565571}
566572
567- interface LspError extends Error {
568- code ?: string ;
569- }
570-
571573export interface EnsureServerResult {
572574 uuid : string | null ;
573575 /** Port discovered from port file (for auto-port discovery) */
@@ -598,6 +600,22 @@ export async function ensureServerRunning(
598600 // Failed to check, proceed with normal startup
599601 }
600602
603+ const terminal = (
604+ globalThis as unknown as {
605+ Terminal ?: { isInstalled ?: ( ) => Promise < boolean > | boolean } ;
606+ }
607+ ) . Terminal ;
608+ let isTerminalInstalled = false ;
609+ try {
610+ isTerminalInstalled = Boolean ( await terminal ?. isInstalled ?.( ) ) ;
611+ } catch { }
612+ if ( ! isTerminalInstalled ) {
613+ alert ( strings . error , TERMINAL_REQUIRED_MESSAGE ) ;
614+ const unavailable : LspError = new Error ( TERMINAL_REQUIRED_MESSAGE ) ;
615+ unavailable . code = "LSP_SERVER_UNAVAILABLE" ;
616+ throw unavailable ;
617+ }
618+
601619 const installed = await ensureInstalled ( server ) ;
602620 if ( ! installed ) {
603621 const unavailable : LspError = new Error (
0 commit comments