Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart: allow quick fixes with multiple edits. and support .arb translation files. #871

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ public static boolean isFileNameRespectedByAnalysisServer(@NotNull String _fileN
return fileName.endsWith(".dart") ||
fileName.endsWith(".htm") ||
fileName.endsWith(".html") ||
fileName.endsWith(".arb") ||
fileName.equals(".analysis_options") ||
fileName.equals("analysis_options.yaml") ||
fileName.equals("pubspec.yaml") ||
Expand Down
15 changes: 9 additions & 6 deletions Dart/src/com/jetbrains/lang/dart/fixes/DartQuickFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,17 @@ public boolean isAvailable(@NotNull final Project project, final Editor editor,

public static boolean isAvailable(@NotNull Project project, @NotNull SourceChange sourceChange) {
final List<SourceFileEdit> fileEdits = sourceChange.getEdits();
if (fileEdits.size() != 1) return false;
if (fileEdits.size() < 1) {
return false;
}

final SourceFileEdit fileEdit = fileEdits.get(0);
final VirtualFile virtualFile = AssistUtils.findVirtualFile(fileEdit);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
for (SourceFileEdit fileEdit : fileEdits) {
final VirtualFile virtualFile = AssistUtils.findVirtualFile(fileEdit);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();

if (fileEdit.getFileStamp() != -1) {
if (virtualFile == null || !fileIndex.isInContent(virtualFile)) return false;
if (fileEdit.getFileStamp() != -1) {
if (virtualFile == null || !fileIndex.isInContent(virtualFile)) return false;
}
}

return true;
Expand Down