use of com.jetbrains.lang.dart.analyzer.DartAnalysisServerService in project intellij-plugins by JetBrains.
the class QuickAssistSet method getQuickAssists.
public List<SourceChange> getQuickAssists(@NotNull final Editor editor, @NotNull final PsiFile psiFile) {
final long psiModificationCount = psiFile.getManager().getModificationTracker().getModificationCount();
final String filePath = psiFile.getVirtualFile().getPath();
final Caret currentCaret = editor.getCaretModel().getPrimaryCaret();
final int offset = currentCaret.getSelectionStart();
final int length = currentCaret.getSelectionEnd() - offset;
if (lastPsiModificationCount == psiModificationCount && ObjectUtilities.equals(lastFilePath, filePath) && lastOffset == offset && lastLength == length) {
return lastSourceChanges;
}
lastFilePath = filePath;
lastOffset = offset;
lastLength = length;
lastPsiModificationCount = psiModificationCount;
final DartAnalysisServerService service = DartAnalysisServerService.getInstance(psiFile.getProject());
service.updateFilesContent();
lastSourceChanges = service.edit_getAssists(psiFile.getVirtualFile(), offset, length);
return lastSourceChanges;
}
use of com.jetbrains.lang.dart.analyzer.DartAnalysisServerService in project intellij-plugins by JetBrains.
the class ReanalyzeDartSourcesAction method actionPerformed.
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
final Project project = e.getProject();
if (isApplicable(project)) {
DartAnalysisServerService das = DartAnalysisServerService.getInstance(project);
if (das.isServerProcessActive()) {
das.analysis_reanalyze();
} else {
// Ensure the server is properly stopped.
das.restartServer();
// The list of projects was probably lost when the server crashed. Prime it with the current project to get the server restarted.
das.serverReadyForRequest(project);
}
}
}
Aggregations