Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eglot #16

Open
sethidden opened this issue Dec 21, 2024 · 0 comments
Open

Eglot #16

sethidden opened this issue Dec 21, 2024 · 0 comments

Comments

@sethidden
Copy link

sethidden commented Dec 21, 2024

I noticed that default completions (non-company, non-corfu) for Eglot don't return any nerdicons

I also see that eglot-completion-at-point's :annotation-function (the one that renders the basic completions) property is not the most friendly for modification:
https://github.com/emacs-mirror/emacs/blob/d9afa1f30fdf9d00b447fea0a8343397333e172f/lisp/progmodes/eglot.el#L3178-L3191

since it's a function that returns a plist that contains :annotation-function, it'd need to be intercepted as it is being called from completion-at-point-functions var and changed to a version where the :annotation-function is something that inserts nerdicons and hopefully also font-faces colors

The font-faces and "icon <-> symbol type" mappings can be taken from here: https://github.com/LuigiPiucco/nerd-icons-corfu/blob/master/nerd-icons-corfu.el#L64-L100

Best I could come quickly come up with is:

;; these symbols should render fine in an emacs with nerdicons installed
(defconst eglot--kind-names
    `((1 . " Text") (2 . " Method") (3 . " Function") (4 . " Constructor")
      (5 . " Field") (6 . " Variable") (7 . " Class") (8 . " Interface")
      (9 . " Module") (10 . " Property") (11 . " Unit") (12 . " Value")
      (13 . " Enum") (14 . " Keyword") (15 . " Snippet") (16 . " Color")
      (17 . " File") (18 . " Reference") (19 . " Folder") (20 . " EnumMember")
      (21 . " Constant") (22 . " Struct") (23 . " Event") (24 . " Operator")
      (25 . " TypeParameter")))

image

My attempt is of course very sad (those aren't even nerdicons, just unicode) but I'm not sure how to patch eglot-complete-at-point's :annotation-function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant