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

Smoother main discovery when no mainClass is given. #2491

Closed
ckipp01 opened this issue Feb 9, 2021 · 4 comments · Fixed by #2532
Closed

Smoother main discovery when no mainClass is given. #2491

ckipp01 opened this issue Feb 9, 2021 · 4 comments · Fixed by #2532
Assignees
Labels
affects clients Use this if you are adding a new setting or making a change that will affect clients. debug DAP debug related tickets improvement Not a bug or a feature, but something general we can improve

Comments

@ckipp01
Copy link
Member

ckipp01 commented Feb 9, 2021

Feature request and way to do it

Currently there is some manual work required to run a main class even if there is only one in your application, and your client doesn't have code lenses. We also handle the situation where we give a mainClass, but not the buildTarget. I'd like to be able to just give a buildTarget for example and have it also work. Even more so, I'd like to just give it nothing, and if there is only one main, it runs it for example, or if there are multiple then I'd like the server to show me and let me choose.

We can handle both of these already. I've been poking around and we already pretty much have the logic to do all this, but it all needs to be glued together. I've started to work on this already since I'd like to have a smoother experience for clients that may not have code lenses or don't want to use code lenses, but still don't want to manually have to enter the values. I also need this in nvim-metals for integration with nvim-dap 😬 .

The same concept should also be able to be applied to testing.

Sorry for breaking our own rules and creating a feature request here, but I'm already working on it...

Search terms:
running and debugging without code lens

@ckipp01 ckipp01 self-assigned this Feb 9, 2021
@ckipp01 ckipp01 added affects clients Use this if you are adding a new setting or making a change that will affect clients. debug DAP debug related tickets improvement Not a bug or a feature, but something general we can improve labels Feb 9, 2021
@tgodzik
Copy link
Contributor

tgodzik commented Feb 10, 2021

I wonder if we could also send in a source file and/or position, which would start the class at the current document. That could make it a bit more general also in case we have more main methods or test suites.

@ckipp01
Copy link
Member Author

ckipp01 commented Feb 10, 2021

which would start the class at the current document

What do you mean by this?

But yea I think we could totally have something that if you trigger in a specific file to run for example, it by default will run that build target (if it's possible), and then if it can't find a main there, then look in the other targets? And same concept for tests, etc. Like trigger it in file a and it tests a. Trigger it in b which is just utils, it does nothing, but returns options to run a, c, or d which are all tests. Something like that?

@tgodzik
Copy link
Contributor

tgodzik commented Feb 10, 2021

What do you mean by this?

So if we are currently in a main method or a test, we would invoke run/debug on that particular test or main method:

class MySuite extends FunSuite{
  test("simple"){
   CURSOR
  }
}

In the above scenario we would run the MySuite. Connected: scalameta/metals-feature-requests#72

@ckipp01
Copy link
Member Author

ckipp01 commented Feb 10, 2021

So if we are currently in a main method or a test, we would invoke run/debug on that particular test or main method:

Ahhh of course, yea that makes sense.

@tgodzik tgodzik added this to the Metals v0.10.1 milestone Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects clients Use this if you are adding a new setting or making a change that will affect clients. debug DAP debug related tickets improvement Not a bug or a feature, but something general we can improve
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants