use of com.intellij.testFramework.LightVirtualFile in project intellij-community by JetBrains.
the class JsonParserTest method testFile.
public void testFile() throws IOException {
final String fileName = "testData/SymPy.ipynb";
final String fileText = IpnbTestCase.getFileText(fileName);
final IpnbFile ipnbFile = IpnbParser.parseIpnbFile(fileText, new LightVirtualFile());
assertNotNull(ipnbFile);
assertEquals(31, ipnbFile.getCells().size());
}
use of com.intellij.testFramework.LightVirtualFile in project intellij-community by JetBrains.
the class JsonParserTest method testMarkdownCells.
public void testMarkdownCells() throws IOException {
final String fileName = "testData/SymPy.ipynb";
final String fileText = IpnbTestCase.getFileText(fileName);
final IpnbFile ipnbFile = IpnbParser.parseIpnbFile(fileText, new LightVirtualFile());
assertNotNull(ipnbFile);
final List<IpnbCell> cells = ipnbFile.getCells();
Iterables.removeIf(cells, new Predicate<IpnbCell>() {
@Override
public boolean apply(IpnbCell cell) {
return !(cell instanceof IpnbMarkdownCell);
}
});
assertEquals(7, cells.size());
}
use of com.intellij.testFramework.LightVirtualFile in project intellij-plugins by JetBrains.
the class LiveObjectsNode method getNavigatable.
@Override
public Navigatable getNavigatable() {
if (navigatableCache == null) {
final VirtualFile virtualFile = new LightVirtualFile(runConfigurationName, new LiveObjectsFileType(), "") {
@NotNull
@Override
public String getPath() {
return getName();
}
};
virtualFile.putUserData(ProfileData.CONTROLLER, liveModelController);
virtualFile.putUserData(ProfileData.PROFILING_MANAGER, profilingManager);
navigatableCache = new OpenFileDescriptor(module.getProject(), virtualFile);
}
return navigatableCache;
}
use of com.intellij.testFramework.LightVirtualFile in project oxy-template-support-plugin by mutant-industries.
the class CompiledPreviewUpdater method run.
@Override
public void run() {
for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
if (!(fileEditor instanceof TextEditor)) {
continue;
}
EditorEx editor = (EditorEx) ((TextEditor) fileEditor).getEditor();
VirtualFile virtualFile = editor.getVirtualFile();
Language language = virtualFile instanceof LightVirtualFile ? ((LightVirtualFile) virtualFile).getLanguage() : null;
if (language != CompiledPreview.INSTANCE) {
continue;
}
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
PsiFile originalFile;
if (psiFile == null || (originalFile = psiFile.getUserData(CompiledPreviewController.ORIGINAL_FILE_KEY)) == null) {
continue;
}
project.getComponent(CompiledPreviewController.class).showCompiledCode(originalFile, editor.getDocument());
}
}
use of com.intellij.testFramework.LightVirtualFile in project Perl5-IDEA by Camelcade.
the class PerlUseStrictInspection method buildVisitor.
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
return new PerlVisitor() {
@Override
public void visitFile(PsiFile file) {
if (file.getViewProvider() instanceof InjectedFileViewProvider || !file.isWritable() || !file.isPhysical() || file.getVirtualFile() instanceof LightVirtualFile) {
return;
}
FileType fileType = file.getFileType();
if (!(fileType instanceof PerlFileType) || !((PerlFileType) fileType).checkStrictPragma()) {
return;
}
for (PerlUseStatement useStatement : PsiTreeUtil.findChildrenOfType(file, PerlUseStatement.class)) {
if (useStatement.getPackageProcessor() instanceof PerlStrictProvider) {
return;
}
}
holder.registerProblem(file, PerlBundle.message("perl.inspection.use.strict"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new PerlUsePackageQuickFix("strict"));
}
};
}
Aggregations