Issue gone after set by IssueCollection in TextEditor.onDidSave callback

I try to make an Issue Provider by using IssueCollection.
I only want to validate when file is saved.
Nova can show issue. But then issue gone in a few seconds.
Please help me!

Here is my code:

nova.workspace.onDidAddTextEditor((editor) => {
editor.onDidSave((editor) => {
validator.validate(editor.document);
});
});

Hello! It appears you are not showing any code related to an IssueCollection. Could you please post the code for your validate() function?

Also, have you considered using the AssistantRegistry issue provider, which will handle the callbacks on document save (or change) for you? https://docs.nova.app/api-reference/assistants-registry/#registerissueassistant-selector-object-options

Thank @logan,
Here is my code and demo gif.

I’m using Nova 2 (213794)
and macOS 10.15.7 (19H2)

exports.activate = function() {
  let issueCollection = new IssueCollection();
  nova.workspace.onDidAddTextEditor((editor) => {
    editor.onDidSave((editor) => {
      let issue = new Issue();
      issue.message = 'Test issue collection in onDidSave';
      issue.severity = IssueSeverity.Error;
      issue.line = 1;
      issue.column = 1;
      issueCollection.set(editor.document.uri, [issue]);
    });
  });
}

CleanShot 2020-10-29 at 07.02.31