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

Save as code snippet from editor selection #1186

Merged
merged 5 commits into from
Jan 15, 2021

Conversation

karlaspuldaro
Copy link
Member

@karlaspuldaro karlaspuldaro commented Jan 12, 2021

Resolves #1005

This PR implements the 'Save as Code Snippet' command.

  1. Select text from notebook or file editor
  2. Right click to open the context menu
  3. Select 'Save as Code Snippet'
  4. Metadata editor opens, code field is pre-populated with selection
  5. User fills out remaining form fields

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@elyra-bot
Copy link

elyra-bot bot commented Jan 12, 2021

Thanks for making a pull request to Elyra!

To try out this branch on binder, follow this link: Binder

@ptitzler
Copy link
Member

Awesome. Please tag me when the feature is ready for a test drive!

@karlaspuldaro karlaspuldaro marked this pull request as ready for review January 13, 2021 21:39
Copy link
Member

@ptitzler ptitzler left a comment

Choose a reason for hiding this comment

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

LGTM. Tested different file types and various editors. One observation: it appears that the action is only enabled for "cells" that are in edit mode. For example, open a notebook with a rendered markdown cell, and select some text. The save option is disabled. Is this intentional?

@marthacryan
Copy link
Member

Just tried locally and it worked well! +1 on Patrick's comment about not needing the cells to be in edit mode. Also, not sure if this is the desired behavior, but I think it could be good to add the behavior of saving an entire cell as a snippet if none of the text is selected.

@karlaspuldaro
Copy link
Member Author

@ptitzler @marthacryan Thank you for your feedback.
I just pushed a commit addressing the selection of a rendered notebook cell and markdown preview.
I will create a follow up issue to add notebook cells as new snippet.

@lresende lresende merged commit ca0b2da into elyra-ai:master Jan 15, 2021
@lresende lresende added this to the 2.0.0 milestone Jan 20, 2021
@karlaspuldaro karlaspuldaro deleted the code-snippets-save-selection branch March 31, 2021 19:48
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.

Save code snippet from editor selection
4 participants