Removing the autocomplete from `basicSetup` for library

Im working on svelte library based on top of CM6. In it, I have this option, setup: 'basic' | 'minimal', as well as autocomplete: boolean | CompletionConfig. For the extensions array I have a compartment for setup type, as well as autocomplete. When any option is updated, the compartment is reconfigured. The compartment for autocomplete is above setup’s compartment, so autocomplete has a higher precedence than setup.

This is how the extensions are created

return [
			//!NOTE User extensions matter the most, keep em on top
			extensions_compartment.of(extensions ?? []),

			//!Note: Autocomplete may come built in with setup: basic, so always keep it above setup_compartment
			autocomplete_compartment.of(await get_autocompletion(autocomplete)),

			keymap.of([...defaultKeymap, ...(useTabs ? [indentWithTab] : [])]),
			setup_compartment.of((await get_setup(setup)) ?? []),
			lang_compartment.of(await get_lang(lang, langMap)),
			theming_compartment.of(get_theme(theme, styles)),
			tabs_compartment.of(await get_tab_setting(useTabs, tabSize)),

Now, if autocomplete option is true or CompletionConfig, then it works fine. But when it is false, the compartment is reconfigured to be an empty array []. But if basic setup is applied, this does nothing. Is there a way that I can remove the autocomplete option from the final extensions array?

As it is a library, I can’t tell user to not use setup: 'basic' with autocomplete, basicSetup comes with lot of goodies, so going with minimal setup for this specific case feels wrong


Fork the few lines in the codemirror that define these sets of extensions, and you can adjust them as needed.


I want to rely on the dependency, in case its updated and I can’t keep up.

Is there no other way of removing the extension?

No, there isn’t.