Skip to content

Commit

Permalink
Improved error message for an unsupported workspace type (bazelbuild#…
Browse files Browse the repository at this point in the history
  • Loading branch information
odisseus authored Mar 18, 2024
1 parent 9a23caf commit 9677796
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ public static boolean validateLanguageSettings(
StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append(
String.format(
"Workspace type '%s' is not supported by this plugin.",
languageSettings.getWorkspaceType().getName())
"Workspace type '%s' is not supported by this plugin. Supported types are %s.",
languageSettings.getWorkspaceType().getName(), supportedTypes
)
);
// `//:plugin_dev` is a completely optional dependency that won't get enabled
// unless you have DevKit installed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public WorkspaceType getDefaultWorkspaceType() {
WorkspaceLanguageSettings settings =
LanguageSupport.createWorkspaceLanguageSettings(projectViewSet);
LanguageSupport.validateLanguageSettings(context, settings);
errorCollector.assertIssues("Workspace type 'c' is not supported by this plugin.");
errorCollector.assertIssues("Workspace type 'c' is not supported by this plugin. " +
"Supported types are [none].");
}

@Test
Expand All @@ -135,7 +136,8 @@ public WorkspaceType getDefaultWorkspaceType() {
WorkspaceLanguageSettings settings =
LanguageSupport.createWorkspaceLanguageSettings(projectViewSet);
LanguageSupport.validateLanguageSettings(context, settings);
errorCollector.assertIssues("Workspace type 'intellij_plugin' is not supported by this plugin. Do you have the DevKit plugin installed?");
errorCollector.assertIssues("Workspace type 'intellij_plugin' is not supported by this plugin. " +
"Supported types are [none]. Do you have the DevKit plugin installed?");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public void testJavascriptWorkspaceTypeUnavailableForCommunityEdition() {
WorkspaceLanguageSettings workspaceLanguageSettings =
LanguageSupport.createWorkspaceLanguageSettings(projectViewSet);
LanguageSupport.validateLanguageSettings(context, workspaceLanguageSettings);
errorCollector.assertIssues("Workspace type 'javascript' is not supported by this plugin.");
errorCollector.assertIssues("Workspace type 'javascript' is not supported by this plugin. " +
"Supported types are [none].");
}
}

0 comments on commit 9677796

Please sign in to comment.