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

feature: Run from lenses in local terminal #1199

Merged
merged 6 commits into from
Nov 4, 2022

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Oct 24, 2022

scala3-example-project-1666702645963

@tgodzik tgodzik requested a review from kpodsiad October 24, 2022 16:43
@tgodzik
Copy link
Contributor Author

tgodzik commented Oct 24, 2022

@kpodsiad what do you think? We can also generate lenses with run command and change the data that is being given, but that would not be that much gain and I think having the environment commands in metals server allows us for more flexibility.

src/extension.ts Outdated
if (args.length == 1) {
const main = args[0];
if (isScalaRunMain(main)) {
let terminal = window.terminals.find((ter) => ter.name == "Metals");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could potentially run in any currently open terminal, I think that's what python does.

Or we could try printing to a separate out 🤔 ?

Copy link
Member

@kpodsiad kpodsiad left a comment

Choose a reason for hiding this comment

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

It look promising, however I'll wait witch suggestions until we decide what should be done at server side.

@tgodzik tgodzik force-pushed the run-locally branch 4 times, most recently from 3f8a59f to dc7353e Compare October 27, 2022 19:37
@@ -75,7 +128,7 @@ class ScalaMainConfigProvider implements vscode.DebugConfigurationProvider {
path: editor.document.uri.toString(true),
runType: RunType.RunOrTestFile,
};
return start(false, args).then(() => {
return start(debugConfiguration.noDebug, args).then(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out that debugConfiguration contains the noDebug flag as a undeclared field. This is useful when running with F5 (Run without debugging)

@@ -31,10 +36,58 @@ export function initialize(outputChannel: vscode.OutputChannel): Disposable[] {
];
}

function isScalaRunMain(object: any): object is ScalaRunMain {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not super sure about this one, but seems to do the job 😅

@tgodzik tgodzik requested a review from kpodsiad October 27, 2022 19:41
tgodzik and others added 3 commits November 3, 2022 12:32
This will work in all the cases:
- within code lenses
- when running with F5
- when running using the discover command

I added a command on the server side that will return the main class debug session object to use together with the added shell command.

This all uses the same logic, so should work pretty nicely.
@tgodzik tgodzik marked this pull request as ready for review November 3, 2022 12:18
Copy link
Member

@kpodsiad kpodsiad left a comment

Choose a reason for hiding this comment

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

I left a couple of suggestions

src/testExplorer/types.ts Outdated Show resolved Hide resolved
src/scalaDebugger.ts Outdated Show resolved Hide resolved
src/scalaDebugger.ts Outdated Show resolved Hide resolved
src/scalaDebugger.ts Outdated Show resolved Hide resolved
src/scalaDebugger.ts Outdated Show resolved Hide resolved
Copy link
Member

@kpodsiad kpodsiad 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 tgodzik merged commit f2c0c7f into scalameta:main Nov 4, 2022
@tgodzik tgodzik deleted the run-locally branch November 4, 2022 16:15
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