autocomplete . cursor position in apply function.

Good evening.
To implement cursor as you did in function(hereCursor) javascript
i need to use a snippet? or is another way ?
apply as the function doesnt work for me . i dont understand it and i am using a string .

so - can you advise me - for changing position after using autocomplete i need to work with apply function or with snippet or with lang.parser method ?

So - any ideas about it? some idea or information - what i should implement will help me.
because I try to find a resolution in different places and it doesn`t have any result.

i have dynamic names of function and it looks like - RAND( ) , TEXT( ) …etc…
and I don’t have any idea how to implement the cursor inside brackets.
The snippet is working for static data.
Apply - I couldn`t find a working example or idea of how it is working.
Lang.parser methods are working for function markup after creating.
I believe that autocomplete position of the cursor should implement in Apply function … but how…

Also found some view issues with /* /* - the last * is black. But for me, it doesn`t metter.
Interesting situation with -

 closeBrackets: {
      brackets: ['*/', '(', '[', '{', "'", '"', " ''' "],

we can use only 1 bracket for closing - ( , [ , two signs don`t work - ‘*/’ , but only three quotes ‘’’ is working…what different with these signs and where I can update settings … i also couldn’t find

I have already found decision - snippetCompletion …
It is working for me, but it was hard - codeMirror6 is harder than learning any programming language. Because the betta version has just a few examples and is without deep information …
But also it is powerful and interesting, I like it ! )
I hope codemirror 6 will be finished and released with more examples and information )
Maybe i am not as smart as the author or anyone who created the library but i will be happy if my code will help anyone.

export const myFunction = (context: CompletionContext) => {
  const word = context.tokenBefore(['Function']);
  if (!word || (word.from === && !context.explicit)) return null;

  const options = string) =>
    snippetCompletion(`${label}(#{1})`, {
      detail: 'function',

  return {
    from: word.from,
    span: /^[a-zA-Z]+$/,
1 Like