Skip to content
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

Handle missing bsp info better #5813

Merged
merged 1 commit into from Nov 16, 2023
Merged

Conversation

Arthurm1
Copy link
Contributor

@Arthurm1 Arthurm1 commented Nov 5, 2023

Gradle BSP doesn't support Scala and also doesn't supply a DisplayName. BaseDirectory is also optional in the spec.

Not sure if this is the best way to dynamically create a DisplayName. Currently the ScalaTarget/JavaTarget data is extracted as required. It would probably be better to create classes to hold the info and then create unique DisplayNames for each target as it's not guaranteed that the BSP server supplied DisplayNames will be unique. But possibly not worth it though as I'd hope Gradle would support a DisplayName in next versions.

This is to get the Doctor and Build Info working and tree view partially working and to stop logging of stack traces when BSP server doesn't support certain requests

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the Bill server that is used for some of the tests doesn't have something properly set, it's probably one of the capabilities.

Could you take a look?

tests.ServerLivenessMonitorLspSuite and tests.BillLspSuite consistently fail.

else
buildTarget.getId().getUri()

name.replaceAll("[^a-zA-Z0-9]+", "-")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgodzik Should I change this so the non A->Z chars are always replaced with -, not just when DisplayName is not supplied?
The issue is that in FileDecoderProvider Metals uses the display name to build up a URI to then display build target info to the user. If there is a non URI valid character then this URI is built incorrectly. You can see that issue also in #5816.
The other option would be to change the way build target info is displayed but that would probably involve changing each individual clients (vscode, vim etc) as well.

@Arthurm1
Copy link
Contributor Author

@tgodzik I've changed the test server setup to always supply dataKind as scala if data is ScalaBuildTarget in BuildTarget.

The spec is here and says both dataKind and data are optional but it makes sense that if a server populates one then it has to populate the other.
In the Gradle BSP case the server was supplying jvm and Metals was decoding it as though it were scala.
In the test server cases, dataKind was null which I've changed to scala.

@Arthurm1
Copy link
Contributor Author

WorksheetLspSuite fails but that looks as though it's down to artifact downloading? It just hangs when I try and run it locally on Windows so I can't check

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tgodzik
Copy link
Contributor

tgodzik commented Nov 15, 2023

I rebased the PR, will merge tomorrow.

@tgodzik tgodzik merged commit 3bc9060 into scalameta:main Nov 16, 2023
24 of 25 checks passed
@Arthurm1 Arthurm1 deleted the missing_bsp_info branch November 16, 2023 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants