-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Arguments for autofills? #118
Comments
Hi @Krutonium, Thank you for your help |
I came here to suggest something similar. It could be great if one could pass arguments with triggers. Could work like this:
Keyword arguments could work like this:
Lists of arguments would also be useful:
Once again, thank you so much for Espanso! |
Hi @tiktuk, At the moment, the biggest problem is related to the termination character. Let's say I follow your suggestion with something like:
At that point, to use it the user would type something like: which would get expanded into:
Let's say I want to use
because of the space character. To solve this problem, we need a termination character to tell espanso where the arguments end, something like: What if the variable has to include the Those questions need careful evaluation before implementing the feature. I'm welcome to every feedback. Thanks for your help :) |
Another question is: Will this scale? What to do if you wanna implement the same with two variables? Personally I'd suggest some kind of a sed implementation which is more generic and where you have the possibility to replace more than just one variable.
This could end up in something like:
|
But that wouldn't work for multiple arguments, no? Espanso wouldn't know whether the argument or the trigger ended. (Eg. Arguments with spaces could require quotes:
Escape with
With comma? Won't occur often in parameters I would think.
I guess Espanso can't know whether the termination character is coming at some point. Maybe have some max argument length? Another approach would be to have a dialog with text inputs for each argument pop up. Would solve a few of the questions. But increase the amount of platform specific code. And it's also nice to be able to specify everything with text.
Thank you! PS: @timorunge If some generel solution already exists, great! As long as it's easy to write. |
Hey guys, To answer @timorunge:
I see your point. The only thing that concerns me about your solution is the number of characters a user would need to type, as this long syntax would make those expansions potentially slower to use than typing the output directly. I mean, if the user had to type: To answer @tiktuk
Quotes are surely a possible solution but they might make espanso less useful due to the increased verbosity. My main concern is usability here.
Sure, escaping would be the way to go. A good point in favor of
The maximum length can possibly mitigate this problem, though it wouldn't be a definitive solution as many things could go wrong in the meanwhile.
This could be definitely useful for many purposes, but the complexity here is quite high, especially considering the number of different platforms espanso has to support. I've been thinking about this problem for a while. Although it could be possible to include this feature in the current mode operation of espanso, it has many problematic areas that might become very buggy in many situations. I think it could be much better if integrated with the passive mode proposed in #62, as in this case espanso would have a global view of the text to expand and we could employ more powerful parsing techniques. In particular, the user would type something along:
then he would select it with CTRL+A and then double click on CTRL+CTRL (or something else). At this point, espanso would be able to copy the text, analyze it in its entirety, replace it with more sophisticated parsing techniques and then paste the expanded text back in the field. Thanks for your help guys |
That last approach sounds great, @federico-terzi |
What do you think about an regex-approach? (sorry if the rust-regex-syntax differs slightly)
Should give the deserved result for Also, the user can specify the max. length of the arguments via regex-syntax if deserved. Thanks and keep up the great work! |
Hey @Davidf4, Thank you very much for the great feedback. I don't know why but I didn't receive a notification for this message, otherwise, I would have replied earlier. Thanks for your help :) |
Hey, Cheers :) |
For example, if I could do :wttrinberlin it would look up the weather in Berlin and return it to me, while :wttrintoronto would return the weather in Toronto, except that berlin and toronto are not hardcoded options - I would have a script that takes the string after :wttrin and returns the weather for that location.
Possible?
The text was updated successfully, but these errors were encountered: