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

Call to disable alphabetical order. #31

Closed
codeHusky opened this issue May 6, 2015 · 24 comments
Closed

Call to disable alphabetical order. #31

codeHusky opened this issue May 6, 2015 · 24 comments
Labels
wontfix An issue that is either out of scope or blocked by an issue in a dependency that is wontfix

Comments

@codeHusky
Copy link

If I want my config to look like this:
version="0.3"
node1 = "banana"
aForApple="yes"
I can't because nodes are locked in alphabetical order. If I could disable that, I could get that outcome.

@ryantheleach
Copy link

It won't just be a problem for dev's admins get quite possessive over the layout and order of their plugin configs.

@codeHusky
Copy link
Author

@ryantheleach Yeah. When I ran a server I liked it when things were sorted by category.

@boformer
Copy link

boformer commented May 6, 2015

I reported this few months ago:
https://github.com/zml2008/configurate/issues/18

Can this be fixed by creating a fork of the typesafe hocon library?

@zml2008
Copy link
Member

zml2008 commented May 6, 2015

possibly? but I don't really have the time to maintain that.

@Favorlock
Copy link

Just noticed this issue myself. Hopefully it can be resolved soon. I've tried setting the configuration options, but that doesn't seem to do anything when using Hocon.

@zml2008
Copy link
Member

zml2008 commented May 12, 2015

This is an issue with the hocon library itself, and new versions of the hocon library require jdk8 so this is not something simple to fix at all.

@Favorlock
Copy link

Is the issue already resolved in newer versions of the hocon library or is it just a matter of being to test it to find out?

@zml2008
Copy link
Member

zml2008 commented May 14, 2015

It doesn't look like the map implementation used by the Hocon library has changed. However, newer library versions allow us to pass whatever map implementation we want. Unfortunately, we can't use the newer library version until we don't have users who require jdk6 (Sponge).

@ryantheleach
Copy link

me:
Is there a way to disable alphanumeric sorting of keys? I find it's useful that configs have a set order that makes it easier for the user to read and edit.

havocp 10 hours ago  
the Configdata structure doesn't preserve order, keys are just in random hash table order before we sort them.
the natural follow up is why doesn't it preserve order; there's some discussion on closed github issues but in short it doesn't work well with merging (withFallback).
if you want to load/edit/save a file, see the new ConfigDocument API in 1.3.0

@zml2008
Copy link
Member

zml2008 commented Jun 29, 2015

gonna leave this as a wontfix. That will change once configurate is on jdk8 though.

@zml2008 zml2008 closed this as completed Jun 29, 2015
@TheE
Copy link

TheE commented Sep 11, 2015

Since Sponge is now JDK8, is there a chance to reopen and fix the problem?

@zml2008
Copy link
Member

zml2008 commented Sep 11, 2015

Possibly, I'll take a look at it.

@varrix
Copy link

varrix commented Sep 26, 2015

Should this perhaps be kept open until it has been decided on whether or not the JDK8 migration can potentially solve the issue?

zml2008 added a commit that referenced this issue Nov 2, 2015
This partially fixes #31 when writing new data. However, reading a
configuration file in still does not preserve node order. This would
require changes in the HOCON library -- take a look at
https://github.com/typesafehub/config/blob/v1.3.0/config/src/main/java/com/typesafe/config/impl/ConfigParser.java#L215
for the specific line that would need to be changed.
@ryantheleach
Copy link

Any chance that using the ConfigDocument API in 1.3.0 could fix the issue with reading the config?

@CrazyFlasher
Copy link

Are there any HOCON parsers that keep values order?

@codeHusky
Copy link
Author

Is this ever going to be came back to or not?

@jamezrin
Copy link

Will this be fixed at some point? This is a pain in the ass

@ryantheleach
Copy link

@zml2008 Hasn't had a ton of time lately, @codeHusky @jamezrin Are you volunteering to potentially add support for the new ConfigDocument API? That seems the only sane method considering Typesafe's current stance.

@codeHusky
Copy link
Author

I know nothing about this codebase.

@Crypnotic
Copy link

Any updates on this issue. Not preserving order is very frustrating

@zml2008
Copy link
Member

zml2008 commented Jan 23, 2019 via email

@Crypnotic
Copy link

Crypnotic commented Jan 23, 2019

I'm not too familiar with how configurate interacts with the hocon library, but according to the latest comment on: lightbend/config#365
There is a way to accomplish ordered reading by only using the library to parse the config

Edit: Checked out the loader very briefly and it seems like no methods are used that the comment says to be wary of

@ryantheleach
Copy link

To be fair, it's a hacked fork. could break at any stage, if you attempt to keep it updated. Which may be fine for SpongeForge/SpongeCommon but I think most people would rather not have those hacks in Configurate. I suspect there's an alternate way, by getting Configurate to use the dedicated document editing API's for modifying values, but that could be quite difficult to implement potentially.

@zml2008
Copy link
Member

zml2008 commented Apr 12, 2020

Since at the moment it looks like we've done everything we can do on the Configurate side, any further change would have to happen on the underlying library. It also looks like our use case is not a priority for the Hocon developers, so the issue is unlikely to be fixed in the near future.

I'll close this issue since it's unlikely we'll make progress on it as things currently stand, but I do hope that changes in the future.

@zml2008 zml2008 closed this as completed Apr 12, 2020
@zml2008 zml2008 added the wontfix An issue that is either out of scope or blocked by an issue in a dependency that is wontfix label Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix An issue that is either out of scope or blocked by an issue in a dependency that is wontfix
Projects
None yet
Development

No branches or pull requests