atom / language-css

CSS package for Atom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSS files don't auto indent when 'language-source' package is disabled

opened this issue · comments

Prerequisites

Description

When Atom's core language-source package is disabled, auto indent in .css files no longer works.

Steps to Reproduce

  1. (Optional) Reset to factory defaults to start with a clean slate.
  2. (Optional) Start Atom in safe mode for an even cleaner slate.
  3. Create a new file and save it as test.css.
  4. Type .test { in your CSS file, then press Enter on your keyboard.
  5. Notice that the new line starts indented (thanks to the enabled-by-default Auto indent setting in the core language-css package).
  6. Go to Edit > Preferences, then click Packages on the left.
  7. Search for source to locate the core language-source package. Disable it.
  8. Go back to your CSS file (no need to restart Atom) and on a new line, repeat step 4.

Expected behavior:

The new line will start indented, as per step 5.

Actual behavior:

The new line is not indented.

Reproduces how often:

100%

Versions

Atom    : 1.38.2
Electron: 2.0.18
Chrome  : 61.0.3163.100
Node    : 8.9.3

apm  2.1.7
npm  6.2.0
node 8.9.3 x64
atom 1.38.2
python 2.7.15+
git 2.17.1

OS: Linux Mint 19.1 Cinnamon

This is clearly a bug, but I'm not sure in what way it's a bug... Either:

  • The language-source package is not required and should be able to be disabled without affecting other packages, or
  • The language-source package is required for other packages to work properly and should either not be disable-able, or should display a warning when disabling advising of potential issues.

language-source is the fallback for all languages, and provides some basic auto-indent rules.
Looks like language-css doesn't provide its own, so the rules in language-source get used instead.

The easy way to fix this would just be to add specialized auto-indent rules to language-css, or even as a temporary workaround copy over the ones from language-source.

OK, that makes sense. In that case, I'd suggest (in addition to your suggestions) that a warning gets added to language-source so people disabling it will know other languages might not work properly.