From 399d2b73d27bccce72ef96640a616535e77b0124 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Sat, 24 Aug 2019 11:06:27 +0800 Subject: [PATCH] fix: Can trigger showTopVotedSolution from keyboard shortcut --- src/commands/show.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/commands/show.ts b/src/commands/show.ts index 896516a9..1846fe9f 100644 --- a/src/commands/show.ts +++ b/src/commands/show.ts @@ -13,7 +13,7 @@ import { leetCodeManager } from "../leetCodeManager"; import { IProblem, IQuickItemEx, languages, ProblemState } from "../shared"; import { getNodeIdFromFile } from "../utils/problemUtils"; import { DialogOptions, DialogType, openSettingsEditor, promptForOpenOutputChannel, promptForSignIn, promptHintMessage } from "../utils/uiUtils"; -import { selectWorkspaceFolder } from "../utils/workspaceUtils"; +import { getActiveFilePath, selectWorkspaceFolder } from "../utils/workspaceUtils"; import * as wsl from "../utils/wslUtils"; import { leetCodePreviewProvider } from "../webview/leetCodePreviewProvider"; import { leetCodeSolutionProvider } from "../webview/leetCodeSolutionProvider"; @@ -71,11 +71,15 @@ export async function searchProblem(): Promise { export async function showSolution(input: LeetCodeNode | vscode.Uri): Promise { let problemInput: string | undefined; - if (input instanceof LeetCodeNode) { + if (input instanceof LeetCodeNode) { // Triggerred from explorer problemInput = input.id; - } else if (input instanceof vscode.Uri) { + } else if (input instanceof vscode.Uri) { // Triggerred from Code Lens/context menu problemInput = `"${input.fsPath}"`; - } else { + } else if (!input) { // Triggerred from command + problemInput = await getActiveFilePath(); + } + + if (!problemInput) { vscode.window.showErrorMessage("Invalid input to fetch the solution data."); return; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy