Skip to content

Conversation

kpodsiad
Copy link
Contributor

  • do not publish bsp diagnostics if there were and there are no problems
  • publish diagnostics if problems needs to be updated

continues effort of #6847, closes #6896

@adpi2 do you have an idea how to write test for this PR which will cover #6896?

@adpi2
Copy link
Member

adpi2 commented Jun 17, 2022

@kpodsiad You can add a test in https://github.com/sbt/sbt/blob/1.7.x/server-test/src/test/scala/testpkg/BuildServerTest.scala

If you need to change a file in the project, to have different diagnostics you can do something like that:

IO.write(
otherBuildFile,
"""
|val someSettings = Seq(
| scalacOptions += "-deprecation"
|)
|""".stripMargin
)

@adpi2 adpi2 self-requested a review June 17, 2022 08:08
@kpodsiad kpodsiad force-pushed the bsp-diagnostics-fix branch 6 times, most recently from 3a0dfe3 to 4730317 Compare June 22, 2022 07:22
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

There is still one bug with the warnings. Also I think there are some more reports that could be avoided.

@kpodsiad
Copy link
Contributor Author

kpodsiad commented Jun 23, 2022

@adpi2 I found interesting behavior (it's already present, tested on 1.6.2). Lets have files A and B.

  • A has a warning
  • make error in B
  • warning in A disappears
  • fix error in B
  • warning in A occurs again

Not sure if it's a bug or feature, however Bloop doesn't clear the warning.

* do not publish bsp diagnostics if there were and there are no problems
* publish diagnostics if problems needs to be updated
@kpodsiad kpodsiad force-pushed the bsp-diagnostics-fix branch from 4730317 to e8d60ef Compare June 23, 2022 06:25
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

Thanks @kpodsiad for fixing this! I also appreciate the refactoring in the BuildServerTest.

You are right about the strange behavior of warnings that disappear and then re-appear again. This is a small bug that is not critical. We will probably be able to fix it by storing more information about previous compilation in the BspCompileState class. I suggest we do that in a separate PR.

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.

3 participants