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 experiment icons to editor/title when params file is open #1740

Merged
merged 6 commits into from
May 20, 2022

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented May 19, 2022

2/2 main <- #1745 <- this

Inspired by this comment from @dberenbaum. Namely, this part:

For non-queue experiments, modifying params in the CLI is a convenience to avoid opening an editor, which isn't necessary for VS Code. You could have a separate option to modify params without doing anything else (either using the existing interface or by opening the params files in the editor). This may simplify the menu options and make it easier to review changes before running experiments.

We will now show the run/resume/reset and run/ queue icons in the editor/title whenever a params file is open. E.g:

image

This opens up the possibility of adding open to the side from the experiments table webview column context menu. Which will get us closer some kind of easier (but not quite inline) parans editing. After the user clicks on the "open params file to side" in the column context menu they would have a view like this:

image

Code is just a prototype for now. I should be able to knock over a real version fairly quickly.

Demo

Screen.Recording.2022-05-20.at.1.57.04.pm.mov

@mattseddon mattseddon added the product PR that affects product label May 19, 2022
@mattseddon mattseddon self-assigned this May 19, 2022
@mattseddon mattseddon changed the base branch from main to experiment-context-menus May 19, 2022 10:04
@mattseddon
Copy link
Member Author

Tests are failing because the test fixture is not static and uses a parsing file which now imports vscode.

@dberenbaum
Copy link
Contributor

Nice idea @mattseddon! What happens if there are multiple params files?

@mattseddon
Copy link
Member Author

Nice idea @mattseddon! What happens if there are multiple params files?

Icons will show whenever any of the files are the active text editor (we collect all of the params files from the exp show output).

@shcheklein
Copy link
Member

That's super cool @mattseddon ! :)

Base automatically changed from experiment-context-menus to main May 19, 2022 22:19
@mattseddon mattseddon force-pushed the show-exp-icon-for-params-files branch from 978f174 to 8fe9a1f Compare May 19, 2022 22:23
@mattseddon mattseddon force-pushed the show-exp-icon-for-params-files branch from 8fe9a1f to 077602a Compare May 20, 2022 01:05
@mattseddon mattseddon force-pushed the show-exp-icon-for-params-files branch from 54c0885 to 90d75bd Compare May 20, 2022 01:46
@mattseddon mattseddon changed the base branch from main to make-test-fixture-static May 20, 2022 02:08
@mattseddon mattseddon changed the base branch from make-test-fixture-static to main May 20, 2022 03:53
@mattseddon mattseddon force-pushed the show-exp-icon-for-params-files branch from 41f118e to abebb4d Compare May 20, 2022 03:54
@mattseddon mattseddon changed the base branch from main to make-test-fixture-static May 20, 2022 03:55
@mattseddon mattseddon marked this pull request as ready for review May 20, 2022 03:55
@@ -537,4 +546,44 @@ export class Experiments extends BaseRepository<TableData> {

return experiment?.id
}

private setActiveEditorContext() {
Copy link

Choose a reason for hiding this comment

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

Function setActiveEditorContext has 33 lines of code (exceeds 30 allowed). Consider refactoring.

{
"command": "dvc.runExperiment",
"group": "navigation@0",
"when": "dvc.params.fileActive && !dvc.runner.running && dvc.commands.available && !dvc.experiment.checkpoints"
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] For some reason these do not take ORs with brackets. We may want to split in the future so I think this duplication is ok... and I also hate it.... and it's ok.

@@ -42,6 +44,7 @@ export const ExperimentsScale = {
} as const

export class Experiments extends BaseRepository<TableData> {
public readonly onDidChangeIsParamsFileFocused: Event<string | undefined>
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] If there are multiple projects in the workspace and a params file for a particular project is in the active editor then we don't want to prompt the user for which project they want to run the command against.

}

this.dispose.track(
this.onDidChangeColumns(() => {
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] Covers startup and changes to files (adding/deleting).

Base automatically changed from make-test-fixture-static to main May 20, 2022 19:08
@mattseddon mattseddon force-pushed the show-exp-icon-for-params-files branch from abebb4d to 92872b7 Compare May 20, 2022 21:09
@mattseddon mattseddon enabled auto-merge (squash) May 20, 2022 21:10
@codeclimate
Copy link

codeclimate bot commented May 20, 2022

Code Climate has analyzed commit 92872b7 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 96.8% (0.0% change).

View more on Code Climate.

@mattseddon mattseddon merged commit d843598 into main May 20, 2022
@mattseddon mattseddon deleted the show-exp-icon-for-params-files branch May 20, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants