style: format #331
Annotations
2 errors and 1 warning
|
test-build (linux, x86_64, ubuntu-22.04)
Process completed with exit code 1.
|
|
src/utils/__tests__/vscodeCommandFallback.test.ts > VS Code analyze-file command > falls back from a missing command URI to an active file or picker:
src/utils/__tests__/vscodeCommandFallback.test.ts#L14
AssertionError: expected 'import * as vscode from \'vscode\'\ni…' to contain 'const targetUri = uri ?? getActiveFil…'
- Expected
+ Received
- const targetUri = uri ?? getActiveFileUri() ?? await pickFileUriForAnalysis()
+ import * as vscode from 'vscode'
+ import * as path from 'path'
+ import { execFile } from 'child_process'
+ import { promisify } from 'util'
+ import { copyFile, mkdir, rm } from 'fs/promises'
+ import {
+ canonicalizeArchivePath,
+ classifyNeededArchiveEntry,
+ createArchiveSelection,
+ inspectArchiveVolumes,
+ isLoadOperationCancelled,
+ LoadOperationCoordinator,
+ readSelectedArchiveVolumes,
+ type ArchiveVolumeInput,
+ type LoadOperation,
+ } from './archiveReader'
+ import {
+ gateExternalAnalysisUri,
+ type ExternalAnalysisRequest,
+ type ExternalPathKind,
+ } from './externalUriGate'
+ import { normalizeEditorUriScheme, WINDOWS_CONTEXT_MENU_KEYS } from './windowsContextMenu'
+ import { WebviewByteTransferAckBroker, WebviewByteTransferSender } from './webviewByteTransfer'
+
+ let currentPanel: vscode.WebviewPanel | undefined = undefined
+ let webviewAssetRoot: vscode.Uri | undefined
+ const loadOperationCoordinator = new LoadOperationCoordinator()
+ const byteTransferAcknowledgements = new WebviewByteTransferAckBroker()
+ const execFileAsync = promisify(execFile)
+ const t = (message: string, ...args: Array<string | number | boolean>) =>
+ vscode.l10n.t(message, ...args)
+
+ const PRIMARY_LOG_FILE_HINT = 'maa.log / maa.bak*.log / maafw.log / maafw.bak*.log'
+ const MAIN_LOG_RE = /^(maa|maafw)\.log$/i
+ const BAK_LOG_RE =
+ /^(maa|maafw)\.bak(?:\.(\d{4}\.\d{2}\.\d{2}-\d{2}\.\d{2}\.\d{2}\.\d{1,3}))?\.log$/i
+
+ const beginLoadOperation = (): LoadOperation => {
+ byteTransferAcknowledgements.cancelAll(new Error('Load operation was superseded'))
+ return loadOperationCoordinator.begin()
+ }
+
+ const createByteTransfer = (operation: LoadOperation): WebviewByteTransferSender => {
+ const webview = currentPanel?.webview
+ if (!webview) throw new Error(t('The analyzer panel is not available'))
+ return new WebviewByteTransferSender(webview, operation, byteTransferAcknowledgements)
+ }
+
+ const showLoadError = (prefix: string, error: unknown, operation: LoadOperation): void => {
+ if (operation.cancelled || isLoadOperationCancelled(error)) return
+ vscode.window.showErrorMessage(`${prefix}: ${error}`)
+ }
+
+ type PrimaryLogKind = 'main' | 'bak'
+
+ interface PrimaryLogCandidate {
+ path: string
+ dirPath: string
+ fileName: string
+ normalizedName: string
+ kind: PrimaryLogKind
+ rotatedTimestampHint: string | null
+ }
+
+ interface PrimaryLogSelectionEntry {
+ path: string
+ name: string
+ kind: PrimaryLogKind
+ rotatedTimestampHint: string | null
+ size: number
+ }
+
+ interface PrimaryLogQuickPickItem extends vscode.QuickPickItem {
+ logPath: string
+ }
+
+ const formatLogSize = (bytes: number): string => {
+ if (bytes < 1024) return `${bytes} B`
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
+ }
+
+ /**
+ * 多个主日志候选时先让用户选择,避免把数百 MB 的历史日志一次性送进 webview。
+ * 默认只选择当前日志;没有当前日志时,选择最新的备份日志。
+ */
+ async function pickPrimaryLogSelection(
+ entries: PrimaryLogSelectionEntry[],
+ ): Promise<Set<string> | null> {
+ if (entries.length <= 1) {
+ return new Set(entries.map((entry) => entry.path))
+ }
+
+ const sorted = [...entries].sort((a, b) => {
+ if (a.kind !== b.kind) return a.kind === 'main' ? -1 : 1
+ return (b.rotatedTimestampHint ?? '').localeCompare(a.rotatedTimestampHint ?? '')
+ })
+
+ const mainEntries = sorted.filter((entry) => entry.kind === 'main')
+ const defaultEntries = mainEntries.length > 0 ? mainEntries : sorted.slice(0, 1)
+ const defaultPicked = new Set(defaultEntries.map((entry) => entry.path))
+
+ const items: PrimaryLogQuickPickItem[] = sorted.map((entry) => ({
+ label: entry.name,
+
|
|
test-build (linux, x86_64, ubuntu-22.04)
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@11d5960a326750d5838078e36cf38b85af677262, actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020, pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
|