Closed quintesse closed 10 years ago
move all the formatting options from the config file to their own file
You mean, we should remove #32? I saw format.default
more as an alternative rather than a replacement…
Well, like I said before, I don't think we should put any formatting options in the config
file at all. I just don't think it's the right place for it.
All projects will have a config
file, if some people want to set formatting options and others don't want that you'd always have to be careful not to push your options to the general git repository. By having a separate file a project could either decide to add it to git or to add it to the .gitignore file.
The only thing related to formatting in the config file would be the --profile
option I mentioned in #74 , because most tools should have their command line options be available as config options as well. (But as long as a project has a format.default
file it should never be necessary to use this option, it's just there to be consistent with other tools really)
NB: I don't know if I told you but last time we talked about this months ago I decided to factor out the code that locates the Ceylon config
file and created the ConfigFinder
. You can use it like this:
ConfigFinder finder = ConfigFinder("format.default", "ceylon.format");
CeylonConfig cf = finder.loadDefaultConfig(new File("."));
Which would go looking in the current folder for .ceylon/format.default
(and also for any parent, user and system files and merge them) and returns a CeylonConfig
object with all the values it found.
Edit: the "ceylon.format"
argument is the name of the system property that can be used to override the file it has to load, it can be set to null
if you don't want/need that functionality.
I would be okay with removing the config file options if we instead support a (per-system, per-user) default profile. That would still allow users to always format with the same settings without having to set them up for each project individually.
The open question is then if settings still should “cascade” – look in the project profile, then in the user profile, then in the system profile – or not. (The question is much less important now because we would encourage, and add a way to easily obtain, complete profiles that don’t omit any options.)
if we instead support a (per-system, per-user) default profile
That's what the ConfigFinder
gives you by default.
You can put the format.*
files anywhere the config
file can be stored, which includes ~/.ceylon/
and /etc/ceylon/
(and their equivalents on Windows and Mac).
If you want "cascades" you use ConfigFinder.loadDefaultConfig()
, otherwise you use ConfigFinder.loadFirstConfig()
which gives you the most specific one and does not do any merges (the "closest" to the current working directory).
Edit: PS I agree with what you say here: "The question is much less important now..."
Until such time that we can implement "profiles" (see #74) we should at least move all the formatting options from the config file to their own file.
To be able to implement the profiles in the future with as few changes as possible I'd suggest to name the file
format.default
and place it next to theconfig
file.