-
Notifications
You must be signed in to change notification settings - Fork 21
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
Help Browser code evaluation #9
base: main
Are you sure you want to change the base?
Conversation
Hey @elgiano Thanks so much for the RFC! And thank you for the fixes in the PR! Just a little technical note: I think it would be great if you could provide direct link to RFC text in the description (and possibly in the related PR). I was thinking about looking into the help system, too.
|
Thanks @dyfer, I added links at both places! |
Hi @elgiano, thanks for making this, I think making an RFC is the wisest next step. Reading the room, I don't know if I'll have much success pushing my opinion on this, but I'll try. (Also, I know it wasn't my fault, but sorry you got caught in the crossfire in that other thread. I hope the air is clear now.) My stance is: I believe that help browser code evaluation should be removed and replaced with a button that allows copying the contents of the code to the clipboard. Motivation:
Rebuttals to counter-arguments:
Maybe a user survey will help us quantify who would miss this feature if it were removed. I'm envisioning two questions: "Do you execute code from the help browser?" "Would you miss it if it were gone and there was a 'Copy to Clipboard' button instead?" |
Who'd be the one to make a survey? That's certainly more burden for the OP (I believe it is a good idea though). |
@snappizz On to your points:
It would make sense for me to first (or anyway) discontinue code execution in WebViews. The message would be: if you want your WebView to execute code, write a javascript function that returns the code you want to execute. Then hook the js function to a keypress, button or whatever you want, on sclang side, so that you can get that code back and have the interpreter evaluating it. Without WebSockets, there's no other way for a WebView to send a "signal" to sc. About the HelpBrowser SC class, I think it could implement this exact behavior (in fact it is doing that now, and it's fixed by my PR). I believe HelpBrowser is used mainly outside of scide, I don't know how keyboard shortcuts are handled there, but everyone who uses HelpBrowser could define their own. About WebEngine-free installations, what I understand is that to integrate a browser with sclang we need WebSockets. It's not uncommon to write bridge applications, I've seen (and wrote) a few in node/electron, for web pages to send OSC to sclang, or to communicate with the interpreter, and I believe we could start thinking about a native implementation. Then we should talk about implementing WebSockets with or without Qt... I can see that Qt has a WebSocket module, not part of WebEngine, which we could look into for the sake of consistency. --- not so important stuff --- Furthermore, if sc starts using a lot of js, there could be a js library providing some standard functions, like selectCodeBlock() to do parens matching, or others to deal with and eventual sc's native websocket implementation. tl;dr: let's fix it anyway while we decide. Delegate webview code selection to javascript, and webview code execution to users' implementations. A copy button is anyway good to have. |
Hey @elgiano -- thank you for this RFC! i unfortunately haven't had time yet to look at this PR and proposal in detail, but i just wanted to say that i'm glad to see it and glad that the discussion is moving forward. this is a pain point for many people on this project, definitely for myself and @snappizz , and i think you're doing a good job of balancing concerns. i share in Nathan's opinion that at some point, we ought to find some way to reduce the maintenance cost of the help browser, but i also agree that in the short term we can make worthwhile steps toward improving this feature. looking forward to discussing it more! |
Hey, happy to be part of this! But then, that's it (for me, of course). I can imagine that maintaining the javascript part (or even coming up with it in the first place) might have been another huge thing... but I think there is actually some future for it, to live a more independent life, if it will provide easy sc syntax and websocket utilities |
in a nutshell, this area of code has had a lot of bugs in the last 2 years, and this project suffers from a lack of people who know how to solve them well. historically, this is because:
now, IMO it is quite predictable that (2) caused a lot of these bugs we're seeing now. this is not to criticize Scott; on the contrary, i am very grateful, because it was desperately needed and nobody else was able to handle it. however, it was a lot of work for one person to do. while i was reviewing it Scott and i tried to do our best to test everything, but old C++ / JS code written on top of aging APIs is just naturally going to be a bit unstable when you start prodding it that way. |
Summing up a talk during last dev meeting:
Since this process requires careful consideration and a smooth transition ( = a long time if ever :) ), I'm marking my PR as ready for review to fix the current implementation |
One thing to consider is if in this transition, we could get back some of the beauty of the system before it became the one we have now (don't get me wrong, the current system does have great advantages, too!). What was very good at the time when we just had plain I don't know if my comment is productive, but it might be worth considering, since hill down is always the stuff that is well established practice. If there was a wysiwyg-markdown-wiki with a bit of back end to organise the specifics of help files as well, that would be the best I can imagine. |
One small observation, which I offer without taking a strong view on the long term direction of this: Websockets would be a wonderful addition in any case, and could indeed replace a lot of current functionality (doc code execution; bridging to other contexts). One thing that would be lost if WebViews were removed however would be the possibility of integrating browser content directly within sclang GUIs. I'm not sure how big a deal that is, but I do think it's worth being clear about every implication of removal, as that does go beyond just help issues. It might be worth exploring the range of current uses in any survey. |
https://github.com/elgiano/rfcs/blob/helpbrowser/rfcs/0009-helpbrowser-code-evaluation.md