How can i trigger different completion list with different keymap?

i want to type ‘[’ to show completion list [‘param1’,‘param2’,‘param3’] (for expample), and type ‘@’ to show completion list [‘func1’, ‘func2’, ‘func3’]。

i use extension blow to start completion

    key: '[',
    run: startCompletion,

but in CompletionSource, i want to know this completion is triggered by ‘[’, so that i can filter the list just has [‘param1’,‘param2’,‘param3’]

return (context: CompletionContext) => {
    const token = context.matchBefore(match);
    // i want to filter options by trigger key '['
    return { from: token ? token.from : context.pos, options, validFor };

Thank you anyhow!

You generally don’t want to bind a character key to startCompletion, since that will replace the typing of the character. Instead, rely on the regular way completion is activated on typing, and check whether there’s a [ character before the cursor in the completion source function.