greglook / puget

Canonical Colorizing Clojure Printer
The Unlicense
252 stars 27 forks source link

ClojureScript support? #27

Open arichiardi opened 8 years ago

arichiardi commented 8 years ago

Hello guys, I am trying to include the new puget 0.9.2 in a ClojureScript project with no luck. I tried to downgrade to 0.8.1 but still I am not able to see puget in my classpath. It always throws the classic no namespace found printer.puger...bla bla .cjlc ...bla

My project.clj:

:dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.145"]
                 [reagent "0.5.1"]]

  :plugins [[lein-cljsbuild "1.1.0"]
            [lein-codox "0.9.0"]
            [lein-simpleton "1.4.0-SNAPSHOT"]]

The profile.clj is empty.

Very weird, what can it be? Does puget modify the classpath at all?

greglook commented 8 years ago

Unfortunately Puget is not yet cross-compiled to ClojureScript. As of the 0.9.x series its main dependency (fipp) is cross-compiled though, so in theory this should be doable. I haven't worked a lot in cljs though, so if you have any suggestions I'm all ears.

Mainly I think this would involve making most of the files .cljc and then adding reader conditionals around the Java-specific parts.

arichiardi commented 8 years ago

Yep, are there a lot of Java specific calls? I guess I can have a look at the code and try to contribute :wink:

EDIT: I changed the name of the issue.

I see a lot of Java fiddling here and here.

piecyk commented 8 years ago

:+1: for this, also will have a look, regarding the java-handlers i think we can drop it for cljs will try to have something working.

arichiardi commented 8 years ago

yep agree, putting here as reference http://dev.clojure.org/display/design/Reader+Conditionals

greglook commented 8 years ago

Yeah, some thoughts:

arichiardi commented 8 years ago

Yes I notice arrangement, but as you said, there are a few lines of code to change in there. I am more curious about sys-id, what is the purpose? Skimming the code it looks like you're using it as id string in the span creation. It looks that in that when you check it against the class name...is it used for uniquely identify an instance?

greglook commented 8 years ago

The sys-id used to differentiate otherwise-identical instances of the same class. For Clojure's persistent collections and other EDN primitives, this is not necessary since they support value-based equality. However, if you want to tell two instances of ByteArrayInputStream (for example) from each other, you need to use the system-level hash-code. Hence the use in the unknown formatter.

The package.foo.Bar@123abc format is used by Java as the default toString implementation, so the formatter checks that it's not going to print the same thing twice in case the object doesn't implement a custom string format.

arichiardi commented 8 years ago

Yes I suspected that.

venantius commented 8 years ago

I am going to begin work on this.

arichiardi commented 8 years ago

@venantius great! Feel free to ping me here or on Slack for testing!

greglook commented 8 years ago

Cool, I've just started picking up Clojurescript myself! I've experimented a bit with cross-compiling in alphabase and it's pretty nice so far.

venantius commented 8 years ago

Reference WIP PR here: https://github.com/greglook/puget/pull/30

worrel commented 8 years ago

hey, any movement on the CLJS support? looks like the upstream PR in clj-arrangement was merged, anything blocking this?

venantius commented 8 years ago

Nothing blocking it other than time. I've made a bunch of progress since the last comment on this issue, but I haven't had a chance to drag it over the line. I'd say the current status is about 80% done.

roman01la commented 7 years ago

Hello. What's left to do here? Would be nice to finally finish this :)

piotr-yuxuan commented 6 years ago

Hello, just looking for some news, what's up on that issue? If you don't have time to finish it, do you think you could still write what's left for others to try to help you?

venantius commented 6 years ago

There's been no progress. Anyone interested in picking this up should refer to the WIP PR referenced above for Puget, or could take a look at the syntax-highlighting engine for Planck and work on it from that angle.

holyjak commented 6 years ago

@venantius Could you be so kind and describe what is it that needs to be done, i.e. what are the main problems that need to be solved? It is not very clear to me from the PR (the comments there are too low-level for me) or from the " look at the syntax-highlighting engine for Planck and work on it from that angle". I think it would be very helpful to provide a clear description of the task (and the work done so far) so that somebody can pick it up. Thank you!