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

Behavior according to global brackets.json preferences file #10

Closed
glepretre opened this issue Mar 26, 2015 · 8 comments
Closed

Behavior according to global brackets.json preferences file #10

glepretre opened this issue Mar 26, 2015 · 8 comments

Comments

@glepretre
Copy link

Hi,

I'm currently trying your extension and have a question about the preferences.

I understand I can define a project specific .brackets.json file at the project directory root, but can I use a global path rule in the classic brackets.json preferences file?

My use case is about Makefile(s): since it only support tabs as indent, I would like to turn off the sanitizer and use tabs for these files only.

Here's what I've tried in my brackets.json:

{
    "brackets-wsSanitizer.enabled": true,
    "path": {
        "Makefile": {
            "brackets-wsSanitizer.enabled": false,
            "useTabChar": true
        }
    }
}
@MiguelCastillo
Copy link
Owner

Yup, it should work with global preferences as well. If you encounter issues, please let me know.

@glepretre
Copy link
Author

Yes, I can confirm that with only your extension + brackets-show-whitespace, with the config given above, it does not work for me. No errors in DevTools. 😏

Do you think it could be because the path "Makefile" has no extension? I have also tried "**/*/Makefile".

@MiguelCastillo
Copy link
Owner

Hey thanks for reporting back :) i will take a look in a moment to see how we can get this to work

@MiguelCastillo
Copy link
Owner

@glepretre I just tried your use case and you are correct. the preference are not taking effect coming from the global brackets.json. The reason is that PathLayer only applies to project settings. https://github.com/adobe/brackets/wiki/Preferences-System#preferences-system-basics

Let me take a closer at how we can get this to work.

@glepretre
Copy link
Author

@MiguelCastillo Does that mean I am using the preferences system in a wrong way? I'm not sure to understand fully 😄

@MiguelCastillo
Copy link
Owner

@glepretre Sorry I completely forgot about this issue. So, unfortunately brackets preferences system does not allow configuring preferences for particular files in the global preferences file (user preferences). At the current time, I don't think I can add this feature... But I am happy to take a PR to add more functionality for this though :)

@glepretre
Copy link
Author

Ok, thanks for having taken the time to investigate this. 😉 So the solution is to overload the global preferences with a local brackets.json in each directory needing it?

@MiguelCastillo
Copy link
Owner

So I ended up adding support for the language layer so that you can specify whether or not a document should be sanitized on the file type. But this only gets so far because Makefiles are not really a document type in Brackets. I would like to create a small extension to allow defining languages via configuration... You can take a look here.

So my suggestion for your particular problem is to map Makefile as a supported type. Say, bash... Then specify a language rule for bash to configure your Makefiles. E.g.

{
    "language": {
        "bash": {
            "useTabChar": false,
            "tabSize": 4,
            "spaceUnits": 4,
            "brackets-wsSanitizer.enabled": false,
            "brackets-wsSanitizer.onopen": true
        }
    }
}

The reason to map Makefiles as bash is so that you can specify sanitizer settings for bash which will then apply to Makefiles. Otherwise you will need to define a language via code as explained here.

I hope this helps! :)

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

No branches or pull requests

2 participants