rewrite-clj

https://github.com/clj-commons/rewrite-clj
borkdude 2019-07-05T09:58:54.299200Z

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

borkdude 2019-07-05T09:59:24.299400Z

any reaction from the original author?

borkdude 2019-07-05T09:59:54.299800Z

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

borkdude 2019-07-05T10:00:12.300200Z

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

lread 2019-07-05T11:24:23.302600Z

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

lread 2019-07-05T11:25:03.303600Z

14 days and no response from the original author yet.

2019-07-05T11:26:35.305200Z

we're half way there!

lread 2019-07-05T11:27:49.306900Z

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.

lread 2019-07-05T11:30:32.309300Z

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

lread 2019-07-05T11:31:45.311100Z

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

2019-07-05T11:32:03.311400Z

lol πŸ™‚

2019-07-05T11:32:32.312200Z

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...

lread 2019-07-05T11:34:48.314700Z

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.

lread 2019-07-05T11:35:13.315500Z

I think.. at least that’s what I am going with for now.

2019-07-05T11:35:31.315800Z

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

lread 2019-07-05T11:37:06.317200Z

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

borkdude 2019-07-05T11:37:56.318200Z

I haven't tried asciidoc support in vscode though

borkdude 2019-07-05T11:38:14.318800Z

but it should work, asciidoc is a well established format

lread 2019-07-05T11:38:29.319100Z

Oh I must be misremembering

borkdude 2019-07-05T11:38:37.319400Z

I do use it for markdown previewing

lread 2019-07-05T11:39:30.320100Z

Ah! my mind is not totally lost. :simple_smile:

lread 2019-07-05T11:47:37.326700Z

@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!

borkdude 2019-07-05T11:49:00.327200Z

although I don't use it, my patch does support sexpr: https://github.com/borkdude/clj-kondo/blob/master/test/clj_kondo/impl/parser_test.clj#L10

borkdude 2019-07-05T11:49:58.328300Z

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

borkdude 2019-07-05T11:50:31.328800Z

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

borkdude 2019-07-05T11:50:49.329200Z

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

borkdude 2019-07-05T11:52:12.331200Z

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

borkdude 2019-07-05T11:52:38.332300Z

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

borkdude 2019-07-05T11:54:20.333300Z

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

borkdude 2019-07-05T11:54:45.334Z

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

borkdude 2019-07-05T11:54:59.334400Z

maybe the parsing used sexpr, don't remember

borkdude 2019-07-05T11:56:32.336Z

the bug occurred when parsing a nested namespaced map

lread 2019-07-05T11:56:35.336100Z

yeah it did on validation

borkdude 2019-07-05T11:56:41.336300Z

ah

lread 2019-07-05T11:56:54.336400Z

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

lread 2019-07-05T11:57:58.337500Z

It seems to me that I’ll have to resolve current ns for that one.

borkdude 2019-07-05T11:59:12.337900Z

yeah, like the keyword example above

borkdude 2019-07-05T11:59:48.338600Z

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

borkdude 2019-07-05T12:00:10.339200Z

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

lread 2019-07-05T12:03:03.341600Z

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

borkdude 2019-07-05T12:04:16.342Z

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

borkdude 2019-07-05T12:08:38.342400Z

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

lread 2019-07-05T12:11:03.343700Z

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

borkdude 2019-07-05T12:11:58.343900Z

πŸ‘β˜•

lread 2019-07-05T12:16:22.346400Z

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!

borkdude 2019-07-05T12:16:36.346600Z

wow nice πŸ™‚

borkdude 2019-07-05T12:16:44.346800Z

meta πŸ™‚

lread 2019-07-05T12:17:44.347500Z

:simple_smile:

2019-07-05T13:02:04.351200Z

(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.)

lread 2019-07-05T13:08:17.356300Z

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.

2019-07-05T13:20:33.357100Z

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.

2019-07-05T13:22:42.360100Z

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.

lread 2019-07-05T13:22:50.360200Z

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

lread 2019-07-05T13:23:00.360500Z

do tell

2019-07-05T13:23:08.360700Z

https://github.com/EwenG/replique.el

2019-07-05T13:24:55.362700Z

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.

2019-07-05T13:26:13.363800Z

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"

2019-07-05T13:27:00.364500Z

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

lread 2019-07-05T13:28:52.365Z

And REBL?

2019-07-05T13:29:20.365900Z

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

2019-07-05T13:29:30.366400Z

already fixed something i reported.

lread 2019-07-05T13:29:33.366500Z

Is it a cider alternative?

2019-07-05T13:30:16.367400Z

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 πŸ™‚

2019-07-05T13:31:14.368200Z

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.

2019-07-05T13:32:21.369Z

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

2019-07-05T13:33:20.369600Z

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

lread 2019-07-05T13:35:57.370300Z

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

2019-07-05T13:36:41.370800Z

please try rebl.

lread 2019-07-05T13:45:07.372700Z

will do!

2019-07-05T13:45:37.373200Z

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.

2019-07-05T13:46:14.373700Z

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

lread 2019-07-05T13:53:39.374800Z

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

2019-07-05T13:57:15.375800Z

ah, that is nice!