Open nahuelhds opened 7 years ago
Same here with Atom 1.12.2 on Linux (I don't think the platform is relevant). It seems like every time you select an editor tab atom reapplies its own indentation settings.
I noticed that whatever sindresorhus/atom-editorconfig is doing, it is not affected by Atom's update and when I work on projects with a .editorconfig
file the indentation settings are always respected.
You may want to take a look at how it is applying the settings.
Maybe this is the same as https://github.com/jtokoph/auto-detect-indentation/issues/23, which I filed a few weeks ago. See also https://github.com/atom/atom/issues/13141 which I filed on Atom core.
+1
I'm investigating a fix for this at https://github.com/forivall/auto-detect-indentation/tree/pane-focus-change-fix . I still need to update it so that the indentation is only automatically detected on first open, and then stored in a weak map.
Also, there needs to be coordination with atom-editorconfig, since both packages will load the indentation settings if they have no settings of their own to set. This will override the other's setting, depending on which gets invoked last.
Specifically, https://github.com/jtokoph/auto-detect-indentation/blob/06b3abdf/lib/indentation-manager.coffee#L75 and https://github.com/sindresorhus/atom-editorconfig/blob/6dd0a62d/index.js#L143 conflict with each other.
I'm thinking of: (A): see if everything works fine without manually setting the default settings (B): creating an "editor settings" provider/consumer like with https://github.com/steelbrain/linter, so that both this and editorconfig will provide editor settings, and if one doesn't provide settings, then the consumer tries the next. (C): include the automatic detection directly in editorconfig, and explicitly state that they don't work together.
I tried disabling atom-editorconfig. It doesn’t appear to be related.
Yup, did some more digging, and it's also because https://github.com/atom/atom/blob/18ddcf9/src/text-editor-registry.js#L327 (called by https://github.com/atom/atom/blob/18ddcf9/src/text-editor-registry.js#L154) is run after auto-detect-indentation sets the indentation, and the .
Although, appearances can be deceiving. Editorconfig also does conflict, but the text-editor-registry conflict is more important. So I'll look into the text-editor-registry conflict first.
It could mean monkey patching something in text-editor-registry, and if both editorconfig and auto-detect-indentation would have to make use of a monkey patch, I'd want them to use the same monkey patch. (so I'd still use one of the above solutions)
Or, just delaying after TextEditorRegistry's initialPackageActivationPromise
. I'll have to experiment later.
PS ugh, promise microtask queue. blink's async stack trace is my only hope
A workaround for this issue while it is being addressed:
Save (Ctrl+S) after opening a file.
Saving also triggers indentation detection, and will happen after the promises this way.
I am noticing the same behavior. When I save the file it correctly detects the indentation.
My current workaround is defining language-specific indentations. E.g. in the package settings for language-yaml
and language-json
, I've set Tab Length to 2.
Yesterday I've updated to Atom 1.12.0 and this plugin doesn't work anymore.
I'm on Windows 10 64 bits.
Thanks!