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

Does not look up from the current file's directory to find .jsbeautifyrc #875

Closed
sjmpb opened this issue Mar 28, 2016 · 7 comments
Closed

Comments

@sjmpb
Copy link

sjmpb commented Mar 28, 2016

Description

When the .jsbeautifyrc is in current directory - it works fine. When .jsbeautifyrc is in a parent directory - it does not apply.

Steps to Reproduce

I use the following simple config file. My global config is tab = 2 chars, in the following .jsbeautifyrc config it is 4 chars. When I do beautify (inside .js file) in the same directory where the .jsbeautifyrc is located it apply 4 chars tab as expected. But with the same js file in a subdirectory (where there is no .jsbeautifyrc and no other files at all) it beautifies with 2 chars tab (as in global settings).

{
  "indent_size": 4,
  "indent_char": " ",
  "other": " ",
  "indent_level": 0,
  "indent_with_tabs": false,
  "preserve_newlines": true,
  "max_preserve_newlines": 2,
  "jslint_happy": true
}

I believe it does not look up from the current file's directory to find .jsbeautifyrc in contrast to what is stated in the README.

Thank you for great work on this extension!

@jdcrensh
Copy link
Contributor

I have this same issue. The plugin will only find and use the .jsbeautifyrc file in the user home directory. If it does not exist there, an error is thrown. It does not find the project's own .jsbeautifyrc file.

@Glavin001 Glavin001 added the bug label Mar 30, 2016
@Glavin001 Glavin001 added this to the v0.29.0 milestone Mar 30, 2016
@Glavin001 Glavin001 self-assigned this Mar 30, 2016
@Glavin001
Copy link
Owner

I will be adding many tests to #864 to ensure that the settings are being properly extracted from both package settings and .jsbeautifyrc files. Thank you for making this issue aware to me and providing steps to reproduce.

@sjmpb
Copy link
Author

sjmpb commented Mar 31, 2016

I have to add, that actually I found that it sometimes work and some times not. For example, I have a good .jsbeautifyrc file in the project root, and it does not affect subdir. Then I copy it to the subdir, now it works in that subdir. Till now everything as I wrote in the issue.

But then I delete all .jsbeautifyrc file from project and then copy a fresh new .jsbeautifyrc file (with identical content) into project root - and now it works even in subdirs.

So, it is not a deterministic behavious, or at least not idempotent one. I couldn't figure out the real cause.

@Glavin001
Copy link
Owner

I'd recommend that you take a look at the following functions and see if you can make any changes that fixes this experience for you:

I would be happy to review and merge a pull request that resolves this issue. Thanks!

@Glavin001
Copy link
Owner

Important to everyone experiencing this issue: please provide the debugging information in a Gist as described at https://github.com/Glavin001/atom-beautify/blob/master/ISSUE_TEMPLATE.md#debug
I will be using this information to both debug and ensure thoroughness of my tests. Thank you.

@Glavin001
Copy link
Owner

I have added tests that demonstrate that this feature is working. Please provide your debugging information and I can investigate this further. Thank you.

@Glavin001
Copy link
Owner

Published to v0.29.0

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

3 participants