Fork me on GitHub
#calva
<
2020-02-24
>
Filipe Silva12:02:03

have you noticed namespace requires not being highlighted sometimes?

pez12:02:19

Can't say I have. Is it new?

pez12:02:42

Not highlighted as in no rainbows?

Filipe Silva12:02:43

I think not, I'm pretty sure I saw it happen before

Filipe Silva12:02:57

they show up like this

Filipe Silva12:02:02

then when I click on the editor

pez12:02:34

That is probably new...

Filipe Silva12:02:33

I think I only see this happening when: • I have multiple editors side by side • I am switching between them • I am alt tabbing • I am scrolling up and down

pez12:02:55

Highlight is quite fokused on the currently active editor. Maybe that is what is (not) going on...

pez12:02:58

What if you scroll the content without clicking there?

Filipe Silva12:02:42

ok, I think I have a more detailed repro now that I write those things down: • open two editors side by side • scroll them down enough that you don't see the requires • alt tab to another window • alt tab back to editor • scroll both editors without clicking them • the one that wasn't active won't have rainbow parens/brackets on sections that were not visible

Filipe Silva12:02:56

yes it happens when scrolling without selecting

Filipe Silva12:02:15

and not just on require stuff

Filipe Silva12:02:20

I think it's everything

Filipe Silva12:02:41

then I made the editor active

Filipe Silva12:02:51

I don't think this is an important thing, I just thought I'd mention it because I noticed it

pez12:02:59

Yeah, Calva only does that work on the active editor. An issue would be nice. It's fixable with some amount of work. But also, the issue can help people figure out that we know about it.

Filipe Silva12:02:05

don't even need to alt tab really

pez12:02:02

Awesome. Thanks!

hoppy19:02:36

meh, there is an issue in 2.0.77

hoppy19:02:01

best way I can describe it is that the rainbow'ing applies to the visible buffer, not the file.

hoppy19:02:09

If I have a long function, and it shows balanced, fine. Then I scroll so that the top 'defn' line goes off the top of the screen, it shows one imbalanced paren (at the end). As I scroll more off the top, it looks like that situation holds

pez19:02:35

Rainbows are now applied to the visible buffer, yes. But it tries to take enough of the context outside to not be thrown out of balance when forms start above the visible top. Can you repro with some open source code?

hoppy19:02:50

I just discovered that yes, in fact, there were unbalanced parens, but waaayy back in the (ns)

hoppy19:02:00

still seems like odd behavior

pez19:02:10

OK. Yes, it relies on balance above the rainbowed range, and it is a bit undefined what happens when there is a lack of balance. Can you try this build and see if it handles the situation better or worse for that case you have there? https://4098-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.78-dev-5ea99c55.vsix

pez19:02:52

Anyway, generally, if I have done things right, a bracket marked as imbalanced should mean that there is something out of balance in the file, above/before the marked bracket. Hopefully close, but in the case of having scrolled a bit down from the actual error it can be quite a bit away.

pez19:02:42

In the build I just linked to I go some extra mile to not be thrown out of balance. Theoretically it improves 50% of the cases. But the important part is that I think I might have a chance of always knowing where the error originated and thus options to surface that knowledge to the user. It is all still just at the edges of my mental grasp of it, but I can ”sense” this possibility. Hopefully my intuition is founded in something in reality. 😃

calva 4
hoppy21:02:21

I can't tell much of a difference - honestly - at least not in that particular file.

pez21:02:27

Probably because your imbalance was amongst the other 50%. 😎