csscomb / sublime-csscomb

Sublime plugin for CSScomb—CSS coding style formatter
398 stars 61 forks source link

Ability to write CSSComb.js settings right into ST's preferences #6

Closed kizu closed 10 years ago

kizu commented 10 years ago

Right now there is only one way to use CSSComb.js' settings — .csscomb.js file.

However, ST's preferences are, in fact, a .json file, so it is possible to include the CSSComb's settings in it.

This would allow for a really flexible usage of CSSComb, as ST's preferences have a lot of override levels: User's preferences, then Syntax-specific preferences, then Project-specific preferences. Users could use different CSSComb settings for different cases and projects.

This would also just make it easier to start using CSSComb, as you wouldn't need to go anywhere from the ST.

As with anything for ST, I can implement this issue if it is ok to have in this repo.

tonyganch commented 10 years ago

ST's preferences are, in fact, a .json file

.csscomb.json is too.

ST's preferences have a lot of override levels

.csscomb.json is flexible too. You can put several settings files wherever you want and get the same project/user specific settings.

as you wouldn't need to go anywhere from the ST

You can create a text file directly from ST, as far as I know.

Yes, we can store CSScomb's config right in plugin's settings. But why? .csscomb.json is a unified way to store CSScomb's config:

kizu commented 10 years ago

You can put several settings files wherever you want and get the same project/user specific settings.

But not syntax-specific, so if you have .less/.scss code in the project with one codestyle and .css for tests in other one, how would you manage it?

You can create a text file directly from ST, as far as I know.

But this is harder than pressing cmd + , shortcut to bring the ST's User preferences, or calling syntax specific/project specific settings by action, that also could be mapped to a key binding.

I agree that .csscomb.json is better when used with teams, but not everyone work with teams all the time. For those people, who are using ST to its maximum, it is better not to have its own file for every tool they use, but to have everything in ST. They already know how to manage its preferences, how to use overrides etc, they already have project's file included in repo. .csscomb.json file would be just another file in their repo this way. For those people, ST's preferences would be the most similar, fast and overall the best way. And I'll cite you from another issue:

[…] is ok if it helps someone do his/her job faster.

tonyganch commented 10 years ago

No, please, you don't make context-free quotes. Any order is ok if it helps someone do his/her job faster. We've been talking about alphabetical sort order which'd been asked for by several people. Now we're talking about duplicating an existing feature and doing one thing in many different ways.

"For those people", "they"... Who are we talking about? Please, bring here a few more people who need syntax-specific settings for CSScomb but can't use .csscomb.json and we'll discuss the issue.

pepelsbey commented 10 years ago

If you go to ST’s Preferences > Settings - Default you see all available default options so you can go and choose Settings - User and copy-paste something to your own settings with different value. This is the best learning model.

CSScombJS default settings are ridiculous:

{
    // If you want to use custom config, put file named `.csscomb.json` to the
    // project's root or your HOME directory. If for some reason you would like
    // to set custom path to configuration file, paste it here.
    // For example, "/Users/csscomb/project/config/csscomb.json"
    "custom_config_path": ""
}

It tells me nothing on how to change default behavior right here, right now. No hints, no links, no nothing. So I should somehow guess that I need to go to README, copy link from markdown, read documentation and only then be able to do something with silly Yandex code style for CSS.

I want my own code style to be default in my own editor’s options. You ask me to put config in every folder where I code.

jroman00 commented 10 years ago

:+1: for this issue.

jb510 commented 10 years ago

+1 on this issue. Do it the "sublime text" standard way, or at least allow for it with the ability to reference a preference file outside the normal realm.

Having just switched from CSS Comb to CSS Comb JS I have now have idea where find the default settings for CSS Comb JS to tweak them.

I look where I always do for ST plugins the default settings file: /Packages/CSScomb JS/CSScomb JS.sublime-settings but it just reads: { // If you want to use custom config, put file named .csscomb.json to the // project's root or your HOME directory. If for some reason you would like // to set custom path to configuration file, paste it here. // For example, "/Users/csscomb/project/config/csscomb.json" "custom_config_path": "" }

Which is entirely unhelpful for discovery of user settings I might over ride in my user and syntax specific settings files
/Packages/User/CSScomb JS.sublime-settings

tonyganch commented 10 years ago

Fixed in master. You can now specify the config both in .csscomb.json file and ST's settings: https://github.com/csscomb/sublime-csscomb/blob/cf331731762d6abb3a5f69fb9284e27608cf536c/CSScomb.sublime-settings Default settings contain csscomb config.

jb510 commented 10 years ago

Thanks for this!