Added: : to start Command Palette Support - #199
Conversation
: to started Command Palette Support: to start Command Palette Support
aioutecism
left a comment
There was a problem hiding this comment.
Cloud you lint the code with tslint?
I'm noticing a lot missing semicolons. They won't hurt much but let's follow the good practice.
| return commands.executeCommand('workbench.action.gotoLine'); | ||
| static async command(): Promise<void> { | ||
| // this is undefined | ||
| return await CommandLine.PromptAndRun(); |
There was a problem hiding this comment.
This seems redundant.
Shall we move src/CommandLine/ to src/Actions/CommandLine/ and use it directly like this?
{ keys: ':', actions: [ActionCommandLine.prompt] }
| if (!vscode.window.activeTextEditor) { | ||
| return | ||
| } | ||
| let text = '' |
| } | ||
| return await CommandLine.Run(cmd); | ||
| } catch (e) { | ||
| console.log(e) |
There was a problem hiding this comment.
Shall we use console.error to indicate that something went wrong?
| { keys: 'z R', actions: [ActionFold.unfoldAll] }, | ||
|
|
||
| { keys: ':', actions: [ActionCommand.goToLine] }, | ||
| // { keys: ':', actions: [ActionCommand.goToLine] }, |
There was a problem hiding this comment.
We can just delete lines we don't need in the future.
| @@ -0,0 +1,4 @@ | |||
| export abstract class CommandBase { | |||
| protected name: string; | |||
There was a problem hiding this comment.
I don't see the use of name anywhere in this Pull Request.
Is it necessary?
There was a problem hiding this comment.
It's not necessary 😂
| qall: QuitAllCommand, | ||
|
|
||
| wq: WriteQuitCommand, | ||
| writequit: WriteQuitCommand, |
There was a problem hiding this comment.
writequit is not a Vim command.
There was a problem hiding this comment.
Don't mind. I like the idea though 😄.
| vs: VisualSplitCommand, | ||
| vsp: VisualSplitCommand, | ||
| sp: VisualSplitCommand, | ||
| split: VisualSplitCommand, |
There was a problem hiding this comment.
sp and split are for the horizontal split. VSCode doesn't support this right now.
There was a problem hiding this comment.
VSCode should support horizontal split now
| sp: VisualSplitCommand, | ||
| split: VisualSplitCommand, | ||
| vsplit: VisualSplitCommand, | ||
| ne: NewFileCommand, |
| ne: NewFileCommand, | ||
| vne: NewFileCommand, | ||
| new: NewFileCommand, | ||
| vnew: NewFileCommand |
There was a problem hiding this comment.
vne and vnew should create the new file in a vertically split pane.
| export function parser(input: string): CommandBase | undefined { | ||
| if (commandParsers[input]) { | ||
| return commandParsers[input] | ||
| } else if (isNumber(input)) { |
There was a problem hiding this comment.
I think we should use Number.isInteger here.
There was a problem hiding this comment.
The type of input is string, so if you just use Number.isInteger(input) will get false. While I can add it in the isNumber function to detect if the input is an interger
aioutecism
left a comment
There was a problem hiding this comment.
Cloud you lint the code with tslint?
I'm noticing a lot missing semicolons. They won't hurt much but let's follow the good practice.
|
Thanks for the reply! I'll fix them ASAP. |
|
All the new files have been tested by tslint 😁~ |
| const lineNumber = Number(line); | ||
| let editor = vscode.window.activeTextEditor; | ||
| if (editor) { | ||
| ActionMoveCursor.byMotions({ |
| import * as vscode from 'vscode'; | ||
| import { CommandBase } from './Base'; | ||
|
|
||
| class QuitCommand extends CommandBase { |
There was a problem hiding this comment.
Shouldn't this be QuitAllCommand?
| async execute(): Promise<void> { | ||
| await VisualSplit.execute(); | ||
| await NewFile.execute(); | ||
| await vscode.commands.executeCommand('workbench.action.closeOtherEditors'); |
There was a problem hiding this comment.
This may have unwanted effects when we execute the command in the third column.
We can use workbench.action.files.newUntitledFile then workbench.action.moveEditorToNextGroup.
| import WriteAllCommand from './WriteAll'; | ||
| import QuitAllCommand from './QuitAll'; | ||
|
|
||
| class WriteQuitCommand extends CommandBase { |
There was a problem hiding this comment.
And this should be WriteQuitAllCommand.
| export function parser(input: string): CommandBase | undefined { | ||
| if (commandParsers[input]) { | ||
| return commandParsers[input]; | ||
| } else if (isNumber(input)) { |
There was a problem hiding this comment.
Since this is a simple expression, we cloud use Number.isInteger(Number(input)) directly.
|
I can fix above now, just wait for a moment~ |
|
Done 😀 |
|
Thank you for your contribution! |
|
Can't wait for it! Thank you for your nice job! |
|
@aioutecism I think you can change the |
|
Published 1.26.1. |

After reading the source code of the project and the VSCodeVim, I try to add
:to startCommand PaletteSupport.Now I have finished some of the vim commands in
Command Palette:Here are some screenshots:
:::wq:vs:newI hope that my contribution can help you! If you think it can be merged, you can remove the line in your readme:
Thank you for your nice project!