Fork me on GitHub
#calva
<
2020-08-25
>
maxp12:08:22

I've moved repl tab to group1 - it works well!

calva 6
Alex J Henderson15:08:45

I'm writing a little vs code extension to help working with Clojure code it works fine in the main editor window but doesn't work in the calva repl window. Any way I can have an extension edit the text in the calva repl window? (it doesn't seem to be vscode.window.activeTextEditor)

pez15:08:49

It is just a regular editor actually. In what way does your extension not work with it? Can you describe it a bit, I think I might be able to see what is going on.

Alex J Henderson16:08:33

my extension is called remove-whitespace-close-paren, the idea is when you tap ']' it will remove any whitespace around the cursor and close any open paren, either ')', ']' or '}'. If I fire off the extension whilst in the repl window then vscode.window.activeTextEditor is undefined. Github project: https://github.com/jahenderson777/remove-whitespace-close-paren Here's the relevant section: var editor = vscode.window.activeTextEditor; const cursorPosition = editor.selection.end; const startPosition = new vscode.Position(0,0); const rangeToCursor = new vscode.Range(startPosition, cursorPosition); const rangeFromCursor = new vscode.Range(cursorPosition, editor.document.positionAt(editor.document.getText().length -1)); editor.edit((editBuilder) => { const originalStart = editor.document.getText(rangeToCursor); const start = originalStart.trimRight(); const rangeToCursorToEdit = new vscode.Range(editor.document.positionAt(start.length), cursorPosition); editBuilder.replace(rangeToCursorToEdit, ""); const originalEnd = editor.document.getText(rangeFromCursor) const end = originalEnd.trimLeft(); const rangeFromCursorToEdit = new vscode.Range(cursorPosition, editor.document.positionAt(originalStart.length + (originalEnd.length - end.length))); const nextChar = end.substring(0,1); editBuilder.replace(rangeFromCursorToEdit, ""); if (nextChar == ")" || nextChar == "]" || nextChar == "}" || nextChar == "") { vscode.commands.executeCommand('cursorRight'); } })

pez16:08:28

Neat! Which version of Calva are you using?

bringe19:08:48

What do you mean by "fire off the extension"? I'm wondering if it could be some action that's taking focus away from any editor. Also what's happening before you run that code? It may be that you need to click (for example) the repl window (or any editor) for the active editor to be defined.

Alex J Henderson08:08:45

@U0ETXRFEW I'm using Calva 2.0.108

Alex J Henderson08:08:18

@U9A1RLFNV by 'fire it off' I mean either select the command from the command search box, or hitting my assigned keyboard shortcut. Both methods work fine in the main editor window. However in the repl window the keyboard shortcut for some reason doesn't start the extension and when I select extension command from the command search box (with focus in the repl window) I can trip the debugger only to find that vscode.window.activeTextEditor is undefined)

pez08:08:41

So 108 was what I suspected. 😃 All bets are off. That repl window is a totally different beast. Please upgrade, and your extension will start working with the new repl window.

Alex J Henderson08:08:50

ah! ok, thanks, I'll try that now

Alex J Henderson08:08:53

cool, that works now! thanks @U0ETXRFEW!😀

metal 6
pez09:08:23

Awesomeness. This all highlights the key reason why we switched repl window implementation.

☝️ 3
bringe19:08:08

Hello Calva friends. I've been working to fix and improve Calva's test commands. This vsix could use some testing if you don't mind at least installing and using it while you work, even if you don't use the test commands (though that would be good too of course). https://7889-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.123-fix-test-runner-issues-c0d4793a.vsix We had no docs for these commands so I added this doc: https://calva.io/test-runner/

Cris B09:08:45

I was puzzled with a tools.deps project when the run tests ('all' and 'in namespace') commands didn't find the tests. I knew the tests were there! Then I realised that I had to jack in with an alias including the project's test dir in the classpath. I guess this should be obvious, but it wasn't to me 😳. Might be worth mentioning in the User Guide.

bringe17:08:06

Ah good point! This puzzled me too and then I wrote the docs way later and didn't think to mention 😆

bringe17:08:11

I'll document

Cris B22:08:30

It's really hard to keep fresh on what tripped you up when first using a tool/library/language. I always mean to document as I go, with the thought that the notes might be useful to write up for other beginners. Unfortunately my best intentions tend to fall way ...

bringe23:08:31

It's definitely a hard thing to stay on top of

manas_marthi23:08:26

I am unable to launch the repl while trying out the quil package

bringe00:08:34

What do you mean by "launch the repl"? Do you mean that calva jack-in fails, or that you can't open the repl window? What steps are you taking? I just added quil to a deps.edn project, ran jack-in, copied the example from the readme into a file and eval'd it and it worked.

bringe00:08:07

I'm about to be afk so may not respond for a while.

manas_marthi17:08:39

Hi, I created a quil project, and then tried to Jack in. It crashed code. I am on Windows 10, and using Jdk12.

manas_marthi17:08:58

I opened repl on command prompt and I connected from code as a workaround

bringe18:08:05

Interesting. Would you mind creating an issue with details and repro steps? Please mention jdk and OS version there too as you did here, and if you used a template to create the project, mention that as well. Would be helpful.

manas_marthi23:08:35

did anyone try calva with quil?