Fork me on GitHub
#calva
<
2018-12-15
>
pez09:12:48

@mseddon: If you need some variation while looking at that as-you-type indentation, there is this: https://github.com/weavejester/cljfmt/pull/77 😃

pez09:12:42

This is why I have a patch of cljfmt. I have applied this PR. There are lots of issues with it, though. Apart from the ones James Reeves mentions in the comments the alignment sometimes goes quite nuts.

mseddon11:12:30

oh dear 😄

mseddon11:12:58

I do like that feature though

mseddon13:12:59

so I nearly have a mirrored copy of the document maintaining sync with what vscode has

mseddon13:12:32

(just the text lines currently, but this is the main fiddly bit).

mseddon13:12:00

in reality the text itself needn't be copied, since once I apply the insertions and deletions, i have the same contents as doc, but it means my indices will be right for e.g. lexical items

mseddon14:12:25

yeah, it works, except when formatters kick in, for some reason i desync.

pez14:12:58

Are you using a command bound to the enter key to trigger it?

mseddon14:12:19

oh, i'm not formatting yet 😉

mseddon14:12:28

I'm tracking what i need. This is part 1 😉

mseddon14:12:04

I am trying it out in e.g. a typescript file, running the command from the Ctrl+Shift+P menu

mseddon14:12:26

oh, actually.. derp

pez14:12:50

I'm curious about what ”tracking” means.

mseddon14:12:10

🙂 basically mirroring the state of the file from the events

mseddon14:12:51

this means that I can re-parse the bits that changed, without re-doing the whole buffer

pez14:12:01

Which events?

mseddon14:12:14

the important one is onDidChangeTextDocument

mseddon14:12:27

but I use open/close document to clean up, also

pez14:12:24

Cool. Pity there is no beforeChangeDocument

mseddon14:12:27

nice! it was a stupid bug, got that working

mseddon14:12:36

it's alright like this tbh

mseddon14:12:25

sort of looks like this for now

mseddon14:12:45

ClojureSourceLine will instead contain lexical tokens and inter-line state information

mseddon14:12:05

despite being called for every keystroke, there's really no performance issue, since it does so little work

pez14:12:13

I'll check it out when I am by a computer.

mseddon14:12:29

It is not earth-shattering code 🙂

mseddon14:12:38

But at least it works so far...

pez16:12:31

I tried to implement a bit more as-you-type Parinfer using that event, but got tripped on figuring out the previous text, since the API is a bit lacking. But your method seems to allow it


mseddon18:12:17

ah yeah, early days for now

mseddon18:12:23

onto the lexer atm

mseddon18:12:09

it's certainly not a full clojure lexer, but it grabs the important bits, so we should have a nice structure to query 'where does this expr start', 'where does it's parent start' etc

mseddon18:12:17

In the long run i won't actually be storing the text in a ClojureSourceLine, since I don't need it, just the tokenization and lexer state / parenthesis stack

pez19:12:32

I am at where I am bug compatible with your https://github.com/mseddon/calva-fmt/tree/crlf-refactor-fix , it is interesting how tricky it is to get it right!

mseddon20:12:56

Horrible isn't it? 😂

mseddon20:12:39

It may be that those bugs were never fixed

mseddon20:12:16

But I was floundering trying to work out why those tests were failing.

pez20:12:11

The tests pass. But they do not test new-index for CRLF files. Which is what is not working.

mseddon20:12:38

Ah. Boo. Do you have a branch for this? I'll take a look tomorrow

pez20:12:45

crlf in calva-lib.

pez20:12:18

I have found out how to kill all top-level indenting, finally.

pez20:12:21

Or, rather, how to stop vscode from making any indentation at all.

mseddon20:12:01

\o/ spill those beans? What's the trick?

mseddon21:12:55

Also I realise, if this formatter experiment works, i should try and look at preventing the current parinfer compatibility issues

pez21:12:57

EnterAction has a removeText property of type number where you can specify how many characters to remove from the indentation. I am setting it to Number.MAX_VALUE haha.

mseddon21:12:31

😂 a blunt but effective tool!

pez21:12:09

It is funny how IndentAction.None means to copy the previous line’s indent.

mseddon21:12:57

Yeah the enum there is not great. KEEP would have been my preference

pez21:12:26

And a None that did what it sounds like it should do.

mseddon21:12:17

But I grew up with the Win32 Platforn Sdk, so to me M$ have seriously improved their API's :)

pez21:12:55

A drawback with my blunt, but effective, tool is that it will mean the cursor always flickers on enter.

mseddon21:12:06

Excuse my ballistic apostrophe there :)

mseddon21:12:23

Yeah I hung out in the vscode extension gitter but it is dead. :/ need to find some knowledgeable vscode contributers.

mseddon21:12:47

I haven't tried stack overflow, but from what I can see there isn't a huge community wrt extension development there.

pez21:12:35

The vscode Slack is somewhat populated.

mseddon21:12:58

Ah, I didn't find that.

mseddon21:12:45

A lot of my issues could trivially be solved by the relevent Microsoft employee with very low effort on their part I feel.

mseddon21:12:41

❀ ta, I will try over there.

pez21:12:07

No MS employees there, of course. But the #vscode-extension-dev channel is quite helpful.

mseddon21:12:53

Battle hardened extension developers are equally if not more useful

pez21:12:25

Even though it seems I constantly move around in uncharted terrain so many of my questions get zero answers.

pez21:12:13

The GitLense dev is the hero of that channel. I can’t count how many times he has saved my sanity.

mseddon21:12:02

I find the lack of vscode extension blogs... disturbing;)

mseddon21:12:31

It is weird my favorite editor doesn't have that community yet. Although I suppose I haven't been using vscode for that many years yet.

pez21:12:04

I have been wondering about this too. Where are all the fellow extension devs hiding?

mseddon21:12:03

Quite. And it is in Microsoft's interest to have this publicised

mseddon21:12:34

It will pick up I am sure. But there is a bit of a hole right now. Maybe one day we should start a vscode blog...

mseddon21:12:19

Btw are you messing with other vscode extensions? I am planning on writing a bunch mostly to exercise the API further, even if they just put nyan cat all over my buffer;)

pez21:12:34

I have way too little time to spend on Calva so haven’t played around with any other extension ideas. Mostly I have found myself spending time on trying to fix stuff that Calva depends on. Which has been very rewarding in terms of learning.

mseddon21:12:00

😃 well. I hope to at least spread some of that time. VSCode's popularity and the fact we get a html interface makes Calva rather well positioned to recreate some of the lisp machine experience.

mseddon22:12:17

I desperately want to get to that part but we urgently need to fixup the boring shit.

pez22:12:06

I can do the boring shit. Division of labour FTW!

mseddon23:12:26

metal I am into the boring shit too. Let's get MIT recommending calva ;)

mseddon23:12:15

That said I think 6.01 is likely to stay python for a while. One day...

mseddon23:12:06

Quality over quantity is my priority for the next few months. Then... datify and nav all the way down 😀