File tree 3 files changed +15
-14
lines changed
clj/resources/indent-test-cases/reader_conditionals
3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change 1
1
(def DateTime #? (:clj org.joda.time.DateTime,
2
2
:cljs goog.date.UtcDateTime))
3
3
4
- #?(:cljs
5
- (extend-protocol ToDateTime
6
- goog.date.Date
7
- ( -to-date-time [x]
8
- ( goog.date.UtcDateTime. ( .getYear x) ( .getMonth x) ( .getDate x)) )))
4
+ #?(:clj
5
+ (defn regexp?
6
+ " Returns true if x is a Java regular expression pattern. "
7
+ [x]
8
+ ( instance? java.util.regex.Pattern x )))
9
9
10
10
#?@(:clj [5 6 7 8 ]
11
- :cljs [1 2 3 4 ])))
11
+ :cljs [1 2 3 4 ])
Original file line number Diff line number Diff line change 1
1
(def DateTime #? (:clj org.joda.time.DateTime,
2
2
:cljs goog.date.UtcDateTime))
3
3
4
- #?(:cljs
5
- (extend-protocol ToDateTime
6
- goog.date.Date
7
- ( -to-date-time [x]
8
- ( goog.date.UtcDateTime. ( .getYear x) ( .getMonth x) ( .getDate x)) )))
4
+ #?(:clj
5
+ (defn regexp?
6
+ " Returns true if x is a Java regular expression pattern. "
7
+ [x]
8
+ ( instance? java.util.regex.Pattern x )))
9
9
10
10
#?@(:clj [5 6 7 8 ]
11
11
:cljs [1 2 3 4 ])
Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ function! s:ListIndent(delim_pos)
252
252
253
253
let base_indent = s: PosToCharCol (a: delim_pos )
254
254
let ln = getline(a:delim_pos[0])
255
+ let ln_content = ln [a:delim_pos[1]:]
255
256
256
257
let sym_match = -1
257
258
@@ -268,7 +269,7 @@ function! s:ListIndent(delim_pos)
268
269
" other indentation options.
269
270
270
271
" TODO: simplify this.
271
- let syms = split (ln [a:delim_pos[1]:] , '[[:space:],;()\[\]{}@\\"^~`]', 1)
272
+ let syms = split (ln_content , ' [[:space:],;()\[\]{}@\\"^~`]' , 1 )
272
273
273
274
if ! empty (syms)
274
275
let sym = syms[0 ]
@@ -292,12 +293,12 @@ function! s:ListIndent(delim_pos)
292
293
endif
293
294
294
295
" 2. Function indentation
295
- " if first operand is on the same line?
296
+ " if first operand is on the same line? (and not a keyword)
296
297
" - Indent subsequent lines to align with first operand.
297
298
" else
298
299
" - Indent 1 or 2 spaces.
299
300
let indent_style = s: Conf (' clojure_indent_style' , ' always-align' )
300
- if indent_style !=# ' always-indent'
301
+ if indent_style !=# ' always-indent' && ln_content[ 0 ] !=# ' : '
301
302
let pos = s: FirstFnArgPos (a: delim_pos )
302
303
if pos != [0 , 0 ] | return s: PosToCharCol (pos) - 1 | endif
303
304
endif
You can’t perform that action at this time.
0 commit comments