How can I check an editor has error or not?

Answered

I get an editor to handle json

mFile = PsiFileFactory.getInstance(mProject).createFileFromText("a.json", JsonLanguage.INSTANCE, "");
mJsonVirtualFile = mFile.getVirtualFile();
mTextEditorProvider = TextEditorProvider.getInstance();
mEditor = (TextEditor) mTextEditorProvider.createEditor(mProject, mJsonVirtualFile);

 

So is there a way to check editor has errors or not?

Or how can I check json format is correct?

 

Sorry ,my English is poor

 

 

0
2 comments
Official comment

See com.intellij.problems.WolfTheProblemSolver#isProblemFile and com.intellij.problems.WolfTheProblemSolver#hasSyntaxErrors

I tried it, but it does not work, and I solve this problem by https://intellij-support.jetbrains.com/hc/en-us/community/posts/206762905-List-errors-and-warnings-for-Editor , also thanks your answer.

0

Please sign in to leave a comment.