8000 fix: Cannot show description page (#345) · aghao/vscode-leetcode@1572c7a · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1572c7a

Browse files
authored
fix: Cannot show description page (LeetCode-OpenSource#345)
1 parent 123d95b commit 1572c7a

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/commands/show.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ import { leetCodeSolutionProvider } from "../webview/leetCodeSolutionProvider";
2020
import * as list from "./list";
2121

2222
export async function previewProblem(input: IProblem | vscode.Uri, isSideMode: boolean = false): Promise<void> {
23-
let node: LeetCodeNode;
24-
if (input instanceof LeetCodeNode) {
25-
node = input;
26-
} else if (input instanceof vscode.Uri) {
23+
let node: IProblem;
24+
if (input instanceof vscode.Uri) {
2725
const activeFilePath: string = input.fsPath;
2826
const id: string = await getNodeIdFromFile(activeFilePath);
2927
if (!id) {
3028
vscode.window.showErrorMessage(`Failed to resolve the problem id from file: ${activeFilePath}.`);
3129
return;
3230
}
33-
const cachedNode: LeetCodeNode | undefined = explorerNodeManager.getNodeById(id);
31+
const cachedNode: IProblem | undefined = explorerNodeManager.getNodeById(id);
3432
if (!cachedNode) {
3533
vscode.window.showErrorMessage(`Failed to resolve the problem with id: ${id}.`);
3634
return;
@@ -39,8 +37,7 @@ export async function previewProblem(input: IProblem | vscode.Uri, isSideMode: b
3937
// Move the preview page aside if it's triggered from Code Lens
4038
isSideMode = true;
4139
} else {
42-
vscode.window.showErrorMessage("Invalid input to fetch the preview data.");
43-
return;
40+
node = input;
4441
}
4542

4643
const descString: string = await leetCodeExecutor.getDescription(node.id);

src/webview/leetCodePreviewProvider.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
2222
this.node = node;
2323
this.sideMode = isSideMode;
2424
this.showWebviewInternal();
25-
if (this.sideMode) {
26-
this.hideSideBar(); // For better view area
27-
}
25+
// Comment out this operation since it sometimes may cause the webview become empty.
26+
// Waiting for the progress of the VS Code side issue: https://github.com/microsoft/vscode/issues/3742
27+
// if (this.sideMode) {
28+
// this.hideSideBar(); // For better view area
29+
// }
2830
}
2931

3032
protected getWebviewOption(): ILeetCodeWebviewOption {
@@ -134,10 +136,10 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
134136
}
135137
}
136138

137-
private async hideSideBar(): Promise<void> {
138-
await commands.executeCommand("workbench.action.focusSideBar");
139-
await commands.executeCommand("workbench.action.toggleSidebarVisibility");
140-
}
139+
// private async hideSideBar(): Promise<void> {
140+
// await commands.executeCommand("workbench.action.focusSideBar");
141+
// await commands.executeCommand("workbench.action.toggleSidebarVisibility");
142+
// }
141143

142144
private parseDescription(descString: string, problem: IProblem): IDescription {
143145
const [

0 commit comments

Comments
 (0)
0