-
Notifications
You must be signed in to change notification settings - Fork 8
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
Could not call Config.resolve in Scalajs #36
Comments
@andares This is a bug, thanks for reporting. This class is missing in the Scala.js Java library and because all the tests are not run with Scala.js - this bug was not found. Right now we cannot share tests because we don't have a shared test framework for all three platforms but I would like to find or have a test for this so if you could supply the code you used to create the error it would be helpful. |
I'm glad to be able to support. here is my code, I have to say I'm a beginner in scala 😹 package example
import org.ekrich.config._
import scala.io.Source
object Test extends App {
def parseFile() = {
// That's not work, need `java.io.File`
val config = ConfigFactory.parseString("main.conf")
println(config.resolve)
// println(config)
}
def parseString() = {
val content = """
_pattern.default.main = "../default/main.conf"
core = {
version: 0.1
extends: [
${_pattern.default.main}
]
}
"""
val config = ConfigFactory.parseString(content)
println(config.resolve) // That's crash
// println(config) // That's ok
}
// --> run test
// parseFile
parseString
} here is build.sbt content:
Talk a little more, at the beginning I thought I could get the best support for hocon in scala. but I found Scala relies heavily on java libraries on the jvm platform. I think scalajs is hard to deal with, may be use js lib by interop is better way 🤣 |
Scala.js doesn't have any support for |
That's ok, thank you for the reply 👍 |
Test with working example - https://github.com/ekrich/sconfig/blob/master/sconfig/native/src/test/scala/ConfigFactoryTests.scala#L43-L62 |
That's great! I have try it again. |
@andares Sorry, I didn't mean to mislead you. I am still working on the Scala.js support for this feature. I just made a test case that works on Scala Native that I can use to test when finishing development on Scala.js. I will close this ticket out once completed and then will need to make a new release for the Scala.js support of this feature. |
I see, I have parse hocon file with npm lib now, never mind 👌 |
I'm sorry you had to resort to that but thanks for reporting and your interest. I have been working on this issue but it requires adding If you are using Scala.js you can get help here - https://gitter.im/scala-js/scala-js There is another HOCON lib for Scala.js that is very lightweight. https://github.com/akka-js/shocon I hope you keep using Scala.js. If you would like to discuss further you can find me here as well. https://gitter.im/ekrich/sconfig |
Thank you for your help indeed. I'll keep trying Scala.js in my project. As compile to js language, use npm lib to resolve problem is also possible 😄 You can close the issue when the work is over. |
Fixed by #57 |
It looks use typeconfig lib to resolve hocon config. There is not IdentityHashMap exists in scala lib, can I find other way to resolve it?
The text was updated successfully, but these errors were encountered: