Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Allow completion detail to accept a Node#13

Closed
nchen63 wants to merge 3 commits intocodemirror:mainfrom
nchen63:nchen63-patch-1
Closed

Allow completion detail to accept a Node#13
nchen63 wants to merge 3 commits intocodemirror:mainfrom
nchen63:nchen63-patch-1

Conversation

@nchen63
Copy link
Copy Markdown

@nchen63 nchen63 commented Sep 9, 2022

Allows more complex styling of the text inside the completion detail.

@marijnh
Copy link
Copy Markdown
Member

marijnh commented Sep 12, 2022

What kind of styling are you planning to use this for? I'm somewhat weary of adding complex data structures like DOM nodes to completion objects, since when there are a lot of completions that could easily become a performance issue.

@nchen63
Copy link
Copy Markdown
Author

nchen63 commented Sep 12, 2022 via email

@marijnh
Copy link
Copy Markdown
Member

marijnh commented Sep 13, 2022

optionClass can be used to add additional classes to the completion element based on its content (and thus to style the label and the detail text in a custom way). Would that help?

@nchen63
Copy link
Copy Markdown
Author

nchen63 commented Sep 13, 2022 via email

@marijnh
Copy link
Copy Markdown
Member

marijnh commented Sep 13, 2022

Right, but those already have other classes (cm-completionLabel and cm-completionInfo) that you can target with a scoped rule, no?

@nchen63
Copy link
Copy Markdown
Author

nchen63 commented Sep 14, 2022

Here's some examples of what I would like to do, which I can't do by using the other classes:

image

image

@marijnh
Copy link
Copy Markdown
Member

marijnh commented Sep 14, 2022

I see. addToOptions is what you want there, I think. Add a new element to options that is rendered based on some extra information you put in the completion object.

@nchen63 nchen63 closed this Sep 14, 2022
@nchen63
Copy link
Copy Markdown
Author

nchen63 commented Sep 14, 2022 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants