This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-30
Channels
- # announcements (1)
- # beginners (94)
- # calva (12)
- # cider (5)
- # cljdoc (4)
- # cljs-dev (4)
- # clojure (170)
- # clojure-austin (2)
- # clojure-dev (45)
- # clojure-germany (53)
- # clojure-italy (20)
- # clojure-nl (6)
- # clojure-spec (25)
- # clojure-uk (242)
- # clojurescript (161)
- # cursive (16)
- # data-science (3)
- # datomic (20)
- # defnpodcast (6)
- # emacs (40)
- # events (1)
- # fulcro (80)
- # funcool (46)
- # jobs (1)
- # leiningen (23)
- # liberator (2)
- # lumo (43)
- # mount (3)
- # off-topic (21)
- # onyx (1)
- # pedestal (15)
- # re-frame (23)
- # reitit (4)
- # schema (1)
- # sfcljs (1)
- # shadow-cljs (167)
- # spacemacs (1)
- # tools-deps (21)
- # yada (2)
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!
I also noticed failures with selecCurrentForm, so I cloned the repo, and after some tinkering and debugging, I found the problem and fixed it.
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); } } }
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.
Great, @martinbertolino. Many thanks again. I asked a question about the PR on Github. Check it out, please.