enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.34k stars 321 forks source link

Pasting a link with a query string argument into the IDE gets displayed weirdly. #7119

Open jdunkerley opened 1 year ago

jdunkerley commented 1 year ago

image If you paste a URL into a node it splits on the first = and then only shows the bit to the right.

Likewise, if multiple parts reformats oddly. image

farmaazon commented 1 year ago

It splits, because IDE always assumes you want to paste the code, not literal. Having = in the code we assume the left part is variable name/pattern, and the right is the actual node's code.

And https://finance.yahoo.com/quote/SHEL.L/history?p=SHEL.L might be a valid (at least parsable) Enso code!

The question is how IDE could deduce when user wants to paste code, and when something else?

somebody1234 commented 1 year ago

I guess the intended solution is to have basic heuristics to detect certain special strings? e.g. checking for https?:// to detect links, and (say) checking for { or [ to detect JSON (if that's even useful)

wdanilo commented 1 year ago

I think we should do more here. How often people will paste Enso code and how often they will paste something just copied from somewhere? I believe that the later will be way more frequent. I believe that we should paste things by default as strings and treat them as code only if there is metadata in the clipboard telling that this is actually Enso code. This metadata should be there when copying code from Enso nodes or from our documentation. If this clipboard metadata is missing, the thing should be just pasted as "interpreted string". The term "interpreted" is not nicely specified yet, but, for example, if someone pastes URL, we might want in the future to immediately create fetch node. If someone pastes Excel content, we should create a table input and put it there. In the first step, however, I would just paste that as string if no metadata that this is Enso code exists. How does it sound to everyone?