-
-
Notifications
You must be signed in to change notification settings - Fork 652
[fix #3017] Annotate company completion kinds #3024
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
Conversation
Can you attach some screenshot of the end result? |
This adds icon mapping for various completion kinds, allowing company-mode users to enable icons for completion items.
("static-field" field) | ||
("static-method" interface) | ||
("type" parameter) | ||
("var" variable)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use constant
for this (or vice versa) so you can easily tell the difference between local and global variables in the completion list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to change most of those afterwards anyways. E.g. I don't think that macro
is a misc, but rather a built-in and so on. But I think there's little point in debating this too much in this particular PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think constant
may be a bit misleading, but maybe it's ok. I'll let @bbatsov decide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many nuances to consider and this has to be aligned with how clojure-mode works internally as well. That's why I think we can sort it out later. Just update the changelog and for now we're good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. I don't think that macro is a misc
Btw I've changed this to use macro
icon, but given that there's no macro
icon in company mode, it will default to misc
icon automatically. Originally I've used misc
because I was not aware of this mechanism. Maybe we can submit an issue to company mode so they could include a macro icon? Or maybe this should be done to vscode, because the icons are from there, and this will benefit to other plugins that use NREPL, like Calva.
Also triangle square and circle kinda seem like a good icon to represent macros, as this is really puzzling :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. We basically mirror VS Code's type. Not to say we can't extend the list, but getting nice icons can be a problem.
Anyway, check out https://github.com/emacs-mirror/emacs/blob/6ec3cf1ccb5380acc376e89140b8d3a7fa4e471a/lisp/progmodes/elisp-mode.el#L647-L655
Since there are no "real" keywords in Lisp, reusing this kind for macros and special forms seemed like a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding local variables, we use the value
kind (following the example of some LSP servers). Which differentiates them nicely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there are no "real" keywords in Lisp, reusing this kind for macros and special forms seemed like a good idea.
Clojure actually does have real keywords, and CIDER annotates those with <k>
:
Though the icon kinda suggests that this is language-level keyword, not data keyword, so maybe a different icon could be used for those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this context I actually meant keywords in the sense of "built-ins"/"reserved words". That's how elisp-mode and clojure-mode work. Anyways, not a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andreyorst These kind of keywords are present in Elisp as well.
But that's not what is usually called a keyword in most programming languages (in Ruby, we call them "symbols", for example). And as someone who routinely works with several languages, I like to see annotations (and icons) have more universal meanings.
Thanks! |
Fix #3017
This adds icon mapping for various completion kinds, allowing company-mode users to enable icons for completion items.
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
eldev test
)eldev lint
) which is based onelisp-lint
and includescheckdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.Thanks!
If you're just starting out to hack on CIDER you might find this section of its
manual extremely useful.