Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use atom editor settings for indentation level #50

Closed
Frozenfire92 opened this issue Jul 23, 2014 · 3 comments
Closed

Use atom editor settings for indentation level #50

Frozenfire92 opened this issue Jul 23, 2014 · 3 comments

Comments

@Frozenfire92
Copy link

Currently you use the specific beautifiers settings (ie js is 2) when my editor is set to 4

@Glavin001
Copy link
Owner

+1
image

@Glavin001
Copy link
Owner

I was going to fix this when I realized that the code is already in place:

var editor = atom.workspace.getActiveEditor();
var isSelection = !!editor.getSelectedText();
var softTabs = editor.softTabs;
var tabLength = editor.getTabLength();
var editorOptions = {
'indent_size': softTabs ? tabLength : 1,
'indent_char': softTabs ? ' ' : '\t',
'indent_with_tabs': !softTabs
};

This will correctly pull the the editorOptions and use them as the base. What I believe is really happening is that they are being overridden, intentionally, by the atom-beautify package settings.
The order can be found here:

// All of the options
// Listed in order from default (base) to the one with the highest priority
// Left = Default, Right = Will override the left.
var allOptions = [
editorOptions, // Atom Editor
configOptions, //
homeOptions, // User's Home path
projectOptions // Project path
];

So in the end, I suppose you can say, this is actually intentional and expected because of the order of precedence with the configuration options. There's nothing I can really do because it is truly working as expected: the more specific and ideally accurate variables set in the atom-beautify package settings will always override the options of the editor and I could simply re-order it such that the editor settings have higher priority however they really do not. I want the atom-beautify package settings to take precedence.

I will look into potentially having the default (unset) values for the atom-beautify package settings to be the equivalent of the editor's settings. That'd be a good solution 👍

@Glavin001 Glavin001 self-assigned this Aug 4, 2014
@Glavin001
Copy link
Owner

I can retrieve the value with atom.config.get('editor.tabLength'). However, it is unlikely that I will resolve this as the atom-beautify settings has settings for each supported language and should be used and enforced in these cases. Thanks for bringing this to my attention though. For now, use the package settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants