Code Mirror 6 Autocomplete how to group options

Hi, is there a way to group the options in the autocomplete dropdown list in CM 6? Thanks!

Screenshot 2021-08-09 at 12.50.41 PM

No, that’s not in scope for the core autocompletion package.

Alright. Thanks.

Hey,

We are also interested in a functionality similar to this. What does “not in scope” mean? Does it mean that you are not interested at all to add a functionality like this, or that you are willing to consider a change request for this?

If out-of-the-box functionality is out-of-scope perhaps a way to make options unselectable or something like that could be used to achieve what we need.

Is there some other way that we could achieve this perhaps?

Thanks,
Filip

The former. This just doesn’t fit with the way the autocomplete package works—namely that it globally sorts the given options.

You might be able to kludge unselectable options by overriding the keys that select options and implementing commands that skip some options.

Thanks @marijn.

I haven’t looked into details of the code. It seems like there needs to be some other concept for this to be properly implemented. e.g. the completion result to provide something like option groups that is going to contain options of completions. Then the sorting needs to be done only within one group and between the groups. This is of course not as trivial as it sound. Is this something that might be of interest?

Apart from that, what do you think about providing a way to create the list Node through a custom function? This might make it possible to achieve the requested functionality as well.

Cheers,
Filip

One approach might be to use filter: false and to add a class to options that are the first in their category, which is then transformed into a heading-looking thing with CSS.