fix(emacs/lean-company.el): set timeout for company-lean--import-candidates
Custom variable lean-company-import-timeout is added (default: 1sec). Close #766
This commit is contained in:
parent
a4014fb532
commit
f9b069b6a5
2 changed files with 14 additions and 4 deletions
|
@ -57,10 +57,13 @@
|
||||||
(let* ((target-ext (pcase (lean-choose-minor-mode-based-on-extension)
|
(let* ((target-ext (pcase (lean-choose-minor-mode-based-on-extension)
|
||||||
(`hott "hlean")
|
(`hott "hlean")
|
||||||
(`standard "lean")))
|
(`standard "lean")))
|
||||||
(lean-files (f-files root-dir
|
(dummy (message "finding files under %s..." root-dir))
|
||||||
(lambda (file) (equal (f-ext file) target-ext))
|
(lean-files (with-timeout (lean-company-import-timeout
|
||||||
t))
|
(message "finding files under %s... timeout (%S sec)"
|
||||||
;; Relative to project root-dir
|
root-dir lean-company-import-timeout) nil)
|
||||||
|
(lean-find-files root-dir
|
||||||
|
(lambda (file) (equal (f-ext file) target-ext))
|
||||||
|
t)))
|
||||||
(lean-files-r (--map (f-relative it root-dir) lean-files))
|
(lean-files-r (--map (f-relative it root-dir) lean-files))
|
||||||
(candidates
|
(candidates
|
||||||
(--map (s-replace-all `((,(f-path-separator) . "."))
|
(--map (s-replace-all `((,(f-path-separator) . "."))
|
||||||
|
|
|
@ -176,6 +176,13 @@ false (nil)."
|
||||||
:group 'lean
|
:group 'lean
|
||||||
:type 'number)
|
:type 'number)
|
||||||
|
|
||||||
|
(defcustom lean-company-import-timeout 1
|
||||||
|
"After lean-company-import-timeout (seconds) passed,
|
||||||
|
company-lean--import stops collecting files.
|
||||||
|
See the body of company-lean--import-candidates-main"
|
||||||
|
:group 'lean
|
||||||
|
:type 'number)
|
||||||
|
|
||||||
(defcustom lean-keybinding-std-exe1 (kbd "C-c C-x")
|
(defcustom lean-keybinding-std-exe1 (kbd "C-c C-x")
|
||||||
"Lean Keybinding for std-exe #1"
|
"Lean Keybinding for std-exe #1"
|
||||||
:group 'lean-keybinding :type 'key-sequence)
|
:group 'lean-keybinding :type 'key-sequence)
|
||||||
|
|
Loading…
Add table
Reference in a new issue