Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Thanks for [@yihong0618](https://github.com/yihong0618) provided a workaround wh
| `leetcode.enableStatusBar` | Specify whether the LeetCode status bar will be shown or not. | `true` |
| `leetcode.editor.shortcuts` | Specify the customized shortcuts in editors. Supported values are: `submit`, `test`, `star`, `solution` and `description`. | `["submit, test"]` |
| `leetcode.enableSideMode` | Specify whether `preview`, `solution` and `submission` tab should be grouped into the second editor column when solving a problem. | `true` |
| `leetcode.editorSideBySideSplit` | Specify the split layout when opening a problem file. Supported values are: `problem-left` or `problem-right` (preview on the left, problem file on the right). | `problem-left` |
| `leetcode.nodePath` | Specify the `Node.js` executable path. for example, C:\Program Files\nodejs\node.exe | `node` |
| `leetcode.showCommentDescription` | Specify whether to include the problem description in the comments | `false` |
| `leetcode.useEndpointTranslation` | Use endpoint's translation (if available) | `true` |
Expand Down
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,20 @@
"scope": "application",
"description": "Determine whether to group all webview pages into the second editor column when solving problems."
},
"leetcode.editorSideBySideSplit": {
"type": "string",
"default": "problem-left",
"scope": "application",
"enum": [
"problem-left",
"problem-right"
],
"enumDescriptions": [
"Problem file on the left, preview on the right",
"Preview on the left, problem file on the right"
],
"description": "Determine the side-by-side split layout when opening a problem file."
},
"leetcode.nodePath": {
"type": "string",
"default": "node",
Expand Down
4 changes: 3 additions & 1 deletion src/commands/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,14 @@ async function showProblemInternal(node: IProblem): Promise<void> {

const descriptionConfig: IDescriptionConfiguration = settingUtils.getDescriptionConfiguration();
const needTranslation: boolean = settingUtils.shouldUseEndpointTranslation();
const editorSplit: string = leetCodeConfig.get<string>("editorSideBySideSplit", "problem-left");
const problemViewColumn = editorSplit === "problem-left" ? vscode.ViewColumn.One : vscode.ViewColumn.Two;

await leetCodeExecutor.showProblem(node, language, finalPath, descriptionConfig.showInComment, needTranslation);
const promises: any[] = [
vscode.window.showTextDocument(vscode.Uri.file(finalPath), {
preview: false,
viewColumn: vscode.ViewColumn.One,
viewColumn: problemViewColumn,
}),
promptHintMessage(
"hint.commentDescription",
Expand Down
7 changes: 5 additions & 2 deletions src/webview/leetCodePreviewProvider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) jdneo. All rights reserved.
// Licensed under the MIT license.

import { commands, ViewColumn } from "vscode";
import { commands, ViewColumn, workspace } from "vscode";
import { getLeetCodeEndpoint } from "../commands/plugin";
import { Endpoint, IProblem } from "../shared";
import { ILeetCodeWebviewOption, LeetCodeWebview } from "./LeetCodeWebview";
Expand Down Expand Up @@ -31,9 +31,12 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
viewColumn: ViewColumn.One,
};
} else {
const editorSplit: string = workspace.getConfiguration("leetcode").get<string>("editorSideBySideSplit", "problem-left");
const previewViewColumn = editorSplit === "problem-left" ? ViewColumn.Two : ViewColumn.One;

return {
title: "Description",
viewColumn: ViewColumn.Two,
viewColumn: previewViewColumn,
preserveFocus: true,
};
}
Expand Down