clojure-emacs / clojure-emacs/clojure-mode

Incorrect indentation of `core.match/match` macro

Aperta
#602 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Emacs Lisp
Stelle
1k
Fork
249
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Expected behavior

`clojure-mode` should indent `match` forms (from [`core.match`](https://github.com/clojure/core.match)) the same as `M-x cider-format-region` or `M-x lsp-format-region`.

For example:
```clojure
(doseq [n (range 1 101)]
(println
(match [(mod n 3) (mod n 5)]
[0 0] "FizzBuzz"
[0 _] "Fizz"
[_ 0] "Buzz"
:else n)))
```

## Actual behavior

`clojure-mode` indents `match` forms incorrectly.

```clojure
(doseq [n (range 1 101)]
(println
(match [(mod n 3) (mod n 5)]
[0 0] "FizzBuzz"
[0 _] "Fizz"
[_ 0] "Buzz"
:else n)))
```

## Steps to reproduce the problem

Use the code from the above example in a Clojure(Script) file and run `indent-for-tab-command` using TAB.

## Environment & Version information

### clojure-mode version
```
clojure-mode (version 5.13.0)
```

### Emacs version
27.1

### Operating system
macOS 11.5.2 (Big Sur)

## Commentary

I'm happy to submit a PR with relevant indentation tests to fix this, but just wanted to make sure it's something that should be added to `clojure-mode`.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo l'esempio in un file Clojure(Script) ed eseguendo indent-for-tab-command con TAB. Confronta il risultato con la formattazione mostrata per cider-format-region e lsp-format-region; aggiungi i test di indentazione pertinenti menzionati dal segnalatore e considera il problema risolto quando le forme match ricevono l'allineamento previsto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
clojure, emacs-lisp
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.