-
Notifications
You must be signed in to change notification settings - Fork 129
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
Add implementation for BSP
workspace/reload
#852
Conversation
…ithout exiting on failures
…erated when setting up for the IDE
|
||
val inputArgs = inputs.elements.collect { case d: Inputs.OnDisk => d.path.toString } | ||
|
||
val ideInputs = IdeInputs(args = | ||
options.shared.validateInputArgs(args) |
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.
It isn't a lot of overhead, but the args
are effectively validated twice here (once for the IdeInputs
instance, and once for the Inputs
instance). I intend to try and refactor this in a future PR.
message: String, | ||
errorCode: Int = JsonRpcErrorCodes.InternalError | ||
): ResponseError = | ||
new ResponseError(errorCode, message, new Object()) |
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.
even though we return a valid error response to the workspace/reload
request, it doesn't seem like IntelliJ
is handling it properly, as no error message is shown in the UI. We may consider sending a BSP logMessage
request, so the IntelliJ
user has at least a slight chance of noticing that something went wrong (it'd show in the BSP build log, not just the BSP logs in the IntelliJ directory). showMessage
isn't an option either, as IntelliJ
ignores that as well. TBD, I'm open to suggestions (although I'd rather do it in a separate PR as well)
We're going ahead with a reworked version of this in #858, closing this. |
Add support for BSP workspace/reload (reworked version of #852)
The reload generally works now, but there are some limitations on IntelliJ:
scala-cli setup-ide
command), they will not be included in the new build after the reload if the project hash has changed.intellij-scala
creating an empty*-root
module. Even though we work around it on BSP initialization (as per changes in Adjust BSP project base directory to scala-cli content root to fix IntelliJ import #780), it becomes harder when handling aworkspace/reload
request with changed sources. If the source directories change on reload, the build target ids also change (the bsp project has a new hash). As a result, some targets need to be deleted, while others are created andintellij-scala
creates the*-root
module in between, as it's their hack for there always being a module with the primary workspace source directory.*-root
module) or get rid of the.idea
directory and reimport the project. Quite annoying 😞