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

Implement :wa[ll] command (write all) #671

Merged
merged 2 commits into from
Sep 7, 2016

Conversation

mleech
Copy link
Contributor

@mleech mleech commented Aug 30, 2016

Implements a basic :wa[ll] command (http://vimdoc.sourceforge.net/htmldoc/editing.html#:wall)
It currently just triggers vscode's workbench.action.files.saveAll command, so the bang version (wa!) doesn't overwrite readonly files.

Yay! We love PRs! 🎊

Please include a description of your change & check your PR against this list, thanks:

  • Commit message has a short title & issue references
  • Each commit does a logical chunk of work.
  • It builds and tests pass (e.g gulp tslint)

More info can be found by clicking the "guidelines for contributing" link above.

@johnfn
Copy link
Member

johnfn commented Aug 30, 2016

Is this a WIP? I still see some TODO comments.

@mleech
Copy link
Contributor Author

mleech commented Aug 31, 2016

@johnfn I think it is useful in it's current form as partial implementation of :wa (at least it'd be useful for me 😃 :wa is ingrained in my muscle memory). The TODOs are more to call out what's missing re mimicking Vim fully. I'm a bit of a vscode noob so I'm not sure if they're possible with the current API.

}

async execute() : Promise<void> {
// TODO : ignore untitled documents
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 access textEditor.document.isUntitled to see if it's untitled.

@rebornix
Copy link
Member

Two tiny comments and all others are good to me.

@johnfn
Copy link
Member

johnfn commented Sep 3, 2016

LGTM; however ping @markrendle about @rebornix's comment about EOF. And can you bring this up to date with master?

@mleech
Copy link
Contributor Author

mleech commented Sep 3, 2016

Thanks @johnfn, it should be now up to date with master.
Also, I found the vscode.workspace.saveAll(includeUntitled: boolean) function in the vscode namespace, so I'm using that instead as it's cleaner and handles ignoring the untitled files.
Re @rebornix's EOF concern in the parsing code - that code is copied from the quit command and seems to be working. The call to scanner.next() doesn't get hit unless there are characters after the main command (:wa or :wall) so the call should always return something other than EOF.

@rebornix
Copy link
Member

rebornix commented Sep 5, 2016

@mleech I see, thanks for helping understand the code better :) LGTM as well. Rebase the code and let's ship it!

@jpoon jpoon merged commit 7b24b7c into VSCodeVim:master Sep 7, 2016
@jpoon
Copy link
Member

jpoon commented Sep 7, 2016

Thanks @mleech. I realized following the merge a better name for the class/filename may be writeall such that it follows suit with the others.

@mleech
Copy link
Contributor Author

mleech commented Sep 7, 2016

@jpoon yeah you're right, it would be a better name. I mistakenly thought all the other classes/files were named after the long version of the vim command - hence wall. I'll try and fix it up when I get some spare time.

This pull request was closed.
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.

4 participants