is there a way to tell calva to treat forms the same way comment is w.r.t. the command that evals the form you're in?
I’m assuming the way Calva treats the content of the comment form as being top-level? I.e. so that you could specify a symbol foo which would behave like:
(foo
(a (b
c|))
)
Cursor at | and evaluate top level form would call a?
The answer is no, but I think it should not be too hard to implement. What say you @jonurnieta? You were the last one seen wandering into this territory. 😃I think I'll try my hand at doing it tbh
and yes, it is indeed that
Issue welcome. > I think I’ll try my hand at doing it tbh Taking this as you want to add it to Calva? Would be awesome. Please start with an issue. It’s where we keep our problem statements.
It does not seem too hard, with some config a user could add the custom comment forms
From what I see, currently the way this happens is with a hardcoded === 'comment' check.
I wonder if one could have like a customCommentForms: ["foo", "bar/baz"] kind of config and replace all such checks with a lookup into it (I see there is a way to resolve aliases via an aliasMap as well, maybe that comes to play)?
We could use current ns aliases config for requires
these seem to be the places that care about this:
src/extension.ts::328
src/cursor-doc/token-cursor.ts::989
src/cursor-doc/token-cursor.ts::800
src/NotebookProvider.ts::67 ; oh no
src/calva-fmt/src/format.ts::239Yes, I was talking about aliasMap. You have examples of how is used in pairs config
yeah indeed
so my plan would be:
• add a new config key: customCommentForms: string[]
• create an isCommentFormHead(symbol) function somewhere sensible that checks if symbol === comment , or else tries to find the symbol or the resolved alias thereof in customCommentForms
• replace all checks above with isCommentFormHead
Looks good to me
my only question is, does foo/bar get parsed as a token or does it get parsed as [foo, /, bar]?
E: looking at the lexer I'd hazard the guess it does get parsed as a single token
I think you’ll get string foo/bar
yeah that is my guess as well
In pairs selection/drag you have a fn where that foo/bar is checked with aliasMap
yeah that was my clue to it
made a PR (it failed 🥀 )
Hey @pez I did not see a channel for backseat driver. Are you doing automatic compaction in backseat driver? I have a prompt that you might be interested in for that.
It's "just" an MCP tool that LLMs can invoke to do specific things. Does it need compaction?
What does it do at the end of a session when it's out of tokens? I used it for work a while ago but did not remember and I don't have github copilot access anymore.
I guess maybe the compaction would happen in the copilot extension not the backseat driver extension.
The compaction would need to happen at the session level -- and Copilot lets you select any model so I don't know whether there's any portable, cross-model way for it to do that automatically? FWIW, I've never run out of tokens with Copilot's $19/month business subscription but I'm only just starting to switch to the models that have a 3x cost (vs the 1x default for most of Copilot's models).
Hi! Context compaction is outside Backseat Driver’s responsibilities, at least of current. It’s for the AI harness to care about. So #eca is very probably doing compaction. I am still curious about the prompt. 😃
This is the channel for Backseat Driver, btw, at least for now.
I'm using it in eca already and it's actually insanely great, which is why I was gonna ask if you wanted to beta test it in backseat driver. @ericdallo is not a nucleus style prompt fan.
I don’t think BD can compact context. But Copilot and other harnesses may have settings for what prompt to use for the compaction. I can check.
@michael819 yeah, the compact prompt lives in LLM client side, in this case copilot, not sure it's customizable tho (I'd say no), I think eca is one of the few tools that allow customize those internal capabilities prompts I do find awesome the prompt tunning, but my biggest concern is maintain those prompts @michael819 as usually it's not human readable
I am working on that part, but I have a compiler now, it's going much faster to find the optimal prompts. I just gotta figure out how to expand the lambda back to words in a way that makes sense.
Yeah that would be quite a thing