Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide several hints for better user experience #293

Merged
merged 9 commits into from
Apr 28, 2019
Merged

Conversation

Vigilans
Copy link
Contributor

Introduction

Uniform hint settings:
image

Demonstration

  1. Config WebView Markdown
    Shown upon any webview revealed:
    image

  2. Comment Description
    Shown upon code file opened:
    image

  3. Command Shortcut
    Shown upon submission webview revealed:
    image

NOTE

User experience could be more better for the future update of vscode:

When executing workbench.action.openSettings command, it can receive arguments as search query, making the hint able to guide the users directly to the specific configs:
microsoft/vscode#72352
microsoft/vscode@e5c1c22#diff-dfd9031c00a144c2364595f331243744

Query as args when opening Keybindings Editor is underway:
microsoft/vscode#72878

@Vigilans Vigilans added this to the 0.14.1 milestone Apr 26, 2019
@Vigilans Vigilans requested a review from jdneo April 26, 2019 12:42
@Vigilans Vigilans modified the milestones: 0.14.1, 0.14.0, 0.14.2 Apr 27, 2019
@jdneo jdneo mentioned this pull request Apr 27, 2019
"commentDescription",
'You can generate problem description as comment in the solution code file by enabling "leetcode.showCommentDescription".',
"Open configuration",
(): Thenable<any> => vscode.commands.executeCommand("workbench.action.openSettings", "leetcode.showCommentDescription"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can wrap a method for opening the setting, like

openSettingView(section?: string)

"commandShortcut",
'You can configure custom key bindings with "test", "submit" or any other command in Preferences > Keyboard Shortcuts.',
"Open Keybindings",
(): Thenable<any> => commands.executeCommand("workbench.action.openGlobalKeybindings", "leetcode solution"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same above, wrap a method, like openKeyBindingView(section?: string)

@@ -57,6 +58,20 @@ export async function promptForSignIn(): Promise<void> {
}
}

export async function promptHintMessage(config: string, message: string, choiceConfirm: string, onConfirm: () => Thenable<any>): Promise<void> {
if (getWorkspaceConfiguration().get<boolean>(`hint.${config}`)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pass the entire hint.${config} to the method instead of only the ${config} itself since we may have other setting section in the future.

Copy link
Member

@jdneo jdneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just some wording issue.

@@ -120,6 +118,12 @@ async function showProblemInternal(node: IProblem): Promise<void> {
await Promise.all([
vscode.window.showTextDocument(vscode.Uri.file(filePath), { preview: false, viewColumn: vscode.ViewColumn.One }),
movePreviewAsideIfNeeded(node),
promptHintMessage(
"hint.commentDescription",
'You can generate problem description as comment in the solution code file by enabling "leetcode.showCommentDescription".',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can generate the code file with problem description in the comments by .....

await vscode.commands.executeCommand("workbench.action.openGlobalKeybindings", query);
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: multiple empty line

private async showKeybindingsHint(): Promise<void> {
await promptHintMessage(
"hint.commandShortcut",
'You can configure custom key bindings with "test", "submit" or any other command in Preferences > Keyboard Shortcuts.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can customize the shortcut key bindings in Preferences > Keyboard Shortcuts.

@jdneo jdneo merged commit cfed70a into master Apr 28, 2019
@jdneo jdneo deleted the vigilans/hint branch April 28, 2019 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants