-
Notifications
You must be signed in to change notification settings - Fork 161
New Plugin: Text Formatter #485
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
Conversation
|
After testing your plugin, it seems to decide not to respond in the case of an error. If this was an explicit design decision, could you please share your reasoning? If not, could you please send a notification with an error instead of ignoring it? Lastly, unless I'm missing something, your description seems a little misleading.
No matter what my clipboard contains, the only options I get are to change the case, convert between decimal and binary, join lines w/o a delimiter, and escape quotes. I don't see how these options have much to do with json or csv, they seem to just be general text "formatting" in the scope of programming. |
Co-authored-by: cibere <[email protected]>
|
Hi @cibere, This is indeed an explicit design decision, because in future updates I'll be adding the ability for users to create their own custom scripts and if the user encounters an error, Flow Launcher's error system makes it easier to read the exception and help the user debug their script. And yes, the description of my plugin at this stage of development is not accurate, it will do this kind of thing in the future. I've modified the description for now, for a better description. "Description": "Retrieve text from the clipboard and edit it using several custom scripts" |
I see. Though as far as I could tell, the errors were being ignored and not sent to flow's error system. The only sort of logs that I can find regarding it are in flow's log file itself, which just says:
thank you for editing it. Once this plugin is done, and custom script support is added, I look forward to how useful it will be :) |
|
Hi @cibere, Thanks for your reply, I'll be updating my plugin for custom scripts soon and adding more built-in scripts. By the way, I don't know if I've understood what errors you're referring to, are you talking about script loading errors (metas, name, etc.) and script execution errors (code, context) or are we talking about something else? Then I'd like to manage the errors as well as possible for future users but according to the documentation my only options would be:
I'm not against these solutions, but would there be a way like the error popup displayed by Flow Launcher? I thank you in advance for your answer and for your participation in maintaining this beautiful tool that is Flow Launcher. |
I believe they are script execution errors, however I'm not sure about anything else since the plugin is suppressing them.
With JSON-RPC plugins, flow will display the error message if a plugin raises/throws an error that never got handled (thus why I said that your plugin must be suppressing them). I'm not very familiar with js/ts, so perhaps @Yusyuriv can help with identifying how the errors are getting supressed. |
Thank you for your fast reply. Could you tell me what modification you made to one of my scripts to get an error, or is it an error without having done anything? |
|
Sorry, I'm not very familiar with they way JSON-RPC works, but don't you suppress all script errors here? run(context: ScriptExecution) {
vm.createContext(context);
try {
this.vmScript.runInContext(context);
} catch (e) {
console.error(`Error in VM Script execution: ${e}`);
}
}What if you remove this try..catch? |
|
Hi @Yusyuriv, The try {
let script: string = fs.readFileSync(path).toString();
let meta = stringRange(script, metaStartTerm, metaEndTerm);
let jsonMeta = JSON.parse(meta) as Metas;
let scriptObject = new Script({
script: script,
parameters: jsonMeta,
builtIn: true
});
this.scripts.push(scriptObject);
} catch (e) {
console.error(`Unable to load ${path}, Error: ${e}`);
}
}But as I said before, it will just display the error as a |
There is, and you can see that yourself by throwing an error at the start of your program in your main file. something in your code is suppressing the errors that get raised elsewhere in your code.
Alright. let me know when you are finished |
|
Hi, I've updated my plugin for better error handling + support for user scripts. (sorry for the delay I've been quite busy) |
|
Thank you for the work that you've put into this plugin |
Source: https://github.com/Koalhack/Flow.Launcher.Plugin.Formatter
Preview: https://github.com/user-attachments/assets/8f09e6cb-43d0-4595-bac1-79d079f7a0f2