Fork me on GitHub
#conjure
<
2020-05-11
>
dave01:05:59

this is just my opinion, but i've never felt the need to have a debugger when i'm developing in clojure. REPL driven development is convenient enough that it's easy to insert print statements and re-eval

nate03:05:29

Exactly.

nate03:05:59

Logging and print statements are the lion's share of my debugging. There are a few other cool developments that I've tried (like https://github.com/vvvvalvalval/scope-capture), but none have taken ahold of me.

dharrigan04:05:02

when working with interop, I often have a simple project open in IntelliJ with the libraries set as dependencies. Then I have the normal JVM debug settings running and IntelliJ listening on breakpoints. I start the repl running with the JVM debug parameters running. I can then debug whatever 3rd party libraries I use, combined with repl debugging as mentioned above makes for a powerful combination.

Olical10:05:57

Yep, been working full time in Clojure for years, never needed a debugger. Just eval, tap> (I need to add this) and print. I may well add CIDER debugger support at some point (I think it has a stepping debugger?) (edit: Realised this comes across bad if there's someone who wants or needs a debugger, don't want to claim that "real" Clojure devs don't need debuggers. Was really just trying to say that I've never felt the need for one so I never focussed on adding one to Conjure. More than happy to consider adding it though! I am not trying to say that you shouldn't need one)

The Continium10:05:05

Hi - Are there any plans to start a “default” repl if one cannot be found ?

Olical10:05:52

It's on my list! But I'm holding off on it for a while since there's a LOT of other things to do and I see it as an optional extra that just saves you running another terminal. I think it's actually worse to run your REPL from your editor, especially if it's Neovim since the process is usually disposable and easily restartable. But, I can still see the need for it in some scenarios, so I'm not against it as an option.

Olical10:05:29

I would love to have support for things like babashka too right out of the box.

Olical10:05:12

One of the main goals I have for Conjure is to be as easy to use as possible by default (so a total Clojure newbie at a Clojure Bridge event or something) could pick it up and start evaluating within minutes. Just like VSCode + Calva but Neovim I guess. Having a button that starts the REPL and gets you evaluating right away is part of that.

Olical10:05:09

I want Conjure to work out of the box for beginners, but still be a power tool experienced users can never hit the limits of through extra plugins that hook into it etc.

💯 4
Olical10:05:31

Also, what do you think about automatically downloading, running and connecting to babashka on eval with no connection :thinking_face:

The Continium10:05:39

sounds good - makes it work out of the box; certainly much easier for the beginner

The Continium10:05:48

What about a fallback port if the repl port file cannot be found ?

Olical10:05:43

Hmm, do you mean a setting that's like a default for your machine?

Olical10:05:04

So if there's no portfile it tries that port?

The Continium10:05:45

that way if you are experimenting outside a project you get a connection to a “sandbox” repl

The Continium10:05:33

… so long as you have it running.

Olical10:05:48

Hmm, you can also use :ConjureConnect [port] on the first time you open a Clojure file or when you hit a mapping :thinking_face:

Olical10:05:11

You can also configure the portfile list to check for another portfile like .default-clojure-port and put that in your home directory.

Olical10:05:35

Just trying to think of ways you could do this within the current framework rather than adding more mechanics?

The Continium11:05:23

I think both of those can work; can I configure the port file list now ?

Olical11:05:28

Yep, so if you run :ConjureConfig clojure.nrepl/connection.port-files [".nrepl-port" ".shadow-cljs/nrepl.port" ".conjure-port"] it'll then look for .conjure-port if the other two fail. In every directory above yours, including your home directory.

Olical11:05:51

I think I might just add one thought as a default :thinking_face:

Olical11:05:46

What do you think about that file name since it's Conjure specific?

Olical11:05:02

.conjure-port, or maybe .conjure-default-port.

The Continium11:05:24

.conjure-default-port; I know this may not fit with what you have in place but I’m not a fan of littering the home directory ( it all gets lost ) - I would personally prefer options like this to sit in the XDG_CONFIG_HOME/conjure

Olical11:05:28

Or if I add a secondary search for the XDG config dir you could just create a .nrepl-port file in there :thinking_face:

Olical11:05:34

I agree that littering ~ is bad

The Continium11:05:49

I like the that

Olical11:05:29

Keeps it simple, gives you more options, doesn't add too much complexity / things that require more explaining and learning. Will still document this concept, but it's on top of existing ideas which is nice.

The Continium11:05:48

yes - it’s clear what you have setup

Olical12:05:21

Okay, that's on develop! So you can now use ~/.config/conjure/.nrepl-port as a fallback

Olical12:05:28

It respects XDG_CONFIG_HOME

Olical12:05:41

If that's working well for you I may well tag a release 😄 (on develop right now)

The Continium19:05:47

It works for me 🍻

Olical11:05:39

@dharrigan Thank you so much for your input! I've incorporated basically all of it with the odd tweak here and there. It's massively appreciated 😄 I hope this helps people get into Conjure and interactive evaluation as a concept!

dharrigan11:05:57

happy to help where I can

Olical11:05:01

Would someone without Fennel support in their Neovim be so kind as to test :ConjureSchool for me? It should be kind of highlighted like Clojure since that's the fallback I use. I've tested it without the filetype support and it works fine, I just noticed someone saying it didn't work and it makes me worry I have a case of "works on my machine".

Olical11:05:19

It should show a warning about not having the filetype and falling back to Clojure syntax.

Olical11:05:33

Pretty sure Clojure is built in.

dharrigan11:05:26

I don't have fennel

dharrigan11:05:37

and it said it was falling back

dharrigan11:05:57

(that was yesterday btw)

Olical12:05:56

Nice! Glad to hear it. I think @comparalf was having issues :thinking_face: maybe it wasn't with the school but was with the evaluation of Fennel files in general.

Olical13:05:39

So I'm putting together a one liner script that allows you to demo Conjure without even installing it with the school.

Olical13:05:00

curl -fL  | bash
and away you go!

Olical13:05:19

If develop is working well for a few people other than me I think I'll release this. @matthew.newland let me know if that port file default thing works well 😄

RafaMedina14:05:16

E492: Not an editor command: ConjureSchool jeje

Olical14:05:03

Ah that sucks! I'll have to check again, was working well for me. Probably to do with runtimepath stuff.

RafaMedina14:05:18

Maybe this extra information helps: Macosx iterm nvim: 0.4.3

Olical15:05:10

Hmm should be fine really. It's probably to do with whatever plugin manager you're using. I add Conjure to the runtimepath temporarily and there's probably something that's reverting that from your dotfiles. I think.

Olical15:05:19

Maybe I need to add it to RTP later is all.

RafaMedina16:05:27

Just to clarify, I use vim-plug

Olical17:05:13

Hmm, same as me then. Main difference is Linux / Mac. I wonder if it's /tmp behaving differently on OSX?

Olical17:05:39

How's that? I wait for VimEnter now which should give it time to load the plugin properly from the runtimepath.

Olical17:05:44

(pushed to develop)

Eugene Tyurin15:05:39

@dave @nate While it's true that splicing printing statements might take care of 90% of debugging needs, it is still nice workflow to be able to just debug code by stepping through it. Occasionally, might even want to override a value/inject a value. 🙂 Personally for me, debugging is preferred because I'd rather examine values being passed through instead of bulk-printing large structures and searching for missing fields or fields that have irregular values. In other words, when my data is irregular and has "corner cases." Finally, remember that "old" Lisps had debuggers and were quite proud of them. :-)

dave20:05:50

That's fair. I totally recognize that a lot of people really like debuggers, I just never really took a liking to them 🙂 I have played around with Common Lisp a little and the interactive debugger is really unique!

dave20:05:01

i played around with sayid in vim a while back, but wasn't quite able to get it working. i think that was before this blog post + 3rd party plugin

Eugene Tyurin20:05:55

@dave Tried that plugin last night. It requires vim-fireplace. I didn't spend time trying to disentangle the dependency.

sogaiu16:05:39

i also appreciate having a debugger option. there is a scenario i'm curious whether someone has figured out how to work with well via only the repl. if one uses cljs to write a plugin for atom or extension for vscode, the host application (the editor being extended here) is sometimes in a position to be triggering one's code. that is, the developer doesn't get to directly trigger code (it's "don't call us, we'll call you") and one or more input parameters are decided by the calling program and are not easy or practically impossible for a developer to fabricate (e.g. one of them might be editor window state). any thoughts on this type of situation?

Olical17:05:30

Thanks for the inputs! I definitely see the value it in it, I won't want to rush the implementation though. If there's great support for it in nREPL (99% sure there is :D) then I'll just have to think up a nice set of mappings and interactions.

Olical17:05:36

Maybe it won't be so bad!

keoko17:05:22

I am having an issue in lesson5 school.lesson-5-message$ Compile error in 'message' /conjure-school.fnl:2: unknown global in strict mode: message$ stack traceback:$ [C]: in function 'error'$ ....vim/plugged/conjure/lua/conjure/aniseed/deps/fennel.lua:484: in function 'assertCompile'$ ....vim/plugged/conjure/lua/conjure/aniseed/deps/fennel.lua:716: in function 'symbolToExpression'$ ....vim/plugged/conjure/lua/conjure/aniseed/deps/fennel.lua:1068: in function 'compile1'$ ....vim/plugged/conjure/lua/conjure/aniseed/deps/fennel.lua:2160: in function 'compileString'$ ....vim/plugged/conjure/lua/conjure/aniseed/deps/fennel.lua:2286: in function ?$ [C]: in function 'anic'$ ...im/plugged/conjure/lua/conjure/client/fennel/aniseed.lua:175: in function ?$ [C]: in function 'pcall'$ ...e/.vim/plugged/conjure/lua/conjure/aniseed/nvim/util.lua:86: in function 'anic'$ ...im/plugged/conjure/lua/conjure/client/fennel/aniseed.lua:183: in function 'word'$ [string "<VimL compiled string>"]:1: in main chunk$

keoko17:05:14

I think it is my mistake 😅

Olical17:05:58

Ah! Okay, I thought maybe it was how the word boundaries were defined, like, sometimes you can set up vim to consider - a break in a word. Which you don't want with lisps

keoko17:05:29

If I place the cursor in “school” it works, but if I place the cursor in “lesson” it doesn’t

keoko17:05:05

yes, it looks like

keoko17:05:39

Although I don’t have any special vim customization in that regard

Olical17:05:06

Hmmm, something I'll have to account for

Olical17:05:19

Does <prefix>ew work properly for you?

Olical17:05:57

I don't want to change how your words are defined for you, but I can try and account for custom ones.

keoko17:05:09

with <prefix> you mean <localleader>?

Olical17:05:26

Yep, by default

Olical17:05:32

I say <prefix> because you may change it.

keoko17:05:53

let mapleader = “\\” let maplocalleader = “,”

keoko17:05:45

if I type “,ew” in any letter of “school” it works

Olical17:05:05

Ah, fun! So there's two things at play

Olical17:05:11

I guess ,EiW works too

Olical17:05:16

Since that goes to whiteapce

keoko17:05:39

but if I type it in “.lesson-5-message”it does not work

Olical17:05:46

Hm, fun! So mine probably works fine due to vim-sexp or something being installed.

keoko17:05:02

,EiW looks like it works but the HUD dissapears verty quickly

Olical17:05:34

I'll alter the tutorial to work for everyone I think. Not sure about changing how word boundaries are defined for Conjure users although it may be the best approach.

Olical17:05:53

And yeah, anything that moves the cursor (like motions or text objects sometimes) will hide the hud right away

Olical17:05:04

Not sure how best to get around that one, it's a fairly rare issue

keoko17:05:36

I’ll try to install vim-sexp to confirm it

keoko17:05:55

by the way, not sure if I am doing something wrong…

keoko17:05:28

but in lesson6 if I type V,E it works

keoko17:05:07

but with v%,E it doesn’t when my cursor is in the open parenthesis

keoko17:05:12

I think it disappears quickly with the lowecase-v selection

Olical17:05:40

That's because your cursor gets moved if it's at the end of the visual selection. It's teleported to the front of the selection.

Olical17:05:46

Which triggers the HUD clear

keoko17:05:50

It’s what you said before.

Olical18:05:16

Yup, I'd like to find a way to prevent it at some point!

Olical18:05:28

Super hard to do without introducing weird race conditions though I think.

keoko18:05:55

the ConjureSchool is very cool!

Olical18:05:21

Yay! I'm glad to hear that 😄 I'll try to address these HUD issues at some point (although HARD) and the word boundary issue. Maybe I'll set it for you to something nice for lisps but :thinking_face:

Olical09:05:45

So this is defined by iskeyword and the built in Clojure support apparently sets this up correctly. Here's mine: @,48-57,_,192-255,?,-,*,!,+,/,=,<,>,.,:,$

Olical09:05:59

I would imagine you've modified yours or some other plugin has?

nate17:05:40

oh oh, looks like the long string printing is breaking again:

#_(println (apply str (take 2000 (repeat \x))))
results in (lines trimmed for clarity):
; eval (root-form): (println (apply str (take 2000 (repeat \x))))
; (out) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
; (out) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

nate17:05:49

; eval (root-form): (println (apply str (take 2000 (repeat \x))))
; (out) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

nate17:05:58

full output ^^

Olical17:05:14

Ah interesting! But easy to repro

nate17:05:15

oh, sorry, this is on 016d287

Olical17:05:18

I'll tackle this sooooon

nate17:05:25

(latest commit on develop)

Olical17:05:44

I'm sure I've done something silly

Olical17:05:50

I'll try to put a test in for it too :thinking_face:

nate17:05:18

awesome, thanks!