Fork me on GitHub
#calva
<
2018-08-30
>
martinbertolino17:08:34

Hello, I have been using Calva for a few weeks now and I'm really liking it. I used to use Vim+fireplace but I'm using vscode more and more so I wanted a clojure environment there as well. Nice job!

martinbertolino17:08:22

I also noticed failures with selecCurrentForm, so I cloned the repo, and after some tinkering and debugging, I found the problem and fixed it.

martinbertolino17:08:07

It was a type mismatch on select.ts

martinbertolino17:08:29

diff --git a/calva/repl/middleware/select.ts b/calva/repl/middleware/select.ts index d4278dd..d1054ec 100644 --- a/calva/repl/middleware/select.ts +++ b/calva/repl/middleware/select.ts @@ -28,7 +28,7 @@ function adjustRangeIgnoringComment(doc, range) { } -function getFormSelection(doc, pos, topLevel) { +function getFormSelection(doc, pos, topLevel) : vscode.Range { let allText = doc.getText(), ast = paredit.parse(allText), idx = doc.offsetAt(pos), @@ -42,13 +42,12 @@ function getFormSelection(doc, pos, topLevel) { function selectCurrentForm(document = {}) { let editor = vscode.window.activeTextEditor, doc = util.getDocument(document), - selection = editor.selection, - codeSelection = null; + selection = editor.selection; if (selection.isEmpty) { - codeSelection = getFormSelection(doc, selection.active, false); + let codeSelection = getFormSelection(doc, selection.active, false); if (codeSelection) { - editor.selection = codeSelection; + editor.selection = new vscode.Selection(codeSelection.start, codeSelection.end); } } }

martinbertolino17:08:14

I want to contribute the fix if it is OK, but I have never done a pull request before. I will read on how to do it but bear with me if I do not get it right the first time.

pez17:08:18

Nice! Thanks!!

martinbertolino19:08:22

Done. I created a pull request for review. Thanks.

pez19:08:39

Great, @martinbertolino. Many thanks again. I asked a question about the PR on Github. Check it out, please.

pez19:08:13

Since you told me this is your first PR, maybe you don’t know how easy it is to amend it. You just push towards the branch in your fork and the PR will be updated as long as it hasn’t been pulled.

martinbertolino20:08:37

@pez, new PR ready for review. Thanks again!

pez21:08:23

Super! Late here now. Will pull it tomorrow. Happy to get help with Calva!