-
Notifications
You must be signed in to change notification settings - Fork 327
Implement BuildToolModuleHandler
for Scala Projects to register Bazel Imported Scala Projects
#7704
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
BuildToolModuleHandler
for Scala Projects to register Bazel Imported Scala Projects
It turned out #api251 Intellij already has BuildToolModuleHandler If v251 shim do not implement BuildToolModuleHandler, an runtime would be thrown com.intellij.diagnostic.PluginException: Extension com.google.idea.blaze.scala.BlazeScalaBuildToolModuleHandler does not implement interface org.jetbrains.sbt.project.BuildToolModuleHandler (adapter=SimpleConstructorInjectionAdapter(implementation=com.google.idea.blaze.scala.BlazeScalaBuildToolModuleHandler, plugin=PluginDescriptor(name=Bazel for IntelliJ, id=com.google.idea.bazel.ijwb, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/IntelliJIdea2025.1/plugins/ijwb, version=9999-api-version-251, package=null, isBundled=false))) at com.intellij.serviceContainer.ComponentManagerImpl.createError(ComponentManagerImpl.kt:989) at com.intellij.openapi.extensions.impl.ExtensionPointImpl.checkExtensionType(ExtensionPointImpl.kt:210) at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapter(ExtensionPointImpl.kt:428) at com.intellij.openapi.extensions.impl.ExtensionPointImpl.createExtensionInstances(ExtensionPointImpl.kt:377) at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensionList(ExtensionPointImpl.kt:223) at com.intellij.openapi.extensions.ExtensionPointName.getExtensionList(ExtensionPointName.kt:54) at org.jetbrains.sbt.project.BuildToolModuleHandler.isHandledByBuildTool(BuildToolModuleHandler.java:15) at org.jetbrains.sbt.project.SbtProjectUtil$.isHandledByOtherBuildTool(SbtProjectUtil.scala:34) at org.jetbrains.sbt.project.SbtProjectUtil$.isInSbtProject(SbtProjectUtil.scala:29) at org.jetbrains.sbt.project.SbtProjectImportStateService.isImported(SbtProjectImportStateService.scala:31) at org.jetbrains.sbt.codeInsight.daemon.SbtProjectImportStateProblemHighlightFilter.shouldHighlight(SbtProjectImportStateProblemHighlightFilter.scala:23)/
Is |
The ticket has fix version The exact commit JetBrains/intellij-scala@e7a7738 is also only in Therefore, it should not be present in If there's any compatibility concern, I can downgrade my IntelliJ idea to This is my first time developing patch for a Jetbrains IDE plugin. I don't know about the best practice around compatibility, therefore would appreciate any guidance from you or other reviewers. |
@@ -34,6 +34,10 @@ java_library( | |||
]), | |||
intellij_ue = glob([ | |||
"com/google/idea/sdkcompat/javascript/**", #api223 | |||
"com/google/idea/sdkcompat/scala/**", #api250 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API tag seems wrong here, please use <version where the API changed> - 1. So that if we drop the previous version we can just grep for the API tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this correctly the API was introduced in 251, please use 243 as the API tag.
/** | ||
* Compatibility shim for BuildToolModuleHandler interface. | ||
*/ | ||
public interface BuildToolModuleHandlerAdapter extends BuildToolModuleHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the correct API tag to the interface as well.
Also regarding the concern from @sellophane. If the extension point If this is the case and we cannot register this extension in 243, you would need to register it manually like we did it in CLion for some time. For example: intellij/clwb/sdkcompat/v243/com/google/idea/blaze/clwb/CLionNotificationProvider.kt Lines 102 to 114 in 9443d50
|
Checklist
Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See
the Contributions section in the README for more
details.
Discussion thread for this change
Issue number: #7703
Description of this change
Use
BuildToolModuleHandler
API to register that the project is already imported via Bazel.Before the change
After the change