How can i disable code analysis pop-up?

Answered

Hi,

I have wrote a logic to pick the files which has been modified using the following code. 

focusedProject.getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC,
new FileDocumentManagerAdapter() {
public void beforeDocumentSaving(@NotNull Document document) {
PsiFile file = PsiDocumentManager.getInstance(focusedProject).getPsiFile(document);

}
});

But whenever this method executed I get an pop-up for code analysis in the IDE. Please see the attached screenshot herewith,

Is there any way disable this code inspection or is there any other API I can use to get the modified files without triggering the code analysis? 

8 comments
Comment actions Permalink

What do you want to achieve with your plugin? PSI won't be up-to-date in _before_DocumentSaving

0
Comment actions Permalink

I want get the `PsiFile` of the the edited file in the open editor. I can get the `PsiFile` but the issue is this code analysis pop-up appears each and every time when I edit the file in the editor.

What I Want is: I want get the `PsiFile` object if a file is edited or saved the changes without triggering any pop-up to user. Specially the code analysis pop-up since it take some time to finish the analysis depends on the project. 

0
Comment actions Permalink

What exactly do you want to do with PsiFile of current editor?

0
Comment actions Permalink

I want to keep `PsiElement` object list of the changed files to get details(file name, absolute path, etc...) later for my logic. I can create the `PsiElement` list. But the `Code Analysis` pop-up will come every time I do a change in a file. Is there any way to disable that pop-up programmatically?

And also I am using `ScheduledFuture' interface to schedule an action whenever a file is changed(it is like maintaining a queue of changed files which have actions scheduled). Is this can cause that `Code Analysis` pop-up to appear? 

0
Comment actions Permalink

So the popup does not appear once you delete the line obtaining the PsiFile?

For just storing affected files, com.intellij.openapi.fileEditor.FileDocumentManager#getFile with VirtualFile is enough.

0
Comment actions Permalink

Yes, it is enough to get the file. But is there a way to get the file when it is saved. Is there a listener for the save event? 

 

0
Comment actions Permalink

Thanks Yann Cebron ! I will look into that.

0

Please sign in to leave a comment.