I've moved repl tab to group1 - it works well!
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)
@pez I'm using Calva 2.0.108
@brandon.ringe 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)
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.
ah! ok, thanks, I'll try that now
cool, that works now! thanks @pez!😀
Awesomeness. This all highlights the key reason why we switched repl window implementation.
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.
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');
}
})
Neat! Which version of Calva are you using?
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.
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/
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.
Ah good point! This puzzled me too and then I wrote the docs way later and didn't think to mention 😆
I'll document
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 ...
It's definitely a hard thing to stay on top of
I am unable to launch the repl while trying out the quil package
Hi, I created a quil project, and then tried to Jack in. It crashed code. I am on Windows 10, and using Jdk12.
I opened repl on command prompt and I connected from code as a workaround
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.
did anyone try calva with quil?