Completions not always displayed to users

I’m having an issue where provideCompletionItems is being triggered, but the returned options are not displaying depending on what precedes the identifier characters. More specifically, if someone desires the completion ‘latest’, then they’ll see options if their input is :l, but not if their input is : l. I have space as one of my triggerChars, but that doesn’t seem to have an effect.

I’m not sure if this is a bug, or if there is some logic behind the different outcomes. I’d love to know what causes provided CompletionItems to be suppressed from displaying to users.

So… I’m alone in having this problem? This wasn’t an issue in Nova 1. I’d really appreciate some help in taking the guesswork out of getting suggestions for my extension users.

Hello Drew,

We haven’t had reports of this from any other users yet, correct.

I assume you are specifying the trigger characters on the assistant registration like so?

nova.assistants.registerCompletionAssistant("html", new CompletionProvider(), {
    triggerChars: new Charset(": ")
});

Providing a code sample (or linking to a project repository) would help us diagnose what might be happening.

Thanks for offering to help! Correct, this is my assistant registration:

nova.assistants.registerCompletionAssistant(
  'json',
  new NpmCompletionAssistant(),
  { triggerChars: new Charset(': "^~') }
)

As I mentioned above, the provideCompletionItems method is being triggered, but the results I return aren’t displaying.

Here’s my repo. I apologize for not having a README, but npm install && npm run build should be enough if you want to build the project for testing.

EDIT (Aug 30): I have since merged the branch I referred to earlier, so I updated the link to point to the main repo page.

I finally had time/energy to bang on this recently. My current theory is that I was trying to helpfully format completions in this JSON document with JSON punctuation (e.g., " :,), and having any of those as initial characters was causing the completion to be suppressed. I got the sense that I was doing it wrong and needed to find a better approach.

In my particular case, I was able to find a solution by completing with Snippets instead of plain text. Something about the completion being within a snippet got around the issue I was experiencing, and as a bonus offered a better extension experience for my users.

I’d still really appreciate any clarity Panic could bring to why completions might not be displayed.