Skip to content

Commit

Permalink
feat: add warning message when reload is manually triggered and no co…
Browse files Browse the repository at this point in the history
…nfiguration could be loaded
  • Loading branch information
tandemdude committed Aug 12, 2024
1 parent 10459d5 commit 9e1fdc4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class LightbulbPackageManagerListener implements PythonPackageManagementL
public void packagesChanged(@NotNull Sdk sdk) {
ApplicationManager.getApplication().runReadAction(() -> {
for (var project : ProjectManager.getInstance().getOpenProjects()) {
project.getService(ProjectDataService.class).notifyChange(sdk);
project.getService(ProjectDataService.class).notifyChange(sdk, false);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ boolean populateCacheForSdk(Sdk sdk, VirtualFile paramsFile) {
return false;
}

public void notifyChange(Sdk sdk) {
FileTypeIndex.processFiles(
public void notifyChange(Sdk sdk, boolean triggeredByAction) {
var noneFound = FileTypeIndex.processFiles(
FileTypeManager.getInstance().getFileTypeByExtension("json"),
file -> populateCacheForSdk(sdk, file),
GlobalSearchScope.allScope(project));
if (noneFound && triggeredByAction) {
Notifier.notifyWarning(project, "Failed to load Lightbulb configuration");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
for (var module : modules) {
var sdk = PythonSdkUtil.findPythonSdk(module);
if (sdk != null) {
dataService.notifyChange(sdk);
dataService.notifyChange(sdk, true);
}
}
}
Expand Down

0 comments on commit 9e1fdc4

Please sign in to comment.