Skip to content

Commit

Permalink
Adjust display label key.
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Nov 6, 2023
1 parent 838212a commit fdefc07
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion acm/acm-backend-citre.el
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
:key candidate-fix
:icon (downcase annotation)
:label candidate-fix
:display-label candidate-fix
:displayLabel candidate-fix
:annotation annotation
:backend "citre")))))
collection))))))
Expand Down
2 changes: 1 addition & 1 deletion acm/acm-backend-elisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
(list :key elisp-symbol
:icon symbol-type
:label elisp-symbol
:display-label elisp-symbol
:displayLabel elisp-symbol
:annotation (capitalize symbol-type)
:backend "elisp")))
acm-backend-elisp-items)))
Expand Down
4 changes: 2 additions & 2 deletions acm/acm-backend-search-sdcv-words.el
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ you need set this value to `/usr/share/stardict/dic/stardict-oxford-gb-formated-

(defun acm-backend-search-sdcv-words-candidate-expand (candidate-info bound-start &optional preview)
(if preview
(acm-preview-create-overlay (beginning-of-thing 'word) (end-of-thing 'word) (plist-get candidate-info :display-label))
(acm-preview-create-overlay (beginning-of-thing 'word) (end-of-thing 'word) (plist-get candidate-info :displayLabel))
(delete-region (beginning-of-thing 'word) (end-of-thing 'word))
(insert (plist-get candidate-info :display-label))))
(insert (plist-get candidate-info :displayLabel))))

(defun acm-backend-search-sdcv-words-clean ()
(setq-local acm-backend-search-sdcv-words-items nil)
Expand Down
2 changes: 1 addition & 1 deletion acm/acm-backend-tailwind.el
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
(list :key tailwind-symbol
:icon "tailwind"
:label tailwind-symbol
:display-label tailwind-symbol
:displayLabel tailwind-symbol
:annotation "Tailwind"
:backend "tailwind"))
acm-backend-tailwind-items)))
Expand Down
2 changes: 1 addition & 1 deletion acm/acm-backend-telega.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Sets `acm-backend-telega-items' for the current chatbuf."
(list :key username
:icon "at"
:label username
:display-label username
:displayLabel username
:annotation title
:backend "telega")))
;; NOTE: only members having username are
Expand Down
2 changes: 1 addition & 1 deletion acm/acm-backend-tempel.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
(list :key snippet
:icon "snippet"
:label snippet
:display-label snippet
:displayLabel snippet
:annotation "Tempel"
:backend "tempel"))
(cl-subseq match-snippets 0 (min (length match-snippets) acm-backend-tempel-candidates-number)))))))
Expand Down
2 changes: 1 addition & 1 deletion acm/acm-backend-yas.el
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Default matching use snippet filename."
(list :key match
:icon "snippet"
:label match
:display-label display
:displayLabel display
:content content
:annotation "Yas-Snippet"
:backend "yas")))
Expand Down
2 changes: 1 addition & 1 deletion acm/acm-quick-access.el
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ See `acm-quick-access-keys' for more details."
(let* (;; Decrease index if user type 1~9, adjust index to 9 if user type 0.
(index (if (equal current-number 0) 9 (1- current-number)))
(candiate (nth (+ acm-menu-offset index) acm-candidates))
(candidate-label (or (plist-get candiate :display-label) ""))
(candidate-label (or (plist-get candiate :displayLabel) ""))
(prefix (acm-get-input-prefix))
(rest (cadr (split-string candidate-label prefix))))
(unless (or (string-prefix-p current-char rest)
Expand Down
4 changes: 2 additions & 2 deletions acm/acm.el
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ The key of candidate will change between two LSP results."
(cl-reduce #'max
(mapcar (lambda (v)
(funcall acm-string-width-function
(format "%s %s" (plist-get v :display-label) (plist-get v :annotation))))
(format "%s %s" (plist-get v :displayLabel) (plist-get v :annotation))))
acm-menu-candidates)))

(defun acm-menu-render-items (items menu-index)
Expand All @@ -789,7 +789,7 @@ The key of candidate will change between two LSP results."
(let* ((icon (cdr (assoc (downcase (plist-get v :icon)) acm-icon-alist)))
(icon-default (cdr (assoc t acm-icon-alist)))
(display-icon (or icon icon-default))
(candidate (plist-get v :display-label))
(candidate (plist-get v :displayLabel))
(annotation (plist-get v :annotation))
(annotation-text (format "%s " (capitalize (if annotation annotation ""))))
(annotation-face (if (equal item-index menu-index) 'acm-frame-select-face 'font-lock-doc-face))
Expand Down
2 changes: 1 addition & 1 deletion core/codeium.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def dispatch(self, data, editor_language, prefix, cursor_offset=None):
"key": label,
"icon": "codeium",
"label": label,
"display-label": display_label,
"displayLabel": display_label,
"annotation": annotation,
"backend": "codeium",
"documentation": document,
Expand Down
2 changes: 1 addition & 1 deletion core/copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def message_dispatcher(self):
"key": label,
"icon": "copilot",
"label": label,
"display-label": first_line,
"displayLabel": first_line,
"annotation": "Copilot",
"backend": "copilot",
"documentation": document,
Expand Down
4 changes: 2 additions & 2 deletions core/handler/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def process_response(self, response: dict) -> None:
# Get value of 'incomplete-fuzzy-match' from lsp server config file.
fuzzy = self.get_fuzzy_option()

# Some LSP server, such as Wen, need assign textEdit/newText to display-label.
# Some LSP server, such as Wen, need assign textEdit/newText to displayLabel.
display_new_text = self.get_display_new_text()

for item in response["items"] if "items" in response else response:
Expand All @@ -142,7 +142,7 @@ def process_response(self, response: dict) -> None:
"key": key,
"icon": annotation,
"label": label,
"display-label": self.get_display_label(item, display_new_text),
"displayLabel": self.get_display_label(item, display_new_text),
"deprecated": 1 in item.get("tags", []),
"insertText": item.get('insertText', None),
"insertTextFormat": item.get("insertTextFormat", ''),
Expand Down
2 changes: 1 addition & 1 deletion core/search_file_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def search_words_from_files(self, prefix: str):
"key": word,
"icon": "search",
"label": word,
"display-label": word,
"displayLabel": word,
"annotation": "Search Word",
"backend": "search-file-words"
}, candidates[:min(self.max_number, len(candidates))])))
Expand Down
2 changes: 1 addition & 1 deletion core/search_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def search_symbols(self, filename: str, prefix: str, ticker: int):
"key": file,
"icon": file_type,
"label": file,
"display-label": file,
"displayLabel": file,
"annotation": file_type.upper(),
"backend": "path"
})
Expand Down
4 changes: 2 additions & 2 deletions core/search_sdcv_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def search_words(self, prefix: str, ticker: int):
"key": word,
"icon": "translation",
"label": word,
"display-label": self.adjust_word_case(prefix, word),
"displayLabel": self.adjust_word_case(prefix, word),
"annotation": translation,
"backend": "search-sdcv-words"
}
Expand All @@ -130,7 +130,7 @@ def search_words(self, prefix: str, ticker: int):
"key": word,
"icon": "translation",
"label": word,
"display-label": self.adjust_word_case(prefix, word),
"displayLabel": self.adjust_word_case(prefix, word),
"annotation": translation,
"backend": "search-sdcv-words"
}
Expand Down
2 changes: 1 addition & 1 deletion core/tabnine.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def message_dispatcher(self):
"key": label,
"icon": "tabnine",
"label": label,
"display-label": label,
"displayLabel": label,
"annotation": result["detail"] if "detail" in result else "",
"backend": "tabnine",
"new_suffix": result["new_suffix"],
Expand Down

0 comments on commit fdefc07

Please sign in to comment.