Setting autocomplete on Ctrl+ Space

I would like to modify the default autocomplete to bring up completions by ‘Ctrl+Space’. According to docs, it should be as simple as setting ‘activateOnTyping:false’ config. While it disables the activation on typing, the assigned keyboard shortcut does not activate the autocomplete.
Simplified snipped based on code example from docs:

import {basicSetup, EditorView} from "codemirror"
import {
} from '@codemirror/commands';

import {autocompletion, completionKeymap} from "@codemirror/autocomplete"

import {
} from '@codemirror/view';

// Our list of completions (can be static, since the editor
/// will do filtering based on context).
const completions = [
  {label: "panic", type: "keyword"},
  {label: "park", type: "constant", info: "Test completion"},
  {label: "password", type: "variable"},

function myCompletions(context) {
  let before = context.matchBefore(/\w+/)
  // If completion wasn't explicitly started and there
  // is no word before the cursor, don't open completions.
  if (!context.explicit && !before) return null
  return {
    from: before ? before.from : context.pos,
    options: completions,
    validFor: /^\w*$/

let view = new EditorView({
  doc: "// Type a 'p'\n",
  extensions: [
    autocompletion({activateOnTyping: false, override: [myCompletions]})
  parent: document.body

Your exact code works for me :thinking:
Codemirror Sandbox

Interesting! Think it’s worth then adding that my setup is macOS + Chrome latest…


The editor in the link I sent isn’t working for you?

Finally found the culprit!
macOS Ventura by default has mappings for those keys ( Input Sources → Select the previous input source). removed them and viola - back to normal.
@Michiel Thank you for helping troubleshoot this issue!