Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

map indentation / aligment #3

Closed
kwladyka opened this issue May 3, 2018 · 6 comments
Closed

map indentation / aligment #3

kwladyka opened this issue May 3, 2018 · 6 comments

Comments

@kwladyka
Copy link

kwladyka commented May 3, 2018

I use https://github.com/PEZ/clojure4vscode with paredit.

I can't make this ($x:text "url" %) to indent correctly. It works perfect in Cursive.

screen shot 2018-05-03 at 15 15 16

It can be tested with:

{:a 1
 :b           2
 :c 3}
@kwladyka
Copy link
Author

kwladyka commented May 4, 2018

Another example:
screen shot 2018-05-04 at 15 03 48
It works bad with maps. Looks at :profiles. I was experimenting a little and it looks like it does good job only for first level key.

@kwladyka
Copy link
Author

kwladyka commented May 4, 2018

Cursive solves that as an option in configuration. If we want to have 1 space after key or aligned.
screen shot 2018-05-04 at 15 07 11
screen shot 2018-05-04 at 15 07 16

@kwladyka
Copy link
Author

kwladyka commented May 4, 2018

Example:
How it looks:

{:1 1
 :2                2
 :3 3
 :4 {:a [1 2
         3 4]}
 :5 {:a {:b [[1 2]
[3 4]
         [5 6]
             [7 8]]}}
   :profiles {:dev {:dependencies [[figwheel-sidecar "0.5.15"]
                     [binaryage/devtools "0.9.9"]
                                   [com.cemerick/piggieback "0.2.2"]]}}
 :6 [1                            2]}

screen shot 2018-05-04 at 15 59 25

How it should look:

{:1 1
 :2 2
 :3 3
 :4 {:a [1 2
         3 4]}
 :5 {:a {:b [[1 2]
             [3 4]
             [5 6]
             [7 8]]}}
 :profiles {:dev {:dependencies [[figwheel-sidecar "0.5.15"]
                                 [binaryage/devtools "0.9.9"]
                                 [com.cemerick/piggieback "0.2.2"]]}}
 :6 [1 2]}

screen shot 2018-05-04 at 16 00 23

@kwladyka kwladyka changed the title map indentation with too many spaces map indentation / aligment May 4, 2018
@PEZ
Copy link
Collaborator

PEZ commented May 4, 2018

I wonder what is going on there with the last example. This is what I get:

{:1 1
 :2                2
 :3 3
 :4 {:a [1 2
         3 4]}
 :5 {:a {:b [[1 2]
             [3 4]
             [5 6]
             [7 8]]}}
 :profiles {:dev {:dependencies [[figwheel-sidecar "0.5.15"]
                                 [binaryage/devtools "0.9.9"]
                                 [com.cemerick/piggieback "0.2.2"]]}}
 :6 [1                            2]}

Which seems to be the correct indentation.

The spacing between items on the same line is left untouched, which is a good thing waiting for some way to configure if items should be made to align in a tabular manner. Lacking that it would be a bit rude to remove spaces that the user might have worked with placing there.

@kwladyka
Copy link
Author

kwladyka commented May 4, 2018

I would say it is rude to not use 1 space or aligned version for map as developer heh ;) We have this 2 standards to format code and I have never seen people doing it in different way.

IMO Curisve is really good, practice, tested and stable thing to copy solution. Personally i can't demand from it anything more.

Two configurable option for maps:

  1. 1 space
  2. aligned version

@kwladyka
Copy link
Author

After discussion with @PEZ:

The issue should be in Parinfer extension or Calva extension. It is not Paredit issue.

As my understanding is:
Paredit - shortcuts for editing code
Parinfer - formating code
Calva - Clojure extension

I am not sure if Parinfer can be common for all lisp languages. That is why solution should be implemented in Parinfer or Calva.

@PEZ PEZ closed this as completed Jun 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants