Hey there,
I’m the “maker” of the WordPress functions auto-completion extension. It’s super simple and my knowledge of complex js is limited, so bare with me.
I’m using a simple array of functions that starts like this:
let funcList = [{"title":"_( $string )","snippet":"_( ${0:$string} )"},{"title":"__( $text, $domain )","snippet":"__( ${0:$text}, ${1:$domain = \'default\'} )","desc":"Retrieve the translation of $text."},{"title":"...
I’m then iterating over the array and add the CompletionItems like this:
let item = new CompletionItem( func.title, CompletionItemKind.Function );
if( func.desc !== undefined ) {
item.documentation = func.desc;
}
if( func.snippet !== undefined ) {
item.insertText = func.snippet;
item.insertTextFormat = InsertTextFormat.Snippet;
}
What’s wrong now is that all the CompletionItems are triggered by any character in the snippet, so if I’m e.g. ending a line with a ; I get all kind of suggestions and pressing enter doesn’t create a new line but inserts the first suggestion. Same happens after different other characters like {}
So what I’m running into is a too aggressive auto-completion, that I kind of need to stop by adding stop words? Or tell the AutoCompletion to be triggered only after a space, not right behind any character? Is the range value relevant here?
Sorry if that’s too easy to fix, I’ve pretty much put this together by trial and error
Thanks in advance for any tips! And thanks for this forum, appreciate all your work for the dev community!