Fork me on GitHub
#calva
<
2018-12-13
>
manas_marthi13:12:30

Hi I just installed calva and corresponding paredit plugin. I ran lein repl in an existing project (added cider-nrepl to project.clj). then opened the project folder in VSCode. I typed Alt V E on (println "helloworld"). It displayed the return value of nil but not the string. The string was not visible in the terminal as well.

manas_marthi13:12:42

Not sure if I have everything configured correctly..

manas_marthi13:12:57

Looking for nREPL sessions...
Clojure 4 VS Code activated. Happy coding! ❀️
Please file any feature requests or bug reports here: 
I will also respond to any @pez mentions in the #editors shannel of the Clojurians Slack: 

Note: Autolinting is now diabled by default. You need to enable "clojure4vscode.lintOnSave" in your editor settings to use it. But first install Joker: 
-------------------------
Connected session: clj
clj session used for cljc
Evaluating:
(println "hello world")
----------------------------
nil

mseddon14:12:33

but it seems kinda... deliberate.

pez14:12:04

Did you see that link to the PR i referred to in the issue?

mseddon14:12:40

yeah I just spotted that was what it did.. derp

pez14:12:31

It seems wrong that the cond forms we are talking about should meet the criteria of codeless-block?.

pez14:12:43

So, without having checked the code or anything my hunch is now that the bug lives where codeless-block? is determined. (Also without nowing what a block is. )

mseddon14:12:57

if I understand correctly, codeless-block is weirdly just looking at the right of a zipper to see if it's nil...

mseddon14:12:19

so... I don't see how that relates to codeless blocks yet. I need to dig deeper into their representation

pez14:12:30

I know almost nothing about zippers. πŸ˜ƒ

mseddon14:12:41

πŸ˜„ they're pretty simple really

mseddon14:12:54

just a pointer into a tree, and you can walk up/down/left/right to move an index

mseddon14:12:07

then swap things out etc.

mseddon14:12:34

iiuc, 'codeless-block' kind of really means 'end-of-block' πŸ™‚

pez14:12:03

Yeah, so that probably fixed the let form problem.

pez14:12:57

I think it should be handled like "how would it be indented if there was a symbol just before the end-of-block?"

mseddon14:12:39

yeah i am trying to work out what is involved just yet. breaking cljfmt is fun...

pez14:12:00

If you wanna hear me scream of happiness you should fix this problem: https://github.com/weavejester/cljfmt/issues/154 πŸ˜ƒ

mseddon14:12:45

πŸ™‚ I will have a play

mseddon14:12:11

I think cljfmt woes is probably 99.9% the biggest pain for me right now

mseddon14:12:29

btw I came up with probably the cheesiest but might actually work solution for https://github.com/BetterThanTomorrow/calva-fmt/issues/6

mseddon14:12:52

basically splitting the string along "\r\n|\n", figuring out where the offsets are, and repositioning. each line has a start offset and in CRLF mode, the offset bumps 2 chars (for cr/lf), but only one in LF...

pez14:12:05

I have tried something similar… πŸ˜ƒ

pez14:12:14

Not sure how updated it is with my experiments but there is a branch named crlf-dabblings.

mseddon14:12:29

oh, I'll have a poke through that at some point, then

mseddon14:12:01

trying to understand cljfmt#156 a bit better atm

manas_marthi14:12:31

Hi, the Getting started document short cuts in github and what I see in VSCode are not matching . VS Code does not expect me to type the CTRL key

pez14:12:02

@manas.marthi That screenshot is from a really old version of Calva!

pez14:12:14

And, hi! πŸ˜ƒ

manas_marthi14:12:15

I just installed calva now

manas_marthi14:12:48

hmm may be my company vscode is old

manas_marthi14:12:00

and it is downloading an old version of calva

manas_marthi14:12:33

yeah, I am using 1.13.0

manas_marthi14:12:39

vscode website shows 1.30

pez14:12:53

Yes, could be it. I think Calva requires at least 1.20.

mseddon14:12:32

(and (codeless-block? zloc) (not= idx 0)) fixes it

pez14:12:01

What's idx?

mseddon14:12:06

[[:block idx]]

mseddon14:12:09

for the current form

pez14:12:22

I see. Great!

mseddon14:12:31

so.. i figure that means... 'everything is aligned the same for the whole form'

mseddon14:12:38

seems to be that way, at least..

pez14:12:41

So just add some test for this and the PR is good to go, I think. πŸ˜ƒ

mseddon14:12:52

yeah. let's hope πŸ˜„

mseddon14:12:04

time to peek at their test setup now

pez14:12:50

They're in the middle of changing that (or if they have already) using Reeve's test framework, I think.

pez14:12:24

Either way I guess you would use whatever setup is in master. πŸ˜ƒ

mseddon14:12:35

naturally πŸ˜‰

mseddon14:12:45

also I ❀️ git CI.

pez14:12:03

Never tried it. Probably should!

mseddon14:12:12

we used it a bunch on scala.js

mseddon14:12:25

saves so much time when there are a lot of contributions πŸ™‚

mseddon14:12:31

"it's red. go away"

pez14:12:41

At least with calva-lib it should be totally feasible.

mseddon14:12:07

yeah I haven't set it up myself

pez14:12:08

Even if most contributions are on the TS end of things. haha.

mseddon14:12:39

πŸ˜„ well. let's try and nail these cljfmt bugs and maybe look at removing some of that

manas_marthi14:12:49

Hi @pez, is 1.3.58 the latest version of calva ?

pez14:12:05

Yeah, I think so.

mseddon14:12:08

that's right yeah

mseddon15:12:19

parrot

Ran 11 tests containing 128 assertions.
0 failures, 0 errors.
Running ClojureScript test: dev

Testing cljfmt.core-test

Ran 11 tests containing 128 assertions.
0 failures, 0 errors.
upside_down_parrot

pez15:12:32

Awesome.

mseddon15:12:10

just throwing in a couple of tests and PRing in a minute

pez15:12:53

Welcome, @tomd!

mseddon15:12:29

i may have slimed myself. πŸ™‚

mseddon15:12:30

oh. derp. no i am using his test function wrong. silly.

manas_marthi15:12:31

Hi @pez do I need anyother plugins other than calva?

pez15:12:54

@manas.marthi, no, I think you should be good with Calva. It bundles Calva Paredit and Calva Formatter (which has some little Parinfer built in).

tomd15:12:27

thanks @pez!

manas_marthi15:12:34

okay, tq.. I have difficulty getting the indentation working okay. Also, a lot of times, when I hit the enter key the cursor is coming back to the end of line

pez15:12:53

@manas.marthi Give me some examples and maybe I can see if it is by design or some bug.

pez15:12:07

Awesome, @mseddon! Thanks!

aw_yeah 1
pez15:12:58

@mseddon Let me know when it is pulled and I'll merge it into my copy of cljfmt.

mseddon15:12:41

will do πŸ™‚

mseddon15:12:51

will look at tonsky's style now

pez15:12:12

The awesomeness never ends!

tomd15:12:23

hello πŸ‘‹ I'm getting a FileNotFoundException Could not locate cljs_react_material_ui/reagent__init.class or cljs_react_material_ui/reagent.clj on classpath. error in Calva's ClojureScript REPL and I'm a bit lost trying to fix it! Is this a Calva problem or a Leiningen problem? (sorry I'm a beginner but this slack doesn't let me search back very far! any help is super appreciated!)

mseddon15:12:43

I've been loosing all week, so I'm treating myself with little OSS bugfixes this afternoon πŸ˜‰

pez15:12:50

Beginners are welcome, @tomd!

πŸ˜€ 1
manas_marthi15:12:12

@pez The editing seems to work fine if I am at the end of the buffer. However if I start typing in the middle of the file it does not work

manas_marthi15:12:20

Clojure
(defn give-me-a-map []
 {:r 128
  :g 128
  :b 128  
  } )

manas_marthi15:12:51

try typing up to :r 128 in the middle of a file

manas_marthi15:12:56

and hit enter after 128

manas_marthi15:12:11

the cursor is returning to previous line

manas_marthi15:12:29

besides the indentation is not preserved when I edit in the middle of the file.

mseddon15:12:45

@manas.marthi oh, heads up, weird stuff happens if you are in CRLF mode atm, so ensure your file is LF only... πŸ˜•

mseddon15:12:09

i don't think it would cause that though.

pez15:12:21

I am not sure I follow.

manas_marthi15:12:32

@mseddon got it. I changed to LF. It seems to work fine

pez15:12:50

@tomd: how did you create that project?

mseddon15:12:52

@manas.marthi ah, okay, yeah, it's a silly bug that's definitely on the list πŸ™‚ I will try to get to it soon

pez15:12:52

I'm not sure where the problem is, @tomd, but I'm pretty sure it isn't Calva. I'd be happy to try help you get going anyway, of course.

tomd15:12:16

@pez I didn't create it. Some other developers created it and I'm working on it

tomd15:12:44

all the dependencies are in the project.clj file, and it looks sensible

pez15:12:56

OK. A problem with Calva sometimes is that it cuts a lot of some stack traces. Is it a figwheel project?

pez15:12:50

What happens if you do lein cljsbuild?

tomd15:12:05

just looks like a manpage

tomd15:12:28

Run the cljsbuild plugin.wmato>

Subtasks available:
once          Compile the ClojureScript project once.
auto          Automatically recompile when files are modified.
test          Run ClojureScript tests.
repl-listen   Run a REPL that will listen for incoming connections.
repl-launch   Run a REPL and launch a custom command to connect to it.
repl-rhino    Run a Rhino-based REPL.
sample        Display a sample project.clj.

Run `lein help cljsbuild $SUBTASK` for subtask details.

Arguments: ([once auto test repl-listen repl-launch repl-rhino sample])

pez15:12:10

Yeah, lein cljsbuild once then.

pez15:12:47

(I seldom use it directly so always forget how to use it. πŸ˜„)

πŸ˜€ 1
tomd15:12:02

I got one successful Compiling and then the next one failed with a couple of long stack traces. It terminated with Subprocess failed

tomd15:12:43

"resources/public/js/compiled/app.js" was the one that compiled successfully and "resources/test/js/testable.js"was the one that failed 😞

pez15:12:02

OK. So somewhere in that stack trace is a clue.

tomd15:12:21

shall I post on here or DM..?

pez15:12:14

Paste it as a snippet here. I might have to run soon and then maybe someone else can try help you.

tomd15:12:06

@pez ok thanks!

pez15:12:16

Also #beginners is a very friendly channel. Just so that you know. I have seldom seen a community as friendly as the Clojure one.

pez15:12:51

Hmm, that seems to be another problem than that with react cljs material ui.

pez15:12:55

But it could build the app. So I don't understand why you got the first error.

tomd15:12:05

awesome! I only asked here because I thought it may be a calva problem. thanks for helping anyway.

pez15:12:09

Did you get that from running lein repl?

tomd15:12:23

no, lein repl runs fine

pez15:12:13

As a beginner it is often really hard to know where the errors come from. Clojure error messages are generally improving, but also generally a bit lacking.

pez15:12:51

You get the error when starting the cljs-repl?

tomd15:12:52

yeah I've thought the errors are quite difficult to understand

tomd15:12:21

no the cljs-repl runs fine too

tomd15:12:51

(that's where the could not find.......on classpath error appears)

pez15:12:08

What do you do for it to appear?

tomd15:12:48

nothing. calva automatically starts it when I open a cljs file and press ctrl-j to see the terminal

pez15:12:51

Sometimes, if you have a cljs-repl, you can get a stack trace with good info if you do (reset-autobuild) in that repl.

pez15:12:18

I mean, what do you do for the error to appear. πŸ˜ƒ

tomd15:12:31

haha :man-facepalming:

tomd15:12:10

I evaluate the (ns namespace.name (:require .........) form

tomd15:12:43

(`[cljs-react-material-ui.reagent :as ui]` is :required and fails)

manas_marthi15:12:55

hi, how do I change calva to use ctrl+comma instead of ctrl+alt+v

pez15:12:11

@manas.marthi that will be a bit of work. Search for ctrl+alt+v in the keyboard shortcuts pane, and then edit all those commands...

pez15:12:10

Maybe you can pluck out the shortcuts from Calva's package.json and paste them in your user settings… Then do search and replace.

pez15:12:56

But it is present in project.clj, @tomd?

manas_marthi15:12:01

@pez I added { "key": "ctrl+, e", "command": "calva.evaluateSelection" },

manas_marthi15:12:51

Not sure if it conflicts with any other plugins

pez15:12:54

I see that ctrl+, is quite free to use, @manas.marthi. It is probably a better default than ctrl+alt+v. I'll have a think about it.

manas_marthi15:12:57

So far I have only clojure

manas_marthi15:12:14

This is what proto repl uses

pez15:12:27

There is no telling which extension uses what. It is a jungle.

pez15:12:57

But none of the extensions I use, at least.

manas_marthi15:12:59

As long as java, python, css, js, ts, xml, json plugins do not use it, we should be okay

tomd15:12:11

[cljs-react-material-ui "0.2.44"] is listed under :dependencies in project.clj so yes I think so @pez

pez15:12:29

Haha, I guess one of those might use it, of course. πŸ˜ƒ

manas_marthi15:12:54

@pez please review atom proto-repl short cuts

manas_marthi15:12:14

if we can keep things close to proto it can give easy switch over experience

manas_marthi15:12:47

(applicable to proto users)

manas_marthi15:12:00

the default emacs and spacemacs are a different bunch

pez15:12:05

It is quite strange, @tomd. Maybe someone in #beginners or #reagent have seen it before.

pez15:12:54

I'll do that.

tomd15:12:08

thanks so much for trying to help. I will ask around πŸ™

pez15:12:43

But Proto-REPL looks totally awesome to me, why would anyone switch from that?

manas_marthi15:12:51

Atom sucks behind proxy

manas_marthi15:12:04

vscode works for installing plugins

pez15:12:43

Hope you can get it going, @tomd! And hope you'll like Calva!

tomd15:12:07

Thanks! I really do πŸ™‚

pez15:12:36

@manas.marthi, I hope to find a big chunk of time to add some ProtoREPL inspired stuff to Calva.

manas_marthi15:12:22

thank you. I see the slurp/barf stuff are under commands

manas_marthi15:12:45

are there anything other commands that are not from calva.

pez15:12:51

Yeah, search for ”Calva” and you should see all.

pez16:12:26

So there are three extensions, but all have Calva in their name.

pez16:12:20

Personally I use Emacs inspired keyboard shortcuts for the Paredit commands. Mainly because that is what I was used to.

manas_marthi16:12:26

Looks like the ritht way to use comma is "ctrl+oem_comma"

manas_marthi16:12:59

I see it is already assigned { "key": "ctrl+oem_comma", "command": "workbench.action.openSettings" },

manas_marthi16:12:22

I just searched in a new installation the slurp commands are with paredit prefix

pez16:12:00

Yes, you are right, that was why something rang a bell in my head!

pez16:12:42

Isn't that kinda universal? At least on Mac it is.

manas_marthi16:12:46

I will still override ctrl+oem_comma. The number of times we open settings menu is far less than the number of times we evaluate forms

pez16:12:38

Agreed.

manas_marthi16:12:47

Another reason why VSCode appeals to me over atom: VSCode shows vertical guidelines to indicate the indentation and number of lines a s-exp extends to.

manas_marthi16:12:52

atom does not show that to me

manas_marthi16:12:44

I see the a bunch of errors in the Log (Extension Host) not sure what they mean

mseddon16:12:08

not my PR, but a more appropriate fix by weavejester addressing the issue is now merged into cljfmt

mseddon17:12:41

oh. doh. it's in formatter.cljs πŸ™‚

mseddon17:12:25

I see "\n" hardwired into :eol a bunch....

pez17:12:11

Saw about the PR and fix. Good stuff!

tomd17:12:02

btw @pez just in case you are interested, I figured out I was trying to run clojurescript in the repl (which is pointing at the jvm, I guess)

pez17:12:57

@tomd. Calva should open to repls for you.

tomd17:12:37

yes, there is a "ClojureScript REPL" but it looks just like a java repl.

pez17:12:56

It does.

tomd17:12:57

shouldn't it have a dev:cljs.user=> prompt?

tomd17:12:22

(that's what my figwheel has)

pez17:12:14

Btw, i seldom use those terminal repls and rely much more on the inline repls in the text editors.

pez17:12:21

It should have the same prompt. It connects to your figwheel.

1
mseddon17:12:24

@pez... I think I have CRLF working

mseddon17:12:06

basically you were there? but :eol was hardwired to "\n" in various places..

tomd17:12:16

@pez is there a simple command I can run to test if it is actually connected to my figwheel?

pez17:12:36

@tomd (js/alert) πŸ˜€

tomd17:12:28

:man-facepalming: sorry I'm such a n00b. I ran that and it says:

CompilerException java.lang.RuntimeException: No such namespace: js, compiling:(C:\Users\tomd\AppData\Local\Temp\form-init6609427845754296505.clj:1:1)

tomd17:12:17

so does that mean there's a Calva problem? Calva thinks it connected to js but it connected to jvm?

Whiskas17:12:36

@pez is it possible to make a separated extension that uses Calva core? or Paredit and fmt extensions don’t need it?

Whiskas17:12:01

Because i think that a Calva: Re-frame Navigation extension would have a lot of features

Whiskas17:12:16

Idk if a pull request would be the most convenient way to add them

Whiskas17:12:45

When i get all the stuff i’m doing β€œon the road” i will start searching about making the re-frame extension

pez17:12:16

@tomd that's strange. How did you start the repl and figwheel?

mseddon17:12:57

@pez see what happens with https://github.com/mseddon/calva-fmt/tree/crlf for you? it appears to function okay for me. There's really not much I changed to get it working so perhaps I am missing some erroneous behaviour.

tomd17:12:31

I ran lein repl in one powershell terminal and lein figwheel in another (both terminals in vscode) and then did ctrl-alt-v c and it autopopulated the port with the repl's port. calva then generated both repls, which i've learnt are both java repls (because (js/alert) works in neither!!)

pez17:12:52

@mseddon you're probably not missing anything. I'll check later tonight when I'm at a computer.

mseddon17:12:06

no worries. ta πŸ˜‰

pez17:12:12

@tomd, i see. That will not work, unfortunately. You'll need to start the figwheel repl from the first repl.

tomd17:12:34

excuse my ignorance, but how does one do that?

pez17:12:52

I think it's outlined in the getting started. I can't check right now.

tomd17:12:07

πŸ†— cheers I will read up

pez17:12:42

Let me know if it makes sense and what would make it make more sense. πŸ˜€

mseddon18:12:53

@tomd

(require '[figwheel-sidecar.repl-api :as figwheel])

mseddon18:12:07

(figwheel/start-figwheel!)
  (figwheel/cljs-repl)

pez18:12:08

@mateus.pimentel.w it makes sense to do it as its own extension, yes. Let's have a chat about how we should best factor it.

pez18:12:46

Later. I'm cooking food to my family right now. πŸ˜€

Whiskas18:12:58

i will be taking notes of the stuff i experience while making the tests with re-frame

metal 1
tomd18:12:35

thanks @mseddon!

tomd18:12:54

and thanks again @pez

tomd18:12:12

i'm off too. hopefully today will be a day full of calva success!

parrot 2
mseddon18:12:35

@pez I caught you passing the entire contents of the buffer to clj-fmt. that gets EXTREMELY slow when you e.g. have a 9k line file. formatting takes several seconds πŸ˜‰

pez18:12:52

@mseddon when would that happen?

mseddon18:12:07

well, hmm, maybe that's not what is happening

mseddon18:12:56

but at least with 0.0.30-calva-lib, i see a massive slowdown before the formatting happens, related to the length of the file

mseddon18:12:18

I am not sure what is causing it atm. Will take a look tomorrow

mseddon18:12:07

(copy a small defn thousands of times and it slows to a crawl)

mseddon18:12:07

huh. there is not even a cpu spike. just.. a big lag. it eludes profiling...

pez18:12:42

It is probably due to giving all the text to paredit.

mseddon18:12:11

currently there is a document.getText() call that shovels the whole thing over to cljfmt, too

mseddon18:12:42

i looked to see if we could enumerate the fold contexts and find that block.. but.. seems that it's opaque and we can't access them

pez18:12:49

Try expanding the selection in that file. (The calva command, not the vscode one, since i have not tied that one yet.

mseddon18:12:05

good idea, let's see

mseddon18:12:21

yeah that was slooow

pez18:12:50

I don't think the whole text is sent to cljfmt, unless the whole file is to be formatted.

mseddon18:12:54

~1 second with a 24k line file on this huge dev machine

pez18:12:32

We could try figure out how to do that more incrementally. But it is not obvious how.

pez18:12:08

We could also see if we can do it without paredit. Maybe rewrite-clj is faster.

mseddon18:12:09

yeah it's not an immediately obvious fix

mseddon18:12:29

it's a noticable lag with a longish file

pez18:12:55

Everything is sent to calva-lib, yes. But not too cljfmt.

pez18:12:58

I hope.

mseddon18:12:26

yeah format-text-at-range slices it with subs

mseddon18:12:52

disabling paredit didn't yield a noticeable speed increase though

mseddon18:12:13

If I can figure out how to profile the damn thing that'll help.. nothing's showing up in the profiler. πŸ™‚

mseddon18:12:39

task manager doesn't really notice anything spinning either

mseddon18:12:21

though one thing I wonder, but I don't know- you do an editor.edit() within the formatting functions, whereas the api suggests you return the edits from the callback

pez18:12:26

It's because i couldn't figure out how to configure the undo-stops the proper way. πŸ˜€

pez18:12:08

It got a bad ux without that.

mseddon18:12:21

yeah, screw any software with hosed undo πŸ™‚

pez18:12:15

I would be quite surprised if the proper way doesn't allow for configuring the stops, though.

mseddon18:12:39

I'm sure it does, just... the vscode api documentation is rather terse

pez18:12:29

You could feed the whole file to the functions in calva-lib from the repl and see if they perform badly.

mseddon18:12:12

pasting it into the repl is performing... badly. πŸ™‚

mseddon18:12:22

25289 lines...

mseddon18:12:48

it's a bit of an extreme test, but it makes it REALLY obvious.

mseddon18:12:40

it's not a massive issue, although I really want to try and get the formatting 'instant' it's a bit disconcerting the way it pops into place moments later, even if there's just a 1 frame delay

mseddon19:12:26

cljs.user=> (time (reformat-string foo))
Timeout while waiting for REPL result.

mseddon19:12:39

That would be 'yes'. πŸ™‚

mseddon19:12:53

but that was a silly test.

mseddon19:12:30

"Elapsed time: 76123.962800 msecs"

mseddon19:12:52

okay so I think that fairly conclusively establishes that we didn't send the whole buffer to reformat-string πŸ™‚

mseddon19:12:28

right, I need to put dinner on etc. I will have more of a play around tomorrow

pez19:12:52

Yeah, that is testing cljfmt.

pez19:12:15

Also, I am really hoping that zprint will be moving in the direction where it can support Calva’s formatting better, so that we don’t have to do a lot of the stuff we are currently doing. Hence this: https://clojureverse.org/t/clj-commons-building-a-formatter-like-gofmt-for-clojure/3240/13?u=pez and this: https://clojureverse.org/t/i-need-some-zprint-config-examples/3121?u=pez (the whole thread).

richiardiandrea19:12:17

zprint's maintainer is awesome, I would love for that to happen as well

pez19:12:31

I love that he wants to try help with this, and obviously is really thinking hard about it, even though he clearly thinks it might be too hard to fit it in to zprint’s model of things.

richiardiandrea19:12:12

he has done an immense amount of work in tweaking that and make sure folks like it, based on analyzing actual code

richiardiandrea19:12:19

he had a pretty nice talk at the Conj

pez19:12:32

The latest conj?

richiardiandrea19:12:45

sorry it was an unsession

pez19:12:53

Nooooooo!!!!

pez19:12:33

I would have loved to see it. I’ll ask him if he has something similar recorded.

richiardiandrea19:12:11

I think it is worth it..totally

mseddon19:12:16

man, i love the idea of zprint, i hadn't come across it

mseddon19:12:48

particularly the 'whee' factor of auto wrapping comments

pez19:12:23

What’s auto wrapping comments?

mseddon19:12:39

oh- it will automatically wrap long comments to fit the margin πŸ™‚

richiardiandrea19:12:28

yeah it does so many things

richiardiandrea19:12:52

he showed that it actually ends at the margin you specify with some of the options, no char less, no char more

pez19:12:35

It’s funny. Because the reason I went with cljfmt was that I thought zprint was crazy with all those options. (Before I realized it couldn’t really be used for what I needed it to do.)

pez20:12:09

@mseddon your crlf branch is not too different from mine. Is that a coincidence or did you jump of from my experiments?

mseddon20:12:48

Yeah I started with your crlf-dabble branch

pez20:12:52

Really happy that you got it working! I am going to merge my calva-lib branch onto develop now, so I’d be really happy if you could reapply your fixes on the new develop as well as on the calva-lib repo as a PR when I am done. It changes the dev process a bit (not everything for the better).

pez20:12:21

Got a bit scared there that you are actually me. πŸ˜ƒ

mseddon20:12:07

πŸ˜€ nope. I just stoled your poking. I'll rework that into a PR for ya tomorrow!

mseddon20:12:11

I may also start a totally different formatter more akin to clojure-mode in emacs and see how well that works

pez20:12:13

Great. It’ll be a relief when I get this one merged. I can’t really handle too many branches. My brain starts to hurt.

mseddon20:12:00

Crap, I had a contract a while ago that had somethibg like 20 different repos and craploads of branches. It was no fun πŸ˜€

mseddon20:12:29

Do take that crlf thing out for a spin on macos though, I only tested on windowz...

pez20:12:46

That’s where the CRLFs live, right? πŸ˜ƒ

pez21:12:06

But yes, people need to be able to work on the same code, regardless.

mseddon21:12:22

Yup. And it is barren of LFs so plenty of scope to screw up πŸ˜€

mseddon21:12:50

Did seem to cope with LF mode for me tho...

pez21:12:13

We’ll take it for a spin when it is applied to the new dev setup.

pez21:12:08

This package-lock.json crap, is it really needed for anything or should I .gitignore it?

pez21:12:20

I’m getting pretty tired of it.

mseddon21:12:42

Oh, hm. I think you can, let me just google I forgot :)

pez21:12:18

The computer tells me it should be checked in, but I fail to see why!

mseddon21:12:45

Ah. No. Tough, its supposed to be checked in apparently 😐

pez21:12:11

But unless there is a good WHY attached I might .gitignore it anyway.

mseddon21:12:58

The why is 'because npm is a freaking joke' πŸ˜€

pez21:12:56

Haha, Those seems like pretty good reasons, but why is the file changing all the time then?

pez21:12:47

To me it seems to be a moving piece, not a stabilizer at all. But, well, until I’ve read up more about it I’ll keep it checked in then.

mseddon21:12:43

It is a mystery. I have even had horrible merge conflicts in it in the past...

mseddon21:12:06

It should only update when node modules is tweaked, but perhaps shadow-cljs is messing with installing or updating packages?

pez21:12:50

I don’t think it is shadow-cljs.

mseddon21:12:16

Hmm I had to npm i when I checked out of course. It most likely got changed for me then. sigh.

pez21:12:22

@manas.marthi I saw those log errors you posted now. Missed it before. Don’t think I’ve seen it before, but will keep an eye open.

pez21:12:54

With the new dev process it will be a lot of npm i.

pez21:12:21

But anyway, if we get merge conficts in this file, let’s just solve them by picking --ours for everything.

mseddon21:12:17

Or just quietly git ignoring:)

pez21:12:49

Can that be done locally only?

mseddon21:12:47

I haven't looked into that.. could be done somehow probably, git has so many features...

pez21:12:29

It will be me publishing the npm module so maybe we can jsut .gitignore it and hope that it isn’t really needed for this project to be checked in.

pez21:12:15

Now I must get this merged before I fall asleep. Talk later!

pez21:12:56

Now it is merged and pushed. Scary! πŸ˜ƒ

pez21:12:34

Now I’ll need to updated the How to Contribute page. I wonder if anyone will still want to do that after reading it.

pez21:12:29

(package-lock.json gitignored for now, we’ll see if that was a bad move I guess.)

mseddon22:12:12

also i stuck a (time ,,,) around the cljsfmt call on the clojure - we're looking at ~50ms with that giant file, and the latency seems to be coming before the call, so after a big profile party I may actually track down where that's going πŸ™‚

mseddon22:12:00

(it may literally just be document.getText() tanking things, will check tomorrow)

mseddon22:12:53

thing is- if you start typing AFTER pressing return before vscode wakes up and applies the formatting, cljfmt is working with a stale copy of the document, and vscode ignores the update (literally, the newline indents at column 1 😞), so as files get bigger, on slow machines that is going to drive people nuts.

mseddon22:12:15

I think the next big priority is trying to get this happening instantly, and synchronously so it can't break/doesn't jump around on the screen.

mseddon22:12:12

I will open an issue to track this tomorrow once I have looked into it more, it seems we can do a pretty good job on this with cljfmt for now, it's our fault πŸ˜‰. 50ms is on a really fast machine though, but it's all about the # cores these days so hopefully it's not too bad.

pez22:12:17

The synchronous thing might prove difficult. The #parinfer guys have tried hard with that extension and yet not succeeded.

pez22:12:22

I think the extension is single threaded so the number of cores doesn’t play in too much into the mix, I think. Fortunatelly I am a poor guy with a really slow machine so I can test things in such environments.

mseddon22:12:23

then I shall schmooze with the vscode devs and beg for better support πŸ˜‰

pez22:12:37

They have too.

mseddon22:12:58

ah, goodie. πŸ™‚ so long as you're not experiencing that silly race we may be fine once we've fixed this silliness

mseddon22:12:13

(I just hate that little jump when you press return and it indents :()

pez22:12:34

I can get it to behave a bit weird quite easily by entering new lines quickly in semi-large files.

pez22:12:25

There is one way to avoid the jump that I know of. I tested it some even.

pez22:12:29

It is binding a command to the ENTER key and make it do both the new line and format things in one set of edits.

mseddon22:12:43

haah, obviously. although presumably that now breaks EVERY other extension πŸ˜•

pez22:12:16

No, vscode allows for pretty high precision for when a key binding is active.

pez22:12:15

For instance, enable strict mode in Calva Paredit and it will bind paredit.delete to the backspace key.

mseddon22:12:33

oh nice, so it's quite emacs-y in that respect, neat.

pez22:12:12

Still, I didn’t have time to fix the issues I ran across when I experimented with that newline thing.

mseddon22:12:53

that's promising, I will have a look at that after I stop performance tanking on large files then!

pez22:12:09

I don’t even remember what it was. But I am pretty sure I didn’t see anything suggesting it was a no-go.

mseddon22:12:32

honestly those are now the only two 'yuck' moments I am having with it, formatting seems to be acceptable for me now using my botched cljfmt and crlf kludge

pez22:12:46

Probably full of typos. I am getting a bit tired.

mseddon22:12:08

I'll PR them over breakfast then πŸ˜‰

pez22:12:13

Yes, I should merge the new cljfmt master too.

mseddon22:12:12

I haven't tried weavjester's new master actually, but he kept the tests in, so I guess we're free now

pez22:12:27

It sure sounded that way.

pez22:12:15

Tell me a bit about that idea you had with another take on a formatter, if you have some time.

mseddon22:12:15

he basically refactored that #156 patch and my kludge and generally improved the look of things, so yeah πŸ™‚

pez22:12:38

He is a magician when it comes to making code look beautiful.

mseddon22:12:40

oh, well it's a bit rough at the moment, honestly I like the idea of using cljfmt or zprint if we can

mseddon23:12:16

it was more borne out of frustration from the performance, which I have since discovered is happening on our side, not weavejesters πŸ˜‰

mseddon23:12:30

i even looked at the paredit.js indentation stuff but then discovered it brought us back to terrible cond formatting...

pez23:12:47

I wonder. When I tried it with only cljfmt involved it got significally slower if I didn’t take care to select only the encosing form for it to format.

mseddon23:12:00

ah it may well do- these functions are tiny

pez23:12:44

We need to make paredit use calva formatter for it’s indenting rather. It is one reason why I have complicated the dev process so much. πŸ˜ƒ

mseddon23:12:37

so yeah that paper is interesting- it patches up an AST for an LL(1) parser incrementally, there are various improvements to that but it may be enough. I need to go over it properly but it doesn't seem too crazy to implement

mseddon23:12:02

but at the same time, better to use a fast off the shelf formatter if possible so we can concentrate on protorepl awesomeness πŸ˜‰

pez23:12:20

On a possibly related note. I have hunted around for a clojurescript paredit. No luck. But in my hunting I found one implementation in Clojure using zippers.

mseddon23:12:23

I really want the formatting to just rock though. emacs is the only editor I have ever found acceptable for lisp code so far

mseddon23:12:42

ooh. maybe we can stick a 'c' on the end of the filename πŸ˜‰

pez23:12:52

I am happy for Calva Formatter that you have found your way here.

mseddon23:12:39

I have some old timer's using emacs I work with, so clojure is not a hard sell, but damn, we need a wonderful vscode experience for everyone else πŸ™‚

pez23:12:42

Yes, I started to do some work with that with the paredit code used in Counterclockwise, but realized I was spreading myself to thin and stopped it.

mseddon23:12:09

i thought of some really stupid solutions that are a bit of work but maybe not horrible

pez23:12:19

stickin a cat the end, that is.

mseddon23:12:03

it may be that for this stuff cljs is just too slow

mseddon23:12:15

so possibly a ts formatter etc.

pez23:12:15

But we should maybe hold our horses some to see what Kim Kinnaer comes up with.

mseddon23:12:24

agreed πŸ™‚

pez23:12:40

Regarding performance tuning Calva Formatter that is.

pez23:12:11

One of his ideas was to give us an interface where we fed zprint a zipper. Which makes me think that maybe if we can keep a zipper backing the buffer all the time, and the text mainly is a projection of the zipper, then we would do most everything that way, paredit and formatting included. Maybe parinfer would still be something we didn’t do that way, I don’t know.

pez23:12:17

VS Code’s stupid ontype-API might stop that idea, of course.

mseddon23:12:21

actually honestly once cljfmt gets it's edn into a zipper, parinfer should be pretty trivial to implement

pez23:12:05

(The projection of the zipper, that is)

mseddon23:12:08

it uses https://github.com/xsc/rewrite-clj under the hood to go from source text -> ast

pez23:12:39

Yes, or rewrite-cljs actually

mseddon23:12:47

yeah, the pair of them πŸ™‚

mseddon23:12:52

actually he includes both

pez23:12:01

But we use the cljs one. πŸ˜ƒ

mseddon23:12:16

naturally πŸ˜„

pez23:12:31

Calva Formatter uses a patched cljfmt using a patched rewrite-cljs. πŸ˜ƒ

mseddon23:12:34

of course we could throw all that away and boot up a jvm clojure in the long run if it made sense in 5 years

mseddon23:12:40

but right now, it ain't broke πŸ˜‰

mseddon23:12:00

this needs to stop πŸ˜„

pez23:12:16

rewrite-cljs is broken, actually. But I patched the most important breakage.

mseddon23:12:24

oh really? huh.

mseddon23:12:53

I keep finding you all over github today πŸ™‚

pez23:12:54

It is also abandoned. So I have suggested to @slipset to adopt it in CLJ-Commons.

pez23:12:15

Haha. Yes, that’s the one.

mseddon23:12:16

huh that's odd, what clojure are you using?

mseddon23:12:46

well, I find I can generally (require [http://clojure.xxx]) in cljs

pez23:12:16

Indeed. The thing is that it doesn’t. My patch adds that.

pez23:12:28

And only that. πŸ˜ƒ

mseddon23:12:59

I read the diff backwards. It is way too late πŸ™‚

pez23:12:33

It seems to work fine in most cases, but for some configs of shadow-cljs the crash is there.

mseddon23:12:17

that's odd, it doesn't read to me as a valid file (technically)

pez23:12:22

So old calva-fmt dev process didn’t need the patch. Very odd.

mseddon23:12:38

like, if someone didn't require before you do, how do you know it is loaded? XD

pez23:12:55

CLJS is s bit funny that way.

mseddon23:12:10

yeah, I haven't really pushed the edge cases too hard yet

pez23:12:47

I guess it was just luck that something required it before it hit that part of the code.

mseddon23:12:01

scary eh? πŸ™‚

pez23:12:05

But when building an npm-module that luck wasn’t there.

mseddon23:12:10

that should show up in some hypothetical linter

mseddon23:12:35

yeah exactly

pez23:12:04

It is one of the LightTable people who ported rewrite-clj to cljs. Maybe they never added a linter? πŸ˜ƒ

mseddon23:12:17

πŸ˜„ they never quite finished an editor

mseddon23:12:22

was a cool idea though

pez23:12:28

But, really it should be made into cljc.

mseddon23:12:37

that just feels like the right way.

mseddon23:12:07

license is MIT, so technically rewrite-clj could just Ctrl+C Ctrl+P

mseddon23:12:00

Okay, let me open an issue tomorrow on rewrite-clj and canvas the idea over there too

pez23:12:15

great idea! Now, must sleep.

pez23:12:28

πŸ’€

mseddon23:12:31

πŸ˜‰ yes you should. Catch you tomorrow!

mseddon23:12:09

I presume you are familiar with https://github.com/clojure-emacs/orchard. Anyhow, I should head out too. πŸ˜‰

mseddon23:12:31

(this is why I wonder if longer term we look at a jvm hosted https://microsoft.github.io/language-server-protocol/overview and strap into that, since all the emacs goodness goes there, and I can try and move a lot of the .el stuff in cider over there ;))