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

Tabs are replaced with spaces in Makefile #42

Closed
asbjornu opened this issue Jan 27, 2016 · 10 comments
Closed

Tabs are replaced with spaces in Makefile #42

asbjornu opened this issue Jan 27, 2016 · 10 comments
Labels

Comments

@asbjornu
Copy link

As mentioned in atom/language-make#3, I'm having problems with tabs being replaced with spaces in a Makefile. As this causes the Makefile to stop working, it's a rather big problem. I've identified the tabs-to-spaces package as the perpetrator. I've tried to adjust my configuration to:

"*":
  "tabs-to-spaces":
    "onSave": "untabify"
"Makefile":
  "tabs-to-spaces":
    "onSave": "tabify"

But the "Makefile" section seems to be ignored. Tabs are still replaced with spaces in my Makefile. Is my configuration invalid?

@asbjornu asbjornu changed the title Tabs are replaced in Makefile Tabs are replaced with spaces in Makefile Jan 27, 2016
@lee-dohm
Copy link
Owner

Yes, your configuration is invalid. In order to manually add language-specific configuration, also called scope-specific configuration, you need the "scope name" of the language you want to configure. In this case, the scope name for Makefiles is .source.makefile. This information can be found in the settings page for the language package in question:

source-makefile

If you change your configuration to look like this:

"*":
  "tabs-to-spaces":
    "onSave": "untabify"
".source.makefile":
  "tabs-to-spaces":
    "onSave": "tabify"

it should work. Let me know if that doesn't help!

@asbjornu
Copy link
Author

@lee-dohm Awesome, that did indeed do the trick! I've never seen that "Scope" before. Thanks for pointing it out! It's almost as I feel like "tabs-to-spaces" should add the untabify configuration for Makefiles by default, or at least mention it in the documentation. Thoughts?

On to something else, I noticed that tabs within a line, to align something like Markdown references, aren't replaced. Such as:

[edit]:             https://help.github.com/articles/editing-files-in-your-repository/
[github]:           https://github.com/signup/free

Is that intentional, so "tabs-to-spaces" should only replace indentation at the start of the line?

@lee-dohm
Copy link
Owner

I feel like "tabs-to-spaces" should add the untabify configuration for Makefiles by default, or at least mention it in the documentation. Thoughts?

I specifically default onSave to off so that people can configure it how they like themselves. If I mentioned Makefiles in the documentation, it would create implicit expectations for me to warn of any special exceptions. I'm not sure I want to take on the maintenance burden. I'll consider it though.

"tabs-to-spaces" should only replace indentation at the start of the line?

Yes, the tabs-to-spaces package was designed specifically for altering leading indentation. Atom itself has commands for converting all indentation on a line.

@asbjornu
Copy link
Author

@lee-dohm Thanks!

@flying-sheep
Copy link

actually you should probably just hardcode this for makefiles.

space-indented makefiles are always wrong, and it’s easy to configure your package in a way that makes this bug appear.

@lee-dohm
Copy link
Owner

actually you should probably just hardcode this for makefiles.

As I said above, the onSave functionality defaults to off. This complies with the common "safe by default" axiom. If people want to change from the default configuration then it is up to them to understand their own requirements and set their configuration accordingly. I'm not going to force a setting which can have significant performance implications to on.

@flying-sheep
Copy link

I'm not going to force a setting which can have significant performance implications to on.

why do you assume this might be the case?

@lee-dohm
Copy link
Owner

why do you assume this might be the case?

Why do you assume and imply that the author of the package doesn't know the performance characteristics of their own creation?

@flying-sheep
Copy link

flying-sheep commented Feb 26, 2017

because having intuition about performance of complex software is hard 😄

but yeah, you don’t want that, and i don’t use this plugin so i don’t need to lobby for adding the feature 😉

@lee-dohm
Copy link
Owner

Yes, but making decisions based on data is much, much easier 😀

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

No branches or pull requests

3 participants