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

Javascript CCR: Add "anon funk" command #97

Merged

Conversation

chilimangoes
Copy link
Collaborator

JavaScript makes heavy use of anonymous functions passed as parameters to other functions as callbacks and event handlers. The current "function" command in the JavaScript CCR contains a NAME and a semicolon at the end, both of which then need to be deleted. This PR adds an "anon funk" command, which produces the following output, suitable for embedding in a parameter list:

function () {
    |<-- cursor here
}

synkarius added a commit that referenced this pull request Aug 29, 2015
Javascript CCR: Add "anon funk" command
@synkarius synkarius merged commit e7b62e9 into dictation-toolbox:develop Aug 29, 2015
@synkarius
Copy link
Collaborator

This is useful. And well-named. :)

One note about the "NAME" and "VALUE" etc. stuff that you see in a bunch of places in the CCR modules: they're meant to be used with the "fill" command from the navigation module. Their design is taken from VoiceCoder's code templates. (The original VoiceCoder, not voicecode.io.)

So for instance, with the "function" command, you'd do something like: "function fill name terminal format sort" to get:

function sort () {}
             | <--- cursor

I know this template style isn't for everyone, and I think multiple ways to approach the task like the way you've implemented here are an appropriate solution. Once I get that command editor up and running (which won't be easy and will take a while, but still...), the user will be able to just uncheck / edit the commands they don't want.

@synkarius
Copy link
Collaborator

Uh, and whereas your | cursor mark indicates literally where you meant the cursor should be, mine meant "on the line above this", haha. Whoops.

@chilimangoes
Copy link
Collaborator Author

I had originally named it "lambda" but several other languages actually make a distinction between anonymous functions and lambdas, so I renamed it.

Good to know about the fill command, I hadn't seen that yet.

@chilimangoes chilimangoes deleted the pr-javascript-lambda branch November 2, 2015 06:24
@LexiconCode LexiconCode added Documentation Issues related to Documentation New Feature A new feature that is not currently implemented. labels Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to Documentation New Feature A new feature that is not currently implemented.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants