Skip to content

Support multi-project setups in the IDE tests #5058

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

Merged
merged 7 commits into from
Oct 19, 2018

Conversation

Duhemm
Copy link
Contributor

@Duhemm Duhemm commented Aug 29, 2018

Because the IDE doesn't work with multi-project setup, I haven't included any test, but here's an example:

  @Test def classDefinition1: Unit = {
    val w0 = Workspace.withSources(
      code"""class ${m1}Foo${m2}""",
    )

    val w1 = Workspace.dependingOn(w0).withSources(
      code"""class Bar { new ${m3}Foo${m4} }"""
    )

    withWorkspaces(w0, w1)
      .definition(m1 to m2, List(m1 to m2))
      .definition(m3 to m4, List(m1 to m2))
  }

@Duhemm

This comment has been minimized.

@Duhemm Duhemm force-pushed the topic/test-ide-multi-project branch 4 times, most recently from 0e85f0b to e09075b Compare September 4, 2018 09:34
@Duhemm Duhemm force-pushed the topic/test-ide-multi-project branch from e09075b to a01eae5 Compare October 3, 2018 08:06
@Duhemm Duhemm force-pushed the topic/test-ide-multi-project branch from a01eae5 to fd38122 Compare October 9, 2018 13:00
When writing IDE tests that simulate multi-project setups, we need to
compile the sources of the workspaces that are depended on, because the
dependent workspaces require their class files.

This commit changes the `TestServer` so that workspaces that are
depended on are compiled during the initialization of the server. When
there are no dependency relation between workspaces, no compilation is
performed.
Test workspaces should be created with the complete dependency classpath
of their dependencies. The classpath was wrongly built with only the
class directory of their dependencies.
This interpolator is used to defined virtual source files that will be
compiled before the test starts running. Unlike virtual source files
defined with `code`, the ones defined with `tasty` will not be opened in
the IDE (`textDocument/didOpen` will not be sent to the LSP server). As
a result, the language server will unpickle the trees from TASTY.

Fixes scala#5223
@Duhemm Duhemm force-pushed the topic/test-ide-multi-project branch from fd38122 to 6751616 Compare October 15, 2018 11:13
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

This is awesome! I would just rename workspace to project

@smarter
Copy link
Member

smarter commented Oct 18, 2018

Note for later: now that we have both from-source tests and from-tasty tests what would be really cool is to automatically check that we get the same results when loading from sources and when loading from tasty, in fact we could try to do this for all tests automatically: run them once with everything loaded from sources and once with everything loaded from tasty.

@Duhemm Duhemm merged commit 193e064 into scala:master Oct 19, 2018
@Duhemm Duhemm deleted the topic/test-ide-multi-project branch October 19, 2018 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants