mirror of
https://github.com/logseq/logseq.git
synced 2026-05-01 17:36:33 +00:00
* 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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user