Closed Jopp-gh closed 2 years ago
Tested, osacompile is able to save scripts and even applescript apps.
Therefore you can write back to scripts / save scripts as well. Could you please implement open and save in your vscode plugin ?
Duplicate of https://github.com/idleberg/vscode-applescript/issues/23
The lack of the possibility is probably then main reason, why this package isn't 1.x yet. It's my intent to provide feature parity for my all packages. My Sublime Text, for instance, has been able to open binary AppleScript files for years. I would love to bring this to this VSCode extension, but on the premise that the user experience doesn't break with how you'd normally open a file. Typically, a user would click on a binary AppleScript file in the VSCode sidebar or open it in the editor through a file manager or the terminal. However, VSCode will block binary files as soon as it detects them. There is no “onLoad” callback that allows transforming the file before displaying it in the editor. IIRC, such a callback only exists when saving the file. Years ago, I posted a feature request on the VSCore repository which has been ignored ever since.
Just use simply "osadecompile /path/to/file.scpt > path/to/test.txt | open -a VsCode path/to/test.txt"
While this works, it feels like a workaround that breaks the user experience I described above. I'm sure you can achieve this through a VSCode task.
Yes, i found a valid workaround, your plugin needs only to register the path to the original, so saving back to the original wouldn't be a problem
nobody cares about a technical detail if the file in edit mode is text or whatever as long as you can save your progress back to the original. Otherwise the whole process to use an otherwise nice plugin becomes pointless. Important that things work, and just that matters. I guess, the implementation is more a legal thing ? : (
I really enjoy the plugin architecture of vscode and want that environment well. While Sublime is nice, it isn't as powerful as vscode. By all respect but their ad to buy a license pops up all times and i don't like that very much.
Of course i could use the antique "Script Editor" for applescript but honestly, that app so extra bare bones and nothing I'd suggest others to use - maybe as a very last last resort, nothing more
Summary
Ability to open script files with extension (.scpt, .scptd, .app, .sdef)
Motivation
Currently, we can't open script files or applescript apps and their script definition dictionary
Describe alternatives you've considered
I've build a script to open scripts as simple text files
Just use simply "osadecompile /path/to/file.scpt > path/to/test.txt | open -a VsCode path/to/test.txt"
You could implement this code in your plugin, because my script is just a temporary solution
Additional context
Furthermore, I'd like to save my applescript inside vscode, osacompile should be able to save code as script files and script files embedded into applescript apps (.scpt, .scptd, *.app)
Of course, apps need also a xml plist, a script runner, some icon and their folder structure. Maybe you're willing to put app creation on your Roadmap for later?