Fork me on GitHub
#calva
<
2020-03-01
>
sogaiu04:03:15

@pez in processing clj-ish files from github using tree-sitter or clj-kondo, here are a few things that come up that can lead to errors / warnings: * template files - people do things like: (ns {{namespace}}.rendering or :{{name}} (mustache?) -- small number of instances of other styles too * missing, misplaced, or incorrectly placed closing delimiters * non-clojure text in (comment or #_ blocks * questionable(?) symbols and keywords - things that the repl might accept, but for which i didn't find a statement of support (e.g. # in keywords, keywords with multiple slashes in them)

pez09:03:03

Thanks! I've saved these observations. Working with setting up tests for Calva's paredit lexer right now.

pez09:03:33

Do people still name the template files .clj/cljs?

sogaiu12:03:09

in short, yes. i don't know if other file extensions are used for template files -- i'm only testing files named .clj, .cljs, and .cljc.

sogaiu12:03:20

in the samples collected, i have about 100,000 .clj files, 20,000 .cljs files, and 8,000 .cljc files.

pez12:03:45

Haha, awesome. Publishing it as a repo of it's own? I have just made some changes to my paredit lexer/cursor and it would be nice to have a sea of real world samples to throw the changes at.

sogaiu12:03:52

the total size of what was fetched is over 30 gigs

😱 4
sogaiu12:03:31

i adapted andyfingerhut's recent investigation work to come up with the git repository urls to fetch and then fetched them: https://github.com/jafingerhut/haironfire

pez12:03:33

Here's a demo of the changes, btw. I want data readers to be toknized together with the forms they annotate. As my lexer is line based, I can't have it fully my way when the reader marker is on a line of its own. But for that I modified token cursor a bit so that at least it navigates correctly for the basic forward/backward sexpr cases.

sogaiu13:03:05

i guess here, "reader marker" == "tag" (e.g. #foo)

pez13:03:20

It also makes us highlight ignored data reader annotated forms correctly.

pez13:03:48

Yes, maybe they are called tags.

sogaiu13:03:35

ah yes, i see the stacked discard / ignore forms and the subsequent gray coloring.

pez13:03:36

Exactly. In current Calva an ignore form will only grey out the tag.

pez13:03:18

Also in that gif is shown that if the tag is on the same line as what it tags. Paredit drag-up and push-down sexp works also in the presence of tagged list forms.

pez13:03:50

But not when the tag is on the previous line, but hey. ¯\(ツ)

sogaiu13:03:32

that sounds like it would be nice if it worked better, but i confess to not being a paredit or parinfer user, so it wouldn't affect my use 🙂

pez13:03:26

I'm such a Paredit junkie that I will eventally make a paredit extension that works for all programming languages I use. It's horrible not having it in html/js/css and such.

sogaiu13:03:41

i do use some structural navigation features in some editors, but i find that i don't use most of the other features. i also find the keybindings chosen in various places to override some basic sequences that i have been using for other things so i end up not using it so often. perhaps if i could find a simple enough extension or write one myself i'd use this type of thing more.

sogaiu13:03:14

i guess you must use a lot of paredit's features 🙂

pez13:03:35

Calva's keybindings for paredit are pretty carefully choosen. Just sayn'

sogaiu13:03:45

i agree tree navigation and editing would be good in non-lisps too.

pez13:03:58

I end up learning them as I test the stuff I create. 😃

sogaiu13:03:41

in vscode i use ctrl-home and ctrl-end to go to the beginning and end of an editor respectively. this also works in some other places.

sogaiu13:03:50

i don't want to give up that type of thing.

pez13:03:57

”Why are people nagging me about raise sexp?” ... implementing it anyway_ ... ”Oh, that's why!” ,,, can't live without it.

pez13:03:29

ctrl+home/end still works with Calva paredit, no?

sogaiu13:03:55

https://calva.readthedocs.io/en/latest/paredit.html suggests they are bound to something else -- or may be i misunderstand?

pez13:03:43

Yeah, you are right. It's a bit of a mistake, since I am a mac user and use cmd+home/end.

sogaiu13:03:44

i appreciate this bit of advice though:

If you are new to Paredit, consider starting with learning the Slurp Forward (pull in the next form into this form) and Barf Forward (push the last form out of this form). It will take you quite far.

sogaiu13:03:06

that's pretty much all i use for the editing part.

sogaiu13:03:56

i end up having to do things on multiple platforms and some things are quite hard to shake -- on windows there is a fair bit of this type of stuff.

pez13:03:59

But you can rebind those. And I can consider making a keymap where I correct that mistake.

sogaiu13:03:41

i used to rebind, but i don't any more -- it doesn't seem worth it to me.

sogaiu13:03:54

so i tend to forgo features or use the command palette.

sogaiu13:03:13

i find i can remember the names of commands or locations in menus better than key sequences.

pez13:03:26

Yeah the command palette is a saviour.

sogaiu13:03:33

it really is helpful.

sogaiu13:03:38

i use helm when using emacs.

sogaiu13:03:50

i was a die-hard quicksilver user when i used to use macs more frequently.

pez21:03:03

Dear Calva-friends: A new Calva is out - v2.0.79. Main change is that reader tag thing mentioned above, and summarized here: https://github.com/BetterThanTomorrow/calva/issues/570 It is a rather foundational change, so please be alert and let me know if something that used to work seems broken. The release also brings a change in the tmLanguage grammar regarding highlighting of keywords. They are now actually highlighted by most vscode themes.

calva 4