Skip to content

Commit

Permalink
Build search file word candidates in Python side.
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Aug 7, 2023
1 parent b980ab2 commit 64f4da5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 1 addition & 9 deletions acm/acm-backend-search-file-words.el
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,7 @@
acm-backend-search-file-words-cache-candiates
(when (and acm-enable-search-file-words
(>= (length keyword) acm-backend-search-file-words-candidate-min-length))
(mapcar
(lambda (candidate-label)
(list :key candidate-label
:icon "search"
:label candidate-label
:display-label candidate-label
:annotation "Search Word"
:backend "search-file-words"))
acm-backend-search-file-words-items))))
acm-backend-search-file-words-items)))

(defun acm-backend-search-file-words-candidate-expand (candidate-info bound-start &optional preview)
(let ((beg (if (acm-is-elisp-mode-p)
Expand Down
10 changes: 9 additions & 1 deletion core/search_file_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,15 @@ def search_words_from_files(self, prefix: str):

candidates = list(map(lambda word: prefix[:-len(search_prefix)] + word, candidates))

eval_in_emacs("lsp-bridge-search-backend--record-items", "search-file-words", candidates[:min(self.max_number, len(candidates))])
eval_in_emacs("lsp-bridge-search-backend--record-items", "search-file-words",
list(map(lambda word: {
"key": word,
"icon": "search",
"label": word,
"display-label": word,
"annotation": "Search Word",
"backend": "search-file-words"
}, candidates[:min(self.max_number, len(candidates))])))
except:
logger.error(traceback.format_exc())

Expand Down

0 comments on commit 64f4da5

Please sign in to comment.