This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-10
Channels
- # announcements (1)
- # beginners (2)
- # calva (41)
- # cider (3)
- # cljdoc (2)
- # cljs-dev (23)
- # clojure (94)
- # clojure-dev (23)
- # clojure-russia (5)
- # clojure-spec (9)
- # clojure-uk (85)
- # clojurescript (94)
- # code-reviews (1)
- # cursive (5)
- # datomic (1)
- # emacs (8)
- # figwheel (1)
- # figwheel-main (10)
- # fulcro (27)
- # graphql (11)
- # hyperfiddle (1)
- # jobs-discuss (10)
- # kaocha (3)
- # luminus (7)
- # lumo (1)
- # off-topic (85)
- # onyx (1)
- # pedestal (1)
- # re-frame (3)
- # shadow-cljs (21)
- # tools-deps (1)
- # yada (6)
👍 will do. I think my vscode is haunted for clojure so glad you reproduced anything;)
I'd like to track down what messes up the formatting in those other ways too. Even if Calva can't do anything about it, we can learn how to instruct people to set their editor up for Clojure.
What happens if you press tab when you have pressed enter the first time inside that defn?
So, immediately after pressing enter, my caret is 1 column indented, with a single space inserted after it. Pressing tab brings that rightmost paren back onto the first line, and my line is now (defn sqr[x]|)
with | being the caret position.
Yes, of course, I forgot about the white space removal. To make the test I wanted to do you need to set the calva-fmt setting about surrounding whitespace to false.
About the issue that I could reproduce: I just released a crude fix for it. Calva Formatter 0.0.17
. Please upgrade and let me know if that issue at least is handled.
changing it to LF fixes the problem, so I think you're not handling "\r\n" correctly!
silly. at least apple moved from "\r" to "\n"... at one point there were THREE different standards 😉
This will potentially be tricky for me to fix. I am not by a computer atm, can you test a thing for me? If you type something like a 1 and a 2 on separate, adjacent, lines. Then select both the 1 and the 2. How many characters does vscode say are selected? Or, rather, does it differ if you change the line ending setting?
afk for about half an hour, but I will attempt to get the plugin to build when I get back and see if I can lend a hand.
If you get the time you will notice six failing tests. I added those to expose the problem with top level indents. But this crlf thing is a different matter of course.
Well, I’m beginning to wonder if it is a bit too naïve. The top level cursor positioning seems a bit too tricky to bolt on the current solution, but it might be that I haven’t thought it through enough yet also.
The actual formatting is done using cljfmt, which is a bit expensive and I try to format as small ranges of code as possible to keep it fast enough. That’s why I can’t just format the whole buffer for the top-level situation. I need a way to figure out that the cursor is at the top level and handle that case separately, I think.
The problem with CRLF (which I thought vscode had solved for me) is still marinating in my head, since I don’t have access to the code atm, I can only just think about it. Maybe it is not too hard to account for that lineending in those regular expressions, but I have a feeling some of them might prove tricky. Maybe you will find out. Please just ask if it is something you wonder about in that code, I might be slow to answer, but anyway. 😃
Yes, VS Code’s default highlighting for Clojure does not care about keywords, and extensions can’t amend that. Fortunately the default grammar does recognize keywords and you can customize the highlighting in your settings. Add this to your settings.json and you’ll have keywords in their own color:
"editor.tokenColorCustomizations": {
"[Default Dark+]": {
"textMateRules": [
{
"scope": [
"constant.keyword.clojure"
],
"settings": {
"foreground": "#9cdcfeff"
}
},
{
"scope": [
"punctuation.section.expression.begin.clojure",
"punctuation.section.expression.end.trailing.clojure"
],
"settings": {
"foreground": "#999"
}
}
]
}
},