Skip to content

Commit 058b4a7

Browse files
committed
Add indentation tests covering keywords in function position
1 parent 69a0b6f commit 058b4a7

File tree

8 files changed

+76
-3
lines changed

8 files changed

+76
-3
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ let b:clojure_indent_style = 'traditional' " ...or override it per-buffer.
9595
> [!NOTE]
9696
> These options are ignored if an indentation style of "uniform" is selected.
9797
98+
<!-- TODO: write this section. -->
99+
98100
`clojure_indent_rules` & `clojure_fuzzy_indent_patterns`
99101

100102

clj/resources/indent-test-cases/s-expr_standard/in.clj

+12
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ bar
8383
('foo
8484
bar
8585
biz)
86+
87+
(ns my-namespace
88+
(:require [foo :as f]
89+
[bar :refer [x]])
90+
(:import
91+
(java.io File
92+
IOException)
93+
[clojure.lang PersistentQueue]))
94+
95+
(import '(java.io File
96+
IOException)
97+
'(clojure.lang PersistentQueue))

clj/resources/indent-test-cases/s-expr_standard/out.clj

+12
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@
8383
('foo
8484
bar
8585
biz)
86+
87+
(ns my-namespace
88+
(:require [foo :as f]
89+
[bar :refer [x]])
90+
(:import
91+
(java.io File
92+
IOException)
93+
[clojure.lang PersistentQueue]))
94+
95+
(import '(java.io File
96+
IOException)
97+
'(clojure.lang PersistentQueue))

clj/resources/indent-test-cases/s-expr_traditional/in.clj

+12
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ bar
8383
('foo
8484
bar
8585
biz)
86+
87+
(ns my-namespace
88+
(:require [foo :as f]
89+
[bar :refer [x]])
90+
(:import
91+
(java.io File
92+
IOException)
93+
[clojure.lang PersistentQueue]))
94+
95+
(import '(java.io File
96+
IOException)
97+
'(clojure.lang PersistentQueue))

clj/resources/indent-test-cases/s-expr_traditional/out.clj

+12
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@
8383
('foo
8484
bar
8585
biz)
86+
87+
(ns my-namespace
88+
(:require [foo :as f]
89+
[bar :refer [x]])
90+
(:import
91+
(java.io File
92+
IOException)
93+
[clojure.lang PersistentQueue]))
94+
95+
(import '(java.io File
96+
IOException)
97+
'(clojure.lang PersistentQueue))

clj/resources/indent-test-cases/s-expr_uniform/in.clj

+12
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ bar
8383
('foo
8484
bar
8585
biz)
86+
87+
(ns my-namespace
88+
(:require [foo :as f]
89+
[bar :refer [x]])
90+
(:import
91+
(java.io File
92+
IOException)
93+
[clojure.lang PersistentQueue]))
94+
95+
(import '(java.io File
96+
IOException)
97+
'(clojure.lang PersistentQueue))

clj/resources/indent-test-cases/s-expr_uniform/out.clj

+12
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@
8383
('foo
8484
bar
8585
biz)
86+
87+
(ns my-namespace
88+
(:require [foo :as f]
89+
[bar :refer [x]])
90+
(:import
91+
(java.io File
92+
IOException)
93+
[clojure.lang PersistentQueue]))
94+
95+
(import '(java.io File
96+
IOException)
97+
'(clojure.lang PersistentQueue))

indent/clojure.vim

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ setlocal noautoindent nosmartindent nolisp
2222
setlocal softtabstop=2 shiftwidth=2 expandtab
2323
setlocal indentkeys=!,o,O
2424

25-
" FIXME: fix reader conditional tests. Include (:require [...]) test cases.
26-
" Is it possible to fix reader conditional indentation?
27-
2825
" Set a new configuration option with a default value. Assigns a script-local
2926
" version too, to be used as a default fallback if the global was "unlet".
3027
function! s:SConf(name, default) abort
@@ -46,6 +43,8 @@ call s:SConf('clojure_fuzzy_indent_patterns', [
4643
\ '^let'
4744
\ ])
4845

46+
" FIXME: reader conditional indentation?
47+
4948
" TODO: explain the different numbers. The "indent_style" option can override "0"
5049
" - -1 Not in dictionary, follow defaults.
5150
" - 0: Align to first argument, else 2 space indentation.

0 commit comments

Comments
 (0)