ActionHint (@NotNull PsiFile file, @NotNull String contents, boolean exactMatch) { PsiFile hostFile = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file); final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(hostFile.getLanguage()); String comment = commenter.getLineCommentPrefix(); if (comment == null) { comment = commenter.getBlockCommentPrefix(); } assert comment != null : commenter; // "quick fix action text to perform" "should be available" Pattern pattern = Pattern.compile("^" + Pattern.quote(comment) + " \"(.*)\" \"(\\w+)(?:-(\\w+))?\".*", Pattern.DOTALL); Matcher matcher = pattern.matcher(contents); TestCase.assertTrue("No comment found in " + file.getVirtualFile(), matcher.matches()); final String text = matcher.group(1); String state = matcher.group(2); String previewState = matcher.group(3); boolean checkPreview = "preview".equals(previewState); if(state.equals("true") || state.equals("false")) { return new ActionHint(text, Boolean.parseBoolean(state), null, exactMatch, checkPreview); } return new ActionHint(text, true, ProblemHighlightType.valueOf(state), exactMatch, checkPreview); }