auto-detect-indentation icon indicating copy to clipboard operation
auto-detect-indentation copied to clipboard

Not working in Atom 1.12.*

Open nahuelhds opened this issue 9 years ago • 10 comments

Yesterday I've updated to Atom 1.12.0 and this plugin doesn't work anymore.

I'm on Windows 10 64 bits.

Thanks!

nahuelhds avatar Nov 11 '16 17:11 nahuelhds

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.

mtorromeo avatar Nov 14 '16 10:11 mtorromeo

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.

mtorromeo avatar Nov 14 '16 10:11 mtorromeo

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.

danfuzz avatar Nov 14 '16 15:11 danfuzz

+1

tofof avatar Nov 15 '16 03:11 tofof

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.

forivall avatar Nov 26 '16 00:11 forivall

I tried disabling atom-editorconfig. It doesn’t appear to be related.

adamshaylor avatar Dec 02 '16 19:12 adamshaylor

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 screen shot 2016-12-02 at 11 53 52 am

forivall avatar Dec 02 '16 19:12 forivall

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.

villermen avatar Dec 09 '16 13:12 villermen

I am noticing the same behavior. When I save the file it correctly detects the indentation.

ddelrio1986 avatar Apr 21 '17 02:04 ddelrio1986

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.

parasyte avatar Sep 20 '17 19:09 parasyte