language-python icon indicating copy to clipboard operation
language-python copied to clipboard

Tab type auto-detection fails when creating a new file

Open Lilalas opened this issue 7 years ago • 2 comments

Prerequisites

  • [x] Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
    • Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
    • Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
    • Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
    • Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

Description

Tab type auto-detection fails when creating a new .py file. Furthermore, the editor always inserts soft tabs regardless of the Soft Tabs setting (specified in Settings → Editor). It only detects hard tabs correctly if I manually paste a hard tab character and then reopen the file.

Steps to Reproduce

  1. Make sure Tab Type is set to auto and Soft Tabs is off (Settings → Editor) and the package-specific settings for language-python are all default

First scenario:

  1. Create a new Python source code file
  2. Press tab to indent the line

~Second scenario:~

~2. Create a new Python source code file 3. Paste Python code that uses hard tabs 4. Press tab to indent a line~

Expected behavior: In the first scenario, I expect the editor to insert a hard tab because there was no other indentation in the document and Soft Tabs is disabled. ~In the second scenario, I expect the editor to automatically detect that the code uses hard tabs and therefore insert a hard tab when indenting a new line.~

Actual behavior: In both scenarios, the editor inserts a soft tab (as if Tab Type was set to soft).

Reproduces how often: Every time.

Versions

$ atom --version
$ apm --version
apm  1.19.0
npm  3.10.10
node 6.9.5 x64
atom 1.28.1
python 2.7.15rc1
git 2.17.1
$ lsb_release -idrc
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic

language-python is on version 0.49.5.

Additional Information

Tab type auto-detection works fine when I disable language-python for Python, or write code in any other language.

Lilalas avatar Jul 08 '18 11:07 Lilalas

I came to realize the second scenario is probably a bug on Atom’s side because it applies to other languages as well—only that they respect my Soft Tabs setting.

Lilalas avatar Jul 09 '18 11:07 Lilalas

@Lilalas This package sets language specific settings, including softTabs to true. To change this, you can open language-python in settings and change the tab type there.

Aerijo avatar Aug 20 '18 23:08 Aerijo