Show configured plugins in status panels
This commit is contained in:
@@ -8,7 +8,7 @@ const pendingMetadataRequests = new Set<string>()
|
||||
|
||||
function hasMetadataLoaded(metadata?: Instance["metadata"]): boolean {
|
||||
if (!metadata) return false
|
||||
return "project" in metadata && "mcpStatus" in metadata && "lspStatus" in metadata
|
||||
return "project" in metadata && "mcpStatus" in metadata && "lspStatus" in metadata && "plugins" in metadata
|
||||
}
|
||||
|
||||
export async function loadInstanceMetadata(instance: Instance, options?: { force?: boolean }): Promise<void> {
|
||||
@@ -30,15 +30,18 @@ export async function loadInstanceMetadata(instance: Instance, options?: { force
|
||||
pendingMetadataRequests.add(instance.id)
|
||||
|
||||
try {
|
||||
const [projectResult, mcpResult, lspResult] = await Promise.allSettled([
|
||||
const [projectResult, mcpResult, lspResult, configResult] = await Promise.allSettled([
|
||||
client.project.current(),
|
||||
client.mcp.status(),
|
||||
fetchLspStatus(instance.id),
|
||||
client.config.get(),
|
||||
])
|
||||
|
||||
const project = projectResult.status === "fulfilled" ? projectResult.value.data : undefined
|
||||
const mcpStatus = mcpResult.status === "fulfilled" ? (mcpResult.value.data as RawMcpStatus) : undefined
|
||||
const lspStatus = lspResult.status === "fulfilled" ? lspResult.value ?? [] : undefined
|
||||
const config = configResult.status === "fulfilled" ? (configResult.value.data as { plugin?: unknown } | undefined) : undefined
|
||||
const plugins = Array.isArray(config?.plugin) ? (config?.plugin as string[]) : undefined
|
||||
|
||||
const updates: Instance["metadata"] = { ...(currentMetadata ?? {}) }
|
||||
|
||||
@@ -54,10 +57,15 @@ export async function loadInstanceMetadata(instance: Instance, options?: { force
|
||||
updates.lspStatus = lspStatus ?? []
|
||||
}
|
||||
|
||||
if (configResult.status === "fulfilled") {
|
||||
updates.plugins = plugins ?? []
|
||||
}
|
||||
|
||||
if (!updates?.version && instance.binaryVersion) {
|
||||
updates.version = instance.binaryVersion
|
||||
}
|
||||
|
||||
|
||||
mergeInstanceMetadata(instance.id, updates)
|
||||
} catch (error) {
|
||||
log.error("Failed to load instance metadata", error)
|
||||
|
||||
Reference in New Issue
Block a user