(input: IProblem | vscode.Uri, isSideMode: boolean = false)
| 22 | import * as list from "./list"; |
| 23 | |
| 24 | export async function previewProblem(input: IProblem | vscode.Uri, isSideMode: boolean = false): Promise<void> { |
| 25 | let node: IProblem; |
| 26 | if (input instanceof vscode.Uri) { |
| 27 | const activeFilePath: string = input.fsPath; |
| 28 | const id: string = await getNodeIdFromFile(activeFilePath); |
| 29 | if (!id) { |
| 30 | vscode.window.showErrorMessage(`Failed to resolve the problem id from file: ${activeFilePath}.`); |
| 31 | return; |
| 32 | } |
| 33 | const cachedNode: IProblem | undefined = explorerNodeManager.getNodeById(id); |
| 34 | if (!cachedNode) { |
| 35 | vscode.window.showErrorMessage(`Failed to resolve the problem with id: ${id}.`); |
| 36 | return; |
| 37 | } |
| 38 | node = cachedNode; |
| 39 | // Move the preview page aside if it's triggered from Code Lens |
| 40 | isSideMode = true; |
| 41 | } else { |
| 42 | node = input; |
| 43 | } |
| 44 | const needTranslation: boolean = settingUtils.shouldUseEndpointTranslation(); |
| 45 | const descString: string = await leetCodeExecutor.getDescription(node.id, needTranslation); |
| 46 | leetCodePreviewProvider.show(descString, node, isSideMode); |
| 47 | } |
| 48 | |
| 49 | export async function pickOne(): Promise<void> { |
| 50 | const problems: IProblem[] = await list.listProblems(); |
no test coverage detected