Workbench
Workbench copied to clipboard
Refactor languages support
See https://github.com/sonnyp/Workbench/issues/17
In https://github.com/sonnyp/Workbench/pull/38 - we added Vala support
It was done quickly and with the least possible changes to prove the case. However, adding new languages shouldn't require fiddling in multiple JS files – let's refactor to make it simpler and scale.
JS API should probably be something like
const my_favorite_lang = Language({
compile_cmd: ...,
extension: '.rs',
run_cmd: ...
name: 'Rust',
id: 'rust',
format_cmd:
bookmarks: []
});
and that's all there would be to do in JS side
I would have the compilation handled by a js function that is passed to the object, and that also submits the compiled binary/whatever to the previewer themself. That is why it should also have access to the Previewer js instance with the convenience functions of submitting the dbus commands. That should be controlled by the language, because each language could do something different. The Vala "compiler" would send a loadable module to the previewer, whereas the python "compiler" would send the python code as a string to the previewer probably, which would be a different dbus method.
Also the sourceview highlighting type "xml" or "blueprint", etc. should be given to Language().
Any chance this could have gtk-rs support?
Yes, if someone is willing to commit to implement Rust support , I'm happy to do the refactor work soon.
python would be really nice as well. I would happily help implement it