-
Notifications
You must be signed in to change notification settings - Fork 74
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
Conversation
tgodzik
commented
Oct 24, 2022
•
edited
Loading
edited
@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"); |
There was a problem hiding this comment.
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 🤔 ?
There was a problem hiding this 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.
3f8a59f
to
dc7353e
Compare
src/scalaDebugger.ts
Outdated
@@ -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(() => { |
There was a problem hiding this comment.
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)
src/scalaDebugger.ts
Outdated
@@ -31,10 +36,58 @@ export function initialize(outputChannel: vscode.OutputChannel): Disposable[] { | |||
]; | |||
} | |||
|
|||
function isScalaRunMain(object: any): object is ScalaRunMain { |
There was a problem hiding this comment.
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 😅
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.
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM