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

Add commands to run or test the current file or target. #520

Merged
merged 1 commit into from
Apr 6, 2021

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Mar 12, 2021

Thanks to @ckipp01 it's now possible to run test or main classes inside the current file.

The Metals PR that added this functionality is scalameta/metals#2532

@tgodzik tgodzik requested a review from ckipp01 March 12, 2021 11:50
@@ -247,3 +247,14 @@ export interface DebugSession {
name: string;
uri: string;
}

export interface DebugDiscoveryParams {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ckipp01 should we move these classes to the language client?

Copy link
Member

Choose a reason for hiding this comment

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

Yea probably. I'll open a pr for that. Also, should we put in the other optional fields?

 "args"?: string[],
 "jvmOptions"?: string[],
 "env"?: {}, // <-- I actually don't know how this is is done in TS to signify it's an object with unknown k v pairs.
 "envFile"?: string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, we can. I haven't added them since they would require using launch.json, which I think might not work when running current file. Also it's kind of weird to set the same options for each file we would run. I think if a user requires arguments etc. then it makes sense to create a dedicated run configuration.

Copy link
Member

Choose a reason for hiding this comment

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

Yea true sounds good.

Copy link
Member

Choose a reason for hiding this comment

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

@tgodzik
Copy link
Contributor Author

tgodzik commented Mar 12, 2021

It works pretty cool! 😍

metals-1615550014766.mp4

@tgodzik tgodzik requested a review from gabro March 12, 2021 11:55
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated
registerTextEditorCommand(
`metals.test-current-file`,
(editor, _edit, _args) => {
let args: DebugDiscoveryParams = {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let args: DebugDiscoveryParams = {
const args: DebugDiscoveryParams = {

src/extension.ts Outdated
registerTextEditorCommand(
`metals.test-current-target`,
(editor, _edit, _args) => {
let args: DebugDiscoveryParams = {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let args: DebugDiscoveryParams = {
const args: DebugDiscoveryParams = {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

Base automatically changed from master to main March 25, 2021 17:04
Thanks to @ckipp01 it's now possible to run test or main classes inside the current file.

The Metals PR that added this functionality is scalameta/metals#2532
@tgodzik tgodzik merged commit f04e1f5 into scalameta:main Apr 6, 2021
@tgodzik tgodzik deleted the add-discovery-params branch April 6, 2021 19:34
kasiaMarek pushed a commit to kasiaMarek/metals-vscode that referenced this pull request Mar 29, 2023
…rn/minimatch-3.1.2

chore(deps): bump minimatch from 3.0.4 to 3.1.2
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

3 participants