(serverId, serverLabel)
| 49 | } |
| 50 | |
| 51 | function copyLogsToClipboard(serverId, serverLabel) { |
| 52 | const logs = getLspLogs(serverId); |
| 53 | if (logs.length === 0) { |
| 54 | toast("No logs to copy"); |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | const text = logs |
| 59 | .map((log) => { |
| 60 | const time = log.timestamp.toLocaleTimeString("en-US", { |
| 61 | hour12: false, |
| 62 | hour: "2-digit", |
| 63 | minute: "2-digit", |
| 64 | second: "2-digit", |
| 65 | }); |
| 66 | return `[${time}] [${log.level.toUpperCase()}] ${log.message}`; |
| 67 | }) |
| 68 | .join("\n"); |
| 69 | |
| 70 | const header = `=== ${serverLabel} LSP Logs ===\n`; |
| 71 | |
| 72 | if (navigator.clipboard?.writeText) { |
| 73 | navigator.clipboard.writeText(header + text).catch(() => { |
| 74 | toast("Failed to copy"); |
| 75 | }); |
| 76 | } else if (cordova?.plugins?.clipboard) { |
| 77 | cordova.plugins.clipboard.copy(header + text); |
| 78 | } else { |
| 79 | toast("Clipboard not available"); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | async function restartServer(serverId) { |
| 84 | addLspLog(serverId, "info", "Restart requested by user"); |
nothing calls this directly
no test coverage detected