Empty content in Problems View from my editor plugin.

Answered

Hi, I created an editor plugin. It has two splitted Panels.  One panel includes a kotlin file editor and another Panel includes a diagram editor.  

My editor plugin is extended from FileEditorProvider.  And the kotlin file editor is created as following:

Editor ktEditor =  ((TextEditor) TextEditorProvider.getInstance().createEditor(project, virtualFile)).getEditor();

Everything works fine, and almost same as default editor in the Intellij, except one thing: ktEditor's status Toolbar which can show tips : error/warning of this kotlin file. If I click this status toolbar, it supposed to jump/open Problems view in Intellij and show the error and warning details about this file content in Problems view. But my ktEditor only show an empty Problem view with no content even my ktEditor status tooolbar shows some erros existing in this kotlin file. 

Then I tried to embed intellij default editor instead in my plugin editor by using:

Editor ktEditor = FileEditorManager.getInstance(project).getSelectedTextEditor();

 it still shows empty content in the Problem view. 

My question is why default Intellilj editor can show the detail errors linked to current file, but my ktEditor only shows empty in the Problems view. How can I solve it?

Regards,

Bian

 

 

 

 

0
4 comments
Avatar
Permanently deleted user

Hello,

How your editor reports about problems? The Problems View uses MarkupModelEx to collect problems generated by different highlighters.

See com.intellij.openapi.editor.ex.MarkupModelEx and com.intellij.openapi.editor.impl.DocumentMarkupModel#forDocument

0
Avatar
Permanently deleted user

Hi, thanks for the reply. There is no problemes report. My editor plugin includes two tabs. One is "Text" tab which  call/show the intellij default editor. Another is "Content" tab which is self-defined editor view.  

Here are two screenshots that can compare with same opening file. 

(Content tab with Problem view.png)

Content tab with Problem view.png: This is the "Content" tab screenshot.  It is my self-developed editor that can show status bar (1 warning, 5 typos). F2 to jump to next warning position works good. But Problems view is the empty. 

 

(Text tab with Problems view.png)

Text tab with Problems view.png is the "Text" tab. It is the same file and can show the status bar(1 warning, 5 typos), and Problems view is not empty. 

 

It is weird that "Text" tab can show Problem view with correct information, but "Content" tab only has a empty Problem view, no matter I use TextEditor or getSelectedEditor in my code.

Should I debug on some class, like "EditorMarkupModelImpl", could be a situation that Intellij editor does not consider?

 

0
Avatar
Permanently deleted user

You should debug `com.intellij.analysis.problemsView.toolWindow.HighlightingWatcher#getMarkupModel` first to find a reason why it returns `null`.

0
Avatar
Permanently deleted user

Hei, thanks for the tips.

I found the reason, When I extend the FileEditor class, I use another method to return a virtual file. But I should override following method. This method is called from HighlightingPanel#findCurrentFile at: val file = fileEditor.file

@Nullable 
@Override
public VirtualFile getFile() {
return virtualFile;
}
0

Please sign in to leave a comment.