#7349 Autopair parenthesis (#7379)

* Activate auto complete only if there's whitespace (\s) preceding the opening paranthesis, except when opening parenthesis is preceded by closing square bracket (]). In cases such as URLs

* #7349 Activate auto complete alson when there's a left parenthesis preceding the opening paranthesis.
This commit is contained in:
Jon
2022-11-22 15:36:42 +01:00
committed by GitHub
parent a8eb1a3264
commit 12f1517fdf

View File

@@ -1573,6 +1573,15 @@
pos (cursor/pos input)]
(text-util/surround-by? value pos before end))))
(defn- autopair-left-paren?
[input key]
(and (= key "(")
(or
(surround-by? input :start "")
(surround-by? input " " "")
(surround-by? input "]" "")
(surround-by? input "(" ""))))
(defn wrapped-by?
[input before end]
(when input
@@ -2730,7 +2739,11 @@
;; If you type `xyz`, the last backtick should close the first and not add another autopair
;; If you type several backticks in a row, each one should autopair to accommodate multiline code (```)
(contains? (set (keys autopair-map)) key)
(-> (keys autopair-map)
set
(disj "(")
(contains? key)
(or (autopair-left-paren? input key)))
(let [curr (get-current-input-char input)
prev (util/nth-safe value (dec pos))]
(util/stop e)