hedy icon indicating copy to clipboard operation
hedy copied to clipboard

[Content] make sure all blanks use the same symbol (and explain it!)

Open thjazi39 opened this issue 2 years ago • 7 comments

Blanks are not recognized on valid lines at levels 1-3: image

This is the opposite of bug #2359, because here the syntax highlighting is not applied, but the interpreter considers that YES, it should be colored (while in the case of bug #2359, it considers that the # should not be colored) image

As a result, the previous code, which is not excutable, cannot give the following result image

thjazi39 avatar Mar 30 '22 15:03 thjazi39

Hi @thjazi39! Thank you for your interests and all the issues you've opened! Regarding this one the current implementation doesn't allow to print blanks, not even on further levels. We preprocess blanks before they're fed to the transpiler (the program that makes Hedy code Python code). Maybe a solution to this is to not detect blanks that are inside a print? But this still leaves the issue that at levels 1-3 we can't distinguish string and vars, so maybe in this case this is actually what we want: you can't print blanks because blanks mean that you need to fill in some code there.

jpelay avatar Mar 30 '22 16:03 jpelay

Hi both!

I would say the highlighter is ok as it is, I consider this a content issue, we are content creators can make sure we don't use blank in that way, kids will never type blanks anyway (of they do, they don't mean them as blanks!)

Felienne avatar Mar 30 '22 18:03 Felienne

Ok, so in that case, I have to correct the syntax highlighting so that the blanks are highlighted? (so that the kids understand where the error comes from)

thjazi39 avatar Mar 31 '22 12:03 thjazi39

Ok, so in that case, I have to correct the syntax highlighting so that the blanks are highlighted? (so that the kids understand where the error comes from)

No, leave this one for now. As I said I consider it a content issue.

The other changes to the highlighter (less overcoloring) are a lot more important, focus on those first

Felienne avatar Mar 31 '22 12:03 Felienne

Just a note to self, currently, both _ and ? are highlighted as blanks:

image

So the issue that remains here is to make sure:

  1. All locations use the same blank and
  2. Explain what it means to users

Felienne avatar Sep 05 '22 09:09 Felienne

I feel the same way, this is not a bug it's a feauture!

On Wed, Mar 30, 2022, 2:30 PM Felienne @.***> wrote:

Hi both!

I would say the highlighter is ok as it is, I consider this a content issue, we are content creators can make sure we don't use blank in that way, kids will never type blanks anyway (of they do, they don't mean them as blanks!)

— Reply to this email directly, view it on GitHub https://github.com/Felienne/hedy/issues/2380#issuecomment-1083477130, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK55RYOLPJIRDGB3LSCU3ADVCSMS7ANCNFSM5SCM75BA . You are receiving this because you commented.Message ID: @.***>

jpelay avatar Oct 11 '22 07:10 jpelay

Just a note to self, currently, both _ and ? are highlighted as blanks:

it's not exactly that, currently only : (^| )(_)(?= |$) and _?_ are recognized

  • we need to escape the question mark because it is a symbol used in regex : https://github.com/Felienne/hedy/blob/ff751661c8457d4ba020e45534b6d720f3b56e61/highlighting/rules_list.py#L34

  • the underscore will be recognized only if there is a space on each side (with cases for the beginning and end of lines) : https://github.com/Felienne/hedy/blob/ff751661c8457d4ba020e45534b6d720f3b56e61/highlighting/rules_list.py#L35

Thus the following strings will not be recognized:

e_e
e_
_e
?_
_?
?
 _  # with insecable space

Note that, in the first 4 levels, because the syntactic highlighting paradigm being different, there are possible interactions with other rules, which can create bugs like this

thjazi39 avatar Oct 11 '22 07:10 thjazi39

Hi @MarleenGilsing!

This seems to be a good one for you. Some places use _ but sometimes in quizzes we also use _?_. It would be nice if we make that the same everywhere. Will be a bit of a boring "checklist" task, sorry :)

Felienne avatar Mar 07 '23 12:03 Felienne