Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Add new editor.tabType scoped setting #3719

Closed
benogle opened this issue Oct 3, 2014 · 20 comments
Closed

Add new editor.tabType scoped setting #3719

benogle opened this issue Oct 3, 2014 · 20 comments

Comments

@benogle
Copy link
Contributor

benogle commented Oct 3, 2014

While digging into scoping editor.softTabs in #3718, it's pretty clear that the setting has very little influence on the actual value chosen. It's effectively the worst-case fallback: it only works on an empty file.

I propose doing a couple things:

  • adding a new editor.tabType setting that accepts 3 values: Auto, Hard, Soft. With the default being auto. Then in the scoped settings for each language, they can set it to whatever they want.
  • Changing TextEditor::setSoftTabs to being a settings override accepting 4 values: unset / use-the-settings, Auto, Hard, Soft
  • Reading the settings on each time we need to get the tab type. Something like (pseudo code):
getTabType: (scopeDescriptor) ->
  @userTabTypeOverride or atom.config.get(scopeDescriptor, 'editor.tabType') or atom.config.get(scopeDescriptor, 'editor.softTabs') or 'soft'

See

@softTabs = @usesSoftTabs() ? @softTabs ? atom.config.get('editor.softTabs') ? true
and
buildIndentString: (number, column=0) ->
for reference.

Refs

Comment if you know of more issues, complaints. I know there have been several complaints about this, but cant find issues.

@benogle
Copy link
Contributor Author

benogle commented Oct 8, 2014

Thanks @lee-dohm that's exactly what I was looking for.

@benogle
Copy link
Contributor Author

benogle commented Oct 8, 2014

Removing from the API freeze roadmap as it is not necessary for the api freeze. Will happen shortly after.

@ilanbiala
Copy link

Also please add support for per language soft tabs support somehow.

@jplatte
Copy link

jplatte commented Jan 25, 2015

+1, I would really appreciate a fix!

@remillc
Copy link

remillc commented Jun 10, 2015

+1 This soft tab issue is pretty annoying...

@NioTeX
Copy link

NioTeX commented Jun 17, 2015

👍 We need this

@ScottPeterJohnson
Copy link

👍 Really hard to work in indentation-sensitive languages when suddenly Atom inserts spaces instead of tabs.

@alexandernst
Copy link

Not really sure how such a critical issue didn't make it for 1.0. Shame on Atom for still not being able to manage spaces/tabs

@xaviergmail
Copy link

👍 I find myself having to replace all tabs with spaces and re-open a file to get tab to insert spaces properly, which isn't very intuitive.

@JeffreyVdb
Copy link

This should be made possible language specifically. Most languages have their own coding conventions. This is a critical bug if you ask me.

@pbhogan
Copy link

pbhogan commented Jun 29, 2015

👍 Can't even think of switching to Atom for actual work until this is fixed.

@fedorov
Copy link
Contributor

fedorov commented Jun 29, 2015

+1

1 similar comment
@unRob
Copy link

unRob commented Jun 30, 2015

+1

@thomasjo
Copy link
Contributor

All the +1's only add noise at this point, so I'm locking this issue until someone begins working on it. At that point we may re-open it for discussion purposes.

@atom atom locked and limited conversation to collaborators Jun 30, 2015
This was referenced Jul 20, 2015
Abdillah added a commit to Abdillah/atom that referenced this issue Aug 1, 2015
Behaviour of tabType functions is discussed on issue atom#3719.

Also, introduce userTabTypeOverride variable which hold temporary
user preference on current editor.
@atom atom unlocked this conversation Aug 13, 2015
@jeffmcneill
Copy link

Most reports of issues seem to be closed without resolving the underlying problem. There is only one open I could find (on cursory clicking):

Closed

Open

The big issue as reported is the inaccurate "guessing" combined with the inability for an editor-wide setting (and not per-file setting). It may be that several preferences may be required instead of having one monolithic setting which is clearly causing unhappiness:

  • Default for all files (y/n)
  • Default for certain files (by file extension)
  • Setting on per file basis

The idea would be to be able to re-order these in terms of priority, based on the needs of the user.

@asbjornu
Copy link

asbjornu commented May 7, 2017

I'm with @jeffmcneill on this one; it's still a problem in Atom 1.16.0 and the current settings just doesn't work. The editor-settings package outlines a lot of the functionality I would like to see in Atom wrt. whitespace handling, but it also does not work correctly as it seems to be fighting with Atom on what tab type should be used. Couple that with the whitespace package and you have complete chaos.

I would love to see the current settings, packages and everything related to whitespace wiped from the face of the earth, because it's bug-ridden junk that Just Doesn't Work. Then, I would like to see something implemented along these lines:

  1. A base setting for tab preference that did not try to be smart in any way. Just a clear "hard tab" or "spaces" (the phrase "soft tab" is just confusing; please get rid of it) that perhaps can have a checkbox for "change existing whitespace on save".
  2. A way à la editor-settings to configure tab preference for every language (and/or file type). This should override the previous setting.
  3. Support for EditorConfig. If there's an .editorconfig file in the project file hierarchy that is an ancestor or sibling to the current file, use that to adjust the tab setting of the file. This should override previous settings.

With these three levels all supported within Atom without any packages, I believe it's possible to reach sanity and get rid of a lot of bug-ridden, "intelligent" code that obviously doesn't work and also serve the needs of most people.

@lock
Copy link

lock bot commented Apr 2, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked and limited conversation to collaborators Apr 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests