-
Notifications
You must be signed in to change notification settings - Fork 650
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
Conversation
src/commands/show.ts
Outdated
"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"), |
There was a problem hiding this comment.
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"), |
There was a problem hiding this comment.
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)
src/utils/uiUtils.ts
Outdated
@@ -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}`)) { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
src/commands/show.ts
Outdated
@@ -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".', |
There was a problem hiding this comment.
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 .....
src/utils/uiUtils.ts
Outdated
await vscode.commands.executeCommand("workbench.action.openGlobalKeybindings", query); | ||
} | ||
|
||
|
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
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.
Introduction
Uniform hint settings:
Demonstration
Config WebView Markdown
Shown upon any webview revealed:
Comment Description
Shown upon code file opened:
Command Shortcut
Shown upon submission webview revealed:
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