(value: unknown)
| 67 | } |
| 68 | |
| 69 | export function migrateTerminalState(value: unknown) { |
| 70 | if (!record(value)) return value |
| 71 | |
| 72 | const seen = new Set<string>() |
| 73 | const all = (Array.isArray(value.all) ? value.all : []).flatMap((item) => { |
| 74 | const next = pty(item) |
| 75 | if (!next || seen.has(next.id)) return [] |
| 76 | seen.add(next.id) |
| 77 | return [next] |
| 78 | }) |
| 79 | |
| 80 | const active = text(value.active) |
| 81 | |
| 82 | return { |
| 83 | active: active && seen.has(active) ? active : all[0]?.id, |
| 84 | all, |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | export function getWorkspaceTerminalCacheKey(dir: string, scope: ServerScopeValue = ServerScope.local) { |
| 89 | return ScopedKey.from(scope, dir, WORKSPACE_KEY) |
no test coverage detected