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

Support requested for document outline of spec files with the names of the specs #64

Open
ZenAnnard opened this issue Jan 16, 2020 · 0 comments

Comments

@ZenAnnard
Copy link

Is your feature request related to a problem? Please describe.

Say I have this code snippet for a Scala spec file:

class GrpcServerSpec extends ScalaTestWithActorTestKit with WordSpecLike {
  val ACCOUNT_ID            = 111L
  val AGENT_ID              = 222L

  "AskService.addChatWorkItem" should {
    "respond when WorkItem is added" in {
      implicit val ec = testKit.system.executionContext

      val mockedBehavior = ...

Then in the structure of the file as reported by imenu in emacs, I only see:

(class)GrpcServerSpec
0: => (val)GrpcServerSpec.ACCOUNT_ID
0: => (val)GrpcServerSpec.AGENT_ID

Describe the solution you'd like
I would expect to see the "AskService.addChatWorkItem" and "respond when WorkItem is added" in that document outline as well as:

(class)GrpcServerSpec
0: => (val)GrpcServerSpec.ACCOUNT_ID
0: => (val)GrpcServerSpec.AGENT_ID
0: => (method)AskService.addChatWorkItem
0: => (method)respond when WorkItem is added

Describe alternatives you've considered
None are available in metals.

Additional context
From the gitter discussion Gabriele Petronella wrote:

You mean the document outline (or textDocument/documentSymbol in LSP lingo). No that's not supported at the moment, since in the general case those are just method applications and you don't usually want them to show up. E.g.:

object Foo {

  println("hello")

  println("bar")
}

in this case you wouldn't want the two println invocation to appear in the document outline, and from a syntactical point of view those are no different than test definitions in ScalaTest and similar frameworks.
That said, it may be useful to special-case those. If you want, you can open a feature-request and we'll track it there.

Search terms:
spec, test, document outline, document structure, test list

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

No branches or pull requests

1 participant