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

Basic completion item kind suport #9996

Closed
wants to merge 4 commits into from

Conversation

nferhat
Copy link

@nferhat nferhat commented Mar 25, 2024

This PR allows the completion menu's style to be more configurable, allowing configurations like this:

image

The concerned configuration options are:

  • editor.completion-item-columns: A list of either name or kind, for the symbol name and a user-defined string for its kind respectively.
  • editor.completion-item-kinds: A list of the user-defined strings for completion item kinds. When a kind name is not set, it will use the kind's snake_name form instead (the default before this PR)
completion-item-columns = ["kind", "name"]
[editor.completion-item-kinds]
text = ""
method = ""
function = ""
constructor = ""
field = ""
variable = ""
class = ""
interface = ""
module = ""
property = ""
unit = ""
value = ""
enum = ""
keyword = " "
snippet = ""
color = ""
file = ""
reference = ""
folder = ""
enum_member = ""
constant = ""
struct = ""
event = ""
operator = ""
type_parameter = ""

In addition to this, themes are also concerned. The ui.menu.kind scope is the default, and ui.completion.kind.{name} for each kind, where {name} is the snake_case name of the kind name.

@nferhat nferhat changed the title init: Basic completion item kind suport Basic completion item kind suport Mar 25, 2024
@pascalkuthe
Copy link
Member

Can you comeup with a set of icons that don't require a patched font as a default? Otherwise, this feature should have an enable setting that defaults to false. Helix should work out of the box without installing a patched font

@pascalkuthe
Copy link
Member

Ah nvm I see that you default to the item name. That is a good default, I like this approach much better than enabling icons by default

helix-view/src/editor.rs Outdated Show resolved Hide resolved
helix-view/src/editor.rs Outdated Show resolved Hide resolved
@the-mikedavis the-mikedavis added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 25, 2024
@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 25, 2024
nferhat added 2 commits March 25, 2024 20:29
Instead of using a HashMap for completion_item_kinds, use a Vec of
tuples, this way we do not need a wrapper to implement hash.

The second modification involves serializing, again, instead of using a
wrapper for the struct, serde's deserialize_with attribute is used, this
also allows us to serialize using a snake_name case instead of PascalCase
@David-Else
Copy link
Contributor

This looks great! Any chance the merge conflicts could be fixed? Also, could you add your optional nerd fonts config to the documentation, maybe to the example config at the top of https://docs.helix-editor.com/configuration.html ?

@nferhat
Copy link
Author

nferhat commented Nov 29, 2024

Closed in favor of #12151

@nferhat nferhat closed this Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants