Fork me on GitHub
#cursive
<
2023-05-17
>
emilaasa08:05:34

When reviewing PRs, we sometimes run into annoying diffs at work, where Cursive and LSP disagree on how the formatting of ns require should look. I think they differ by one space:

Cursive, four spaces
(ns my.ns
  (:require
    [something :as s]))
^^^^

LSP, three spaces
(ns my.ns
  (:require
   [something :as s]))
^^^
What's a good solution to these issues?

kennytilton11:05:17

I use the option to ignore whitespace. GitHub has that option somewhere for code reviews, and git itself has:

alias dfno="git diff origin/main --name-only --ignore-space-at-eol -b -w --ignore-blank-lines"
alias ddf="git diff origin/main --ignore-space-at-eol -b -w --ignore-blank-lines"

ericdallo12:05:59

LSP follows the same standard of cider, clojure-mode and Clojure code style, so I think would be nice to cursive does the same

imre13:05:05

prefs - code style - clojure - one space list indent

👍 2
Ron Ludmer12:05:47

Hey all, Working with IntelliJ - when optimizing imports it changes my :require params from vectors to lists (and obviously does not compile afterwards). See attachments. Any idea why?

caleb.macdonaldblack17:05:54

Do your settings look like this?

Ron Ludmer20:05:51

Yes thank you!

cfleming00:05:32

Yes, that’s configurable as Caleb shows. But your ns should still compile with either lists or vectors.

AJ Snow18:05:53

hey are any notes or documentation on cursive’s expected file structure for clojure files? I get FNF errors unless I places things in a certain directory structure

cfleming00:05:18

Can you give some more detail? Cursive doesn’t impose any more file structure than Clojure itself does.

AJ Snow20:06:23

it was an issue where at the top level we had the folder /dev/ and it was complaining about not being in the source root or something but when we put it one folder level deeper, e.g. /dev/tests, it stopped complaining