Fork me on GitHub
#rewrite-clj
<
2019-07-05
>
borkdude09:07:54

@lee how's the rewrite-cljs coming along?

borkdude09:07:24

any reaction from the original author?

borkdude09:07:54

FWIW I made a couple of clj-kondo specific tweaks to rewrite-clj which can be seen here: https://github.com/borkdude/clj-kondo/commits/master/parser/clj_kondo/impl/rewrite_clj

borkdude10:07:12

The first commit also contains the patch for namespaced maps, I didn't make that an explicit commit

lread11:07:23

Hi @borkdude, thanks for checking in! I am for now finished with my adventures in cljs, and am back to rewrite-cljc work.

lread11:07:03

14 days and no response from the original author yet.

sogaiu11:07:35

we're half way there!

lread11:07:49

While looking at the namespaced map issue you raised here I looked at your rewrite-clj fork - my compliments in your code, it is very easy to read.

lread11:07:32

I also took a first stab at docs. Based on an old chat in cljdoc channel, I am trying out asciidoc.

lread11:07:45

eek @sogaiu! does that mean I have to acutally deliver something? ๐Ÿ˜…

sogaiu11:07:03

lol ๐Ÿ™‚

sogaiu11:07:32

i've been trying asciidoc as well -- today i hit a bit of a snag -- i wrote a README for a repo for an issue and then was about to paste as issue when i learned that github issues don't appear to support asciidoc ๐Ÿ˜ž went through and rewrote as markdown...

lread11:07:48

github support for asciidoc is... partial... not horrible... but not wonderful. I am going to leave a minimimal README in markdown and the rest will be in asciidoc.

lread11:07:13

I think.. at least thatโ€™s what I am going with for now.

sogaiu11:07:31

i was having a hard time with getting previews to work...finally have something tolerable

lread11:07:06

Yeah me too. @borkdude likes vscode for this. Iโ€™ve settled on a browser plugin that seems to work well.

borkdude11:07:56

I haven't tried asciidoc support in vscode though

borkdude11:07:14

but it should work, asciidoc is a well established format

lread11:07:29

Oh I must be misremembering

borkdude11:07:37

I do use it for markdown previewing

lread11:07:30

Ah! my mind is not totally lost. simple_smile

lread11:07:37

@borkdude the issue you brought up with namespaced maps has led me to wonder what I really need to resolve for namespaced maps for sexpr. Now that Iโ€™ve got the code to stop resolving when not using sexpr, Iโ€™m exploring the notion that the current sexpr code might be resolving when it does not have to. Anyways, thanks again for sharing the issue, it has helped!

borkdude11:07:58

but I see your problem there. I cheated a little bit, by always using only one colon ๐Ÿ˜‰

borkdude11:07:31

the information that it's an alias is stored when parsing though, and I leverage that in linting

borkdude11:07:49

so in general, for rewriting code, this isn't sufficient, but for clj-kondo it was

borkdude11:07:12

well, for rewriting you could probably just emit a double colon again, but for sexpr it isn't sufficient

borkdude11:07:38

but how does this work for sexpr on ::foo right now then?

borkdude11:07:20

ah I see:

bar=> (require '[clj-kondo.impl.rewrite-clj.parser :as p])
nil
bar=> (clj-kondo.impl.rewrite-clj.node/sexpr (p/parse-string "::foo"))
:bar/foo

borkdude11:07:45

so maybe that makes sense. however, I ran into a bug while parsing, not while doing sexpr I think

borkdude11:07:59

maybe the parsing used sexpr, don't remember

borkdude11:07:32

the bug occurred when parsing a nested namespaced map

lread11:07:35

yeah it did on validation

lread11:07:54

I think the one for me to think about is ::{:a 1}.

lread11:07:58

It seems to me that Iโ€™ll have to resolve current ns for that one.

borkdude11:07:12

yeah, like the keyword example above

borkdude11:07:48

but when resolving things like ::p/foo this should not crash when parsing or rewriting

borkdude12:07:10

if p doesn't exist in the context where rewrite-clj runs

lread12:07:03

I am musing that I might not need to resolve the p namespace alias, but have not had coffee yet. simple_smile

borkdude12:07:16

I think this topic was brought up before: be very careful with calling sexpr ๐Ÿ™‚

borkdude12:07:38

you probably can't avoid resolving namespaces from aliases when doing sexpr

lread12:07:03

Iโ€™ll carry on with my exploration and am looking forward to getting back to you after I am caffeinated.

borkdude12:07:58

๐Ÿ‘โ˜•

lread12:07:22

Oh right, forgot to mention I am starting to look at clj-kondo warnings and even have my very first clj-kondo config! Very cool!

borkdude12:07:36

wow nice ๐Ÿ™‚

borkdude12:07:44

meta ๐Ÿ™‚

sogaiu13:07:04

(i tried vscode with a couple of asciidoc extensions, but didn't succeed in getting them to work -- this was after trying some the browser plugin route. that also had problems...oddly enough for files with name "README.adoc"...anyway, now using asciidocfx w/ some success.)

lread13:07:17

I did have some success with vscode, but I prefer to stay in spacemacs. I found that spacemacs had some oddly teeny tiny default fonts for asciidocs and adjusted accordingly. The chrome browser plugin I am using had to be configured to render local files.

sogaiu13:07:33

i had to stop using chromium because it refused to start up for me one day...now after quite some time i am back on firefox.

sogaiu13:07:42

as long as we have strayed this far and since you appear to be using emacs...today i found what i think may be a hidden gem.

lread13:07:50

I mostly prefer firefox these days too. But did not get asciidoc plugin to work on firefox. I might gry harder.

sogaiu13:07:55

it's a socket-repl-based clojure and cljs thing with a set of features that happens to be along the sorts of things i had been making...too bad i didn't find this some months back.

sogaiu13:07:13

fwiw, i think i tried a firefox-based asciidoc plugin but it was the one that for some reason wouldn't preview files named "README.adoc"

sogaiu13:07:00

the socket-repl part is important for having something that will work with jvm clojure, cljs, and clojure clr.

lread13:07:52

And REBL?

sogaiu13:07:20

haven't tried yet -- just found it ๐Ÿ™‚ author is quite repsonsive though.

sogaiu13:07:30

already fixed something i reported.

lread13:07:33

Is it a cider alternative?

sogaiu13:07:16

i had to stop using that a fair bit back for various reasons that probably don't apply for other folks -- so i'm not sure. depends on what you use from cider i guess ๐Ÿ™‚

sogaiu13:07:14

i found there were only a few things i really used for clojure work, so if your requirements are along those lines, it may be good enough.

sogaiu13:07:21

i hope some day we get something with source that provides a complete debugging experience.

sogaiu13:07:20

do you know of a rebl alternative for cljs? punk was getting closer at one point, iirc.

lread13:07:57

no sorry, have not even tried REBL yet, but am very intrigued

sogaiu13:07:41

please try rebl.

sogaiu13:07:37

ah, i see i think i misinterpreted the "And REBL?" remark -- it seems like it's not usually hard to add socket-based repl functionality to something.

sogaiu13:07:14

hope you find it to be worth your time ๐Ÿ™‚

lread13:07:39

I tend to find joy in the journey, so I expect it will!

sogaiu13:07:15

ah, that is nice!