Skip to content

Conversation

@AbdulrhmnGhanem
Copy link
Contributor

@AbdulrhmnGhanem AbdulrhmnGhanem commented Jul 3, 2021

Add Save Plot button, fixes #424.
Add Copy Plot button, fixes #172.

  • End-user documentation check.
  • Changelog mention.

  • Relying on the graphical backends turned out to a bit problematic because it will need to keep a reference to the code which produced the plot.
  • Even if the complexity of storing the code which produced the plot is acceptable, it won't work for calls to plot with mutable data e.g., plot(1:10, rand(10)).
  • Instead, save the SVG displayed in the plot pane.

- Relying on the graphical backends turned out to be problamatic because
it will need to keep a reference the code which produced the plot.
- Even if the complexity of storing the code which produced the plot is
acceptable, it won't work for calls to `plot` with mutable data e.g.,
`plot(1:10, rand(10))`.
- Instead save the svg displayed in the plot pane.
- !Only tested with `Plots` no other graphical backends
@AbdulrhmnGhanem AbdulrhmnGhanem marked this pull request as draft July 3, 2021 18:09
@AbdulrhmnGhanem AbdulrhmnGhanem changed the title Save Plots Save/Copy Plots Jul 4, 2021
@pfitzseb
Copy link
Member

pfitzseb commented Jul 4, 2021

Nice! I'll take a more detailed look tomorrow, but could you please make sure to configure eslint so that it conforms to the code style we have going so far (no semi-colons etc). Really hard to read the diff otherwise (and it would be good to keep the codebase consistent).

@AbdulrhmnGhanem AbdulrhmnGhanem marked this pull request as ready for review July 4, 2021 17:06
AbdulrhmnGhanem added a commit to AbdulrhmnGhanem/docs that referenced this pull request Jul 4, 2021
Copy link
Member

@pfitzseb pfitzseb left a comment

Choose a reason for hiding this comment

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

Ok, the code here looks good (although there still are a bunch of weird eslint-looking changes around -- maybe we should just take the time to configure eslint properly and run it on the whole codebase).

That said, I don't think OS specific binaries are the way to go. We really want something that

  1. Runs in the renderer process (so that it uses the correct clipboard when developing on a remote).
  2. Doesn't require us to ship binaries.

AbdulrhmnGhanem and others added 4 commits July 8, 2021 10:32
- No longer needed; the copy feature relies on browser Clipboard API.
- It was needed copy to plots to the clipboard with native binaries; it's no longer needed as the copy feature relies on the browser Clipboard API.
Copy link
Member

@pfitzseb pfitzseb left a comment

Choose a reason for hiding this comment

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

Looking good and works great! I've left two comments that I'd like to see addressed before merging this though.

Also, there still are a bunch of code style changes in here. Please revert them for now (which should also address the merge conflict); we can figure out a proper eslint setup later on.

*/
function _writePlotFile(fileName: string, data: FileLike) {
const rootPath = vscode.workspace.workspaceFolders[0].uri.fsPath
const plotsDir: string = vscode.workspace
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I think we should be using window.showSaveDialog here to prompt for a location; the default path and file name handling here are fine, of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved in 824acb4.

- Instead of saving the plots to `julia.plots.path`, enable the user to
  choose a path from the `SaveDialog`.
- Also, remove the default value for `julia.plots.path`, creating the directory if the user don't want it, can be annoying.
@AbdulrhmnGhanem AbdulrhmnGhanem force-pushed the export-plot branch 3 times, most recently from ee84fda to c285887 Compare July 21, 2021 12:47
@logankilpatrick
Copy link
Member

Reminder to merge the PR here: julia-vscode/docs#35 when this PR gets merged.

@davidanthoff
Copy link
Member

I think this just needs a merge conflict resolution?

Copy link
Member

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

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

@AbdulrhmnGhanem same thing as with the other one: would be great if you could resolve the merge conflict, and then we can include it in the next minor release.

@pfitzseb
Copy link
Member

pfitzseb commented Sep 6, 2021

This is included in #2273, so closing.

@pfitzseb pfitzseb closed this Sep 6, 2021
@AbdulrhmnGhanem AbdulrhmnGhanem deleted the export-plot branch October 11, 2021 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add 'save plot' button Add copy to clipboard option to plot pane

4 participants