Skip to content
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

CLI: REPL: <TAB> characters in multi-line mode should be converted to 2 spaces #3913

Open
aleclarson opened this issue Mar 24, 2015 · 8 comments
Labels

Comments

@aleclarson
Copy link

I use tabs instead of spaces in my code. I cannot test snippets of my code if there is indentation, because the multi-line mode reads tabs as if you're pressing the tab key in the terminal; which shows you autocompletion (normally all variables in the global scope because the indentation is always at the beginning of each line).

Is it possible to convert the tabs to double-spaces when I press ⌘+V in multi-line mode?

Thanks.

@michaelficarra
Copy link
Collaborator

We could just disable autocompletion in multiline mode.

@jashkenas
Copy link
Owner

We could just disable autocompletion in multiline mode.

Sounds wise.

@aleclarson
Copy link
Author

I'm surprised this hasn't been brought up before. Am I the only one that uses tabs? 😆

Thanks for the replies, though. 👍

@michaelficarra
Copy link
Collaborator

@aleclarson Nearly all CoffeeScript is written with 2-space indentation. It's just part of the culture.

@jumper444
Copy link

I'm beginning to work with coffeescript and would like to contribute to this topic.
I agree with 'aleclarson' that I'm surprised nobody mentioned this before or it seems like a side thought. I also assert that autocomplete should be turned off during multiline entry. My thoughts and reasoning below:

I'm learning coffeescript and accept per language documentation that it is whitespace agnostic as long as a person maintains either tab or space usage consistently. It's in the spec.

So I get nodejs and coffee running (windows command line). Start working, practicing, etc. A while after starting I realize I want multiline REPL so I search some more to find CTRL-V is the answer.

Ok..great...got that solved...back to the sample tutorials....

I start a multiline; write some code; press enter; get to line 2; press 'tab' and
BOOM!!...my console explodes with two pages of keywords.
wtf?!?

"What's going on? It's supposed to take tabs. "

I know enough of Unix to quickly grasp it's doing an autocomplete.
But I don't want that. I want to enter tabs.
The language should take it, but multiline doesn't.

We all know the arguments for and against tabs as a personal choice, but
I suggest, as above poster, that multiline should have autocomplete turned OFF and take tabs instead. Why?

  1. such formatting is in the language spec. This breaks it.
  2. (important) If a person is pasting in code from another source and THAT person used tabs, then the paste in will blow up. Now I've got to do a convert. (The argument that 'most coffee guys use 2 spaces' is just a way of saying that it usually won't break if we don't allow tabs. But 'usually' isn't how we run computer systems - not intending offense.)
  3. finally a possibly overlooked reason...a person doing multiline (vs single line) is actually LESS likely to be using autocomplete imo...because multiline is not suitable for long extended entries of code...therefore...such entry will usually be occurring in one of two cases (A) paste operation; (B) short entry of code...like me...copying or testing something likely SIMPLE. Neither A or B will need autocomplete as much (I think).

So there are my thoughts and reasoning as a brand new user coming over here and seeing the software from scratch. The autocomplete wasn't expected. It didn't seem to fit. I didn't know what to do with it. And it didn't help me out. Maybe I'm wrong and it becomes more valuable in future, but I don't see the value for now.

@jumper444
Copy link

PS comment: I never did figure out how to be able to enter a tab in multiline. Maybe there is another key combination which inserts it instead.

@jumper444
Copy link

PPS: Not allowing tabs also means that any code I start writing now (as I learn this and start building up an ongoing mass of work) will be forced to be in space-indent notation if I intend to ever even SLIGHTLY enter or test snippets by pasting it in once in a while. Even if I have a larger block of code that I load from a full file it only takes a need to paste 0.01% of the time before I'm essentially forced to choose spaces over tabs (or else everytime I want to do an emergency REPL of something I, again, have to convert.)

@jumper444
Copy link

Two considerations for a fix:

  1. multiline could default to no autocomplete (accept tabs), but have another command to turn it on and off within multiline (just like ctrl-v does for multiline itself); This would still preserve the feature in emergencies.
  2. allowing tabs would then put the developers into the situation of how many spaces EQUALS one tab; flame on again; I would argue that most people who use tabs are doing so, in part, to avoid typing 4 or so spaces each time vs 1 key. Hopefully it won't default to only 2 spaces which doesn't gain much (although paste would still work unlike now.) My vote is for 4. I guess the better permanent solution is a config setting somewhere, but I'd take functioning paste and ANY tab entry over nothing.

@GeoffreyBooth GeoffreyBooth changed the title <TAB> characters in multi-line mode should be converted to 2 spaces CLI: REPL: <TAB> characters in multi-line mode should be converted to 2 spaces May 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants