parent
81ecbb4c94
commit
27b20c5585
1 changed files with 20 additions and 4 deletions
|
@ -106,7 +106,7 @@
|
||||||
(lean-server-send-cmd-sync (lean-cmd-findg line-number column-number pattern)
|
(lean-server-send-cmd-sync (lean-cmd-findg line-number column-number pattern)
|
||||||
(lambda (candidates)
|
(lambda (candidates)
|
||||||
(lean-debug "executing continuation for FINDG")
|
(lean-debug "executing continuation for FINDG")
|
||||||
(-map 'company-lean--findp-make-candidate candidates)))))
|
(--map (company-lean--findp-make-candidate it prefix) candidates)))))
|
||||||
|
|
||||||
(defun company-lean--findg-pre-completion (args)
|
(defun company-lean--findg-pre-completion (args)
|
||||||
"Delete current '_' before filling the selected AC candidate"
|
"Delete current '_' before filling the selected AC candidate"
|
||||||
|
@ -144,8 +144,14 @@ triggers a completion immediately."
|
||||||
(string-match "[_.]" prefix)))
|
(string-match "[_.]" prefix)))
|
||||||
prefix)))
|
prefix)))
|
||||||
|
|
||||||
(defun company-lean--findp-make-candidate (arg)
|
(defun company-lean--findp-make-candidate (arg prefix)
|
||||||
(propertize (car arg) 'type (cdr arg)))
|
(let* ((text (car arg))
|
||||||
|
(type (cdr arg))
|
||||||
|
(start (s-index-of prefix text)))
|
||||||
|
(propertize text
|
||||||
|
'type type
|
||||||
|
'start start
|
||||||
|
'prefix prefix)))
|
||||||
|
|
||||||
(defun company-lean--findp-candidates (prefix)
|
(defun company-lean--findp-candidates (prefix)
|
||||||
(let ((line-number (line-number-at-pos))
|
(let ((line-number (line-number-at-pos))
|
||||||
|
@ -155,7 +161,7 @@ triggers a completion immediately."
|
||||||
(lean-server-send-cmd-sync (lean-cmd-findp line-number prefix)
|
(lean-server-send-cmd-sync (lean-cmd-findp line-number prefix)
|
||||||
(lambda (candidates)
|
(lambda (candidates)
|
||||||
(lean-debug "executing continuation for FINDP")
|
(lean-debug "executing continuation for FINDP")
|
||||||
(-map 'company-lean--findp-make-candidate candidates)))))
|
(--map (company-lean--findp-make-candidate it prefix) candidates)))))
|
||||||
|
|
||||||
(defun company-lean--findp-location (arg)
|
(defun company-lean--findp-location (arg)
|
||||||
(lean-generate-tags)
|
(lean-generate-tags)
|
||||||
|
@ -183,12 +189,22 @@ triggers a completion immediately."
|
||||||
"...")))
|
"...")))
|
||||||
annotation-str))))
|
annotation-str))))
|
||||||
|
|
||||||
|
(defun company-lean--findp-match (arg)
|
||||||
|
"Return the end of matched region"
|
||||||
|
(let ((prefix (get-text-property 0 'prefix arg))
|
||||||
|
(start (get-text-property 0 'start arg)))
|
||||||
|
(if start
|
||||||
|
(+ start (length prefix))
|
||||||
|
0)))
|
||||||
|
|
||||||
(defun company-lean--findp (command &optional arg &rest ignored)
|
(defun company-lean--findp (command &optional arg &rest ignored)
|
||||||
(case command
|
(case command
|
||||||
(prefix (company-lean--findp-prefix))
|
(prefix (company-lean--findp-prefix))
|
||||||
(candidates (company-lean--findp-candidates arg))
|
(candidates (company-lean--findp-candidates arg))
|
||||||
(annotation (company-lean--findp-annotation arg))
|
(annotation (company-lean--findp-annotation arg))
|
||||||
(location (company-lean--findp-location arg))
|
(location (company-lean--findp-location arg))
|
||||||
|
(match (company-lean--findp-match arg))
|
||||||
|
(no-cache t)
|
||||||
(sorted t)))
|
(sorted t)))
|
||||||
|
|
||||||
;; ADVICES
|
;; ADVICES
|
||||||
|
|
Loading…
Reference in a new issue