|
9 | 9 | import com.intellij.openapi.actionSystem.CommonDataKeys;
|
10 | 10 | import com.intellij.openapi.actionSystem.LangDataKeys;
|
11 | 11 | import com.intellij.openapi.application.ApplicationManager;
|
12 |
| -import com.intellij.openapi.application.ReadAction; |
13 | 12 | import com.intellij.openapi.module.Module;
|
14 | 13 | import com.intellij.openapi.module.ModuleManager;
|
15 | 14 | import com.intellij.openapi.project.Project;
|
|
19 | 18 | import com.intellij.openapi.util.Computable;
|
20 | 19 | import com.intellij.openapi.vfs.VirtualFile;
|
21 | 20 | import com.intellij.psi.PsiFile;
|
22 |
| -import com.intellij.util.concurrency.AppExecutorUtil; |
23 | 21 | import com.jetbrains.lang.dart.util.DotPackagesFileUtil;
|
24 | 22 | import io.flutter.FlutterUtils;
|
25 | 23 | import org.jetbrains.annotations.NotNull;
|
@@ -141,18 +139,11 @@ public static PubRoot forDirectory(@Nullable VirtualFile dir) {
|
141 | 139 | if (dir == null || !dir.isDirectory() || dir.getPath().endsWith("/")) {
|
142 | 140 | return null;
|
143 | 141 | }
|
144 |
| - VirtualFile pubspec = null; |
145 |
| - try { |
146 |
| - pubspec = ReadAction.nonBlocking(() -> { |
147 |
| - return dir.findChild(PUBSPEC_YAML); |
148 |
| - }).submit(AppExecutorUtil.getAppExecutorService()).get(); |
149 |
| - } catch (Exception e) { |
150 |
| - // do nothing |
151 |
| - } |
152 |
| - |
| 142 | + final VirtualFile pubspec = dir.findChild(PUBSPEC_YAML); |
153 | 143 | if (pubspec == null || !pubspec.exists() || pubspec.isDirectory()) {
|
154 | 144 | return null;
|
155 |
| - } else { |
| 145 | + } |
| 146 | + else { |
156 | 147 | return new PubRoot(dir, pubspec);
|
157 | 148 | }
|
158 | 149 | }
|
@@ -194,6 +185,7 @@ public String getRelativePath(@NotNull VirtualFile file) {
|
194 | 185 |
|
195 | 186 | /**
|
196 | 187 | * Returns true if the given file is a directory that contains tests.
|
| 188 | + * |
197 | 189 | * @noinspection BooleanMethodIsAlwaysInverted
|
198 | 190 | */
|
199 | 191 | public boolean hasTests(@NotNull VirtualFile dir) {
|
@@ -314,6 +306,7 @@ public VirtualFile getPackagesFile() {
|
314 | 306 | /**
|
315 | 307 | * Returns true if the packages are up-to-date with regard to the `pubspec.yaml`. The `.packages` file is used if no
|
316 | 308 | * `.tool/package_config.json` is found. The default value returned is to return false.
|
| 309 | + * |
317 | 310 | * @noinspection BooleanMethodIsAlwaysInverted
|
318 | 311 | */
|
319 | 312 | public boolean hasUpToDatePackages() {
|
|
0 commit comments