TryItOnline / tryitonline

The Try It Online family of online interpreters.
https://tryitonline.net
MIT License
539 stars 58 forks source link

tab inserts a tab character in zig which is a syntax error #48

Closed andrewrk closed 6 years ago

andrewrk commented 6 years ago

In zig a hard tab is actually a syntax error. Pressing tab on Try It Online editor inserts a hard tab, whereas in order to be useful it would have to insert 4 spaces instead. Otherwise it will be a lot of cognitive dissonance for users. Is there a way to configure this?

DennisMitchell commented 6 years ago

This cannot be configured at the moment, no.

I wonder how that should work.

  1. A global setting doesn't make a lot of sense, since there are other languages on TIO that require hard tabs.
  2. A per-language setting isn't much better. The preferred way to indent Python 2 code with spaces, but for code golf (still TIO's primary source of traffic), tabs are still useful.
  3. Per-language per-user settings would be cumbersome, especially when switching devices or clearing local storage.

I guess that leaves some shortcut to change the behavior on the fly.

andrewrk commented 6 years ago

I think (2) is strictly an improvement. You can leave Python to be hard tabs to match current behavior, and then other languages (or is it just Zig?) are improved. Trying to resolve the 2 spaces vs tabs with Python is a separate issue than this one.

DennisMitchell commented 6 years ago

Pressing the tab key, while working on Zig or F# code, inserts 4 spaces now.