question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing explicit voice command to write private function

See original GitHub issue

Currently the only way to call code_private_function is indirectly via code_default_function (except for R).

This poses a few problems:

  • Python and Scala override code_default_function to call code_public_function. This currently makes it impossible to use their code_private_function implementations without adding a custom voice command.
  • The Java implementation of code_protected_function creates a method without any modifiers, which is confusing.
    • It should insert the protected access modifier, but then there would be no way to insert a method with no access modifiers (i.e. a package-private method, distinct from protected).
    • As a workaround, one can say state protected, pause, then pro funky ..., but this is clearly inconsistent and disrupts the flow.

I would like to propose the following:

  • a new private funky <text> command, which calls code_private_function
  • a new action code_default_static_function, to be called by static funky <text>, can default to calling code_private_static_function
  • a new private static funky <text> command, to replace current usage of static funky <text>

This would allow for:

  • Java: creating methods with all possible access modifiers (including package-private and protected) using the commands in functions.talon
  • TypeScript: creating functions outside methods, whilst still being able to create private methods (see also #824)
  • Python/Scala: actually creating private functions

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
splondikecommented, Jun 16, 2022

This should be covered off by #879 . Closing issue.

1reaction
pokeycommented, Apr 23, 2022

What might be nice is the following:

{user.function_modifier}+ funky <user.text>: user.code_function(function_modifier_list, text)

Then there could be a default implementation

    def code_function(modifier_list: list[str], text: str):
        """Inserts function declaration"""
        formatted_text = actions.user.formatted_text(
            text, settings.get("user.code_function_formatter")
        )
        modifier_string = " ".join(modifier_list)
    
        result = f"{modifier_string} function {formatted_text}"

        actions.user.code_insert_function(result, None)

Individual languages could then override the implementation to look at modifier_list and choose a different formatter / use different template for the function

Definitely a different approach, but figured I’d throw it out there.

It is related to #807

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Voice Control to interact with iPhone - Apple Support
Control iPhone with your voice. Speak commands to perform gestures, interact with screen elements, dictate and edit text, and more.
Read more >
Speech, voice activation, inking, typing, and privacy
Learn more about the privacy settings for speech, voice activation, inking, and typing in Windows.
Read more >
Troubleshoot Voice Access - Android Accessibility Help
If Voice Access doesn't recognize your voice commands, try the following: Make sure that your device is connected to the Internet over cellular...
Read more >
SENG 440: Lecture 16 – Camera, Part 2 - teaching machines
We will allow the user to advance the day by speaking “next” or “previous.” This feature will be an artificial appendage for our...
Read more >
Klymaxx - Private Party - YouTube
Best of Klymaxx: https://goo.gl/QEYkmTSubscribe here: https://goo.gl/2vDd9jMusic video by Klymaxx performing Private Party.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found