Skip to content

Commit

Permalink
Use lsp-bridge-search-backend--record-items interface refactor elisp …
Browse files Browse the repository at this point in the history
…backend.
  • Loading branch information
manateelazycat committed Aug 7, 2023
1 parent e317aa8 commit 3f95a9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions core/search_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self) -> None:
self.backend_dict = {}
self.search_thread_queue = []

def update(self, backend_name, symbols, max_number, callback_name):
def update(self, backend_name, symbols, max_number):
symbols = sorted(list(map(str, symbols)), key=len)

if backend_name in self.backend_dict:
Expand All @@ -41,7 +41,6 @@ def update(self, backend_name, symbols, max_number, callback_name):
self.backend_dict[backend_name] = {
"symbols": symbols,
"max_number": max_number,
"callback_name": callback_name,
"ticker": 0
}

Expand All @@ -67,7 +66,8 @@ def search_symbols(self, backend_name, prefix: str, ticker: int):
break

if ticker == self.backend_dict[backend_name]["ticker"]:
eval_in_emacs(self.backend_dict[backend_name]["callback_name"],
eval_in_emacs("lsp-bridge-search-backend--record-items",
backend_name,
sorted(candidates, key=functools.cmp_to_key(lambda a, b: self.sort_symbols(prefix, a, b))))

def match_symbol(self, prefix, prefix_regexp, symbol):
Expand Down
8 changes: 1 addition & 7 deletions lsp-bridge.el
Original file line number Diff line number Diff line change
Expand Up @@ -1423,8 +1423,7 @@ So we build this macro to restore postion after code format."
(lsp-bridge-call-async "search_list_update"
"elisp"
symbols
acm-backend-elisp-search-max-number
"lsp-bridge-elisp-symbols-record")
acm-backend-elisp-search-max-number)
(setq acm-backend-elisp-symbols-update-size symbols-size)))))

(defun lsp-bridge-elisp-symbols-search (current-symbol)
Expand All @@ -1434,11 +1433,6 @@ So we build this macro to restore postion after code format."
(unless (or (string-equal current-symbol "") (null current-symbol))
(lsp-bridge-call-async "search_list_search" "elisp" current-symbol))))

(defun lsp-bridge-elisp-symbols-record (candidates)
(setq-local acm-backend-elisp-items candidates)
(setq-local acm-backend-elisp-cache-candiates nil)
(lsp-bridge-try-completion))

(defun lsp-bridge-search-words-index-files ()
"Index files when lsp-bridge python process finish."
(if (lsp-bridge-is-remote-file)
Expand Down

0 comments on commit 3f95a9c

Please sign in to comment.