Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions src/cm/lsp/serverLauncher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import lspStatusBar from "components/lspStatusBar";
import toast from "components/toast";
import alert from "dialogs/alert";
import confirm from "dialogs/confirm";
import loader from "dialogs/loader";
import type {
Expand All @@ -25,6 +26,17 @@ const STATUS_FAILED: InstallStatus = "failed";

const AXS_BINARY = "$PREFIX/axs";

function getTerminalRequiredMessage(): string {
return (
strings?.terminal_required_message_for_lsp ??
"Terminal not installed. Please install Terminal first to use LSP servers."
);
}

interface LspError extends Error {
code?: string;
}

function getExecutor(): Executor {
const executor = (globalThis as unknown as { Executor?: Executor }).Executor;
if (!executor) {
Expand Down Expand Up @@ -564,10 +576,6 @@ async function waitForWebSocket(
);
}

interface LspError extends Error {
code?: string;
}

export interface EnsureServerResult {
uuid: string | null;
/** Port discovered from port file (for auto-port discovery) */
Expand Down Expand Up @@ -598,6 +606,23 @@ export async function ensureServerRunning(
// Failed to check, proceed with normal startup
}

const terminal = (
globalThis as unknown as {
Terminal?: { isInstalled?: () => Promise<boolean> | boolean };
}
).Terminal;
let isTerminalInstalled = false;
try {
isTerminalInstalled = Boolean(await terminal?.isInstalled?.());
} catch {}
if (!isTerminalInstalled) {
const message = getTerminalRequiredMessage();
alert(strings?.error, message);
const unavailable: LspError = new Error(message);
unavailable.code = "LSP_SERVER_UNAVAILABLE";
throw unavailable;
}

const installed = await ensureInstalled(server);
if (!installed) {
const unavailable: LspError = new Error(
Expand Down
3 changes: 2 additions & 1 deletion src/lang/ar-ye.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,5 +502,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/be-by.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,5 +504,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/bn-bd.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/cs-cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/es-sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/fr-fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/he-il.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,5 +504,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/hi-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,5 +504,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/hu-hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Parancsikon-kérelem megnyitva. A befejezéshez koppintson a hozzáadás gombra.",
"add to home screen": "Hozzáadás a kezdőképernyőhöz",
"pin shortcuts not supported": "Ez az eszköz nem támogatja a kezdőképernyő-parancsikonokat.",
"save file before home shortcut": "A kezdőképernyőhöz való hozzáadás előtt mentse el a fájlt."
"save file before home shortcut": "A kezdőképernyőhöz való hozzáadás előtt mentse el a fájlt.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/id-id.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,5 +504,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/ir-fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,5 +504,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/it-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/ja-jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/ko-kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/ml-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/mm-unicode.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/mm-zawgyi.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/pl-pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/pu-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/ru-ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/tl-ph.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/tr-tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/uk-ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/uz-uz.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/vi-vn.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,5 +504,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/zh-hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}
3 changes: 2 additions & 1 deletion src/lang/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,6 @@
"shortcut request sent": "Shortcut request opened. Tap Add to finish.",
"add to home screen": "Add to home screen",
"pin shortcuts not supported": "Home screen shortcuts are not supported on this device.",
"save file before home shortcut": "Save the file before adding it to the home screen."
"save file before home shortcut": "Save the file before adding it to the home screen.",
"terminal_required_message_for_lsp": "Terminal not installed. Please install Terminal first to use LSP servers."
}