-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Issue 12414 python interactive cell editing shortcuts #12529
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
Issue 12414 python interactive cell editing shortcuts #12529
Conversation
…s multiple modules
* add method insertCell to CodeWatcher which inserts at current line * add method insertCellBelowPosition which inserts below current selection * link insertCellBelowPosition to command python.datascience.insertCellBelowPosition
* add method insertCellBelow to the CodeWatcher * link insertCellBelow to python.datascience.insertCellBelow This will insert a cell below the last cell of the current selection
* add method insertCellAbove to the CodeWatcher * link insertCellAbove to python.datascience.insertCellAbove * will insert cell above the top cell of the current selection
* add deleteCells method to CodeWatcher * link deleteCells to python.datascience.deleteCells
* add selectCell method to CodeWatcher * link selectCell to python.datascience.selectCell
* add selectCellContents method to CodeWatcher * link selectCellContents to python.datascience.selectCellContents
* Works similar to excell extend selection by one cell above * Linked command to python.datascience.extendSelectionByCellAbove
* Works similar to excell extend selection by one cell below * Linked command to python.datascience.extendSelectionByCellBelow
* Command to take selected cells and move them one cell up * linked command to python.datascience.moveCellsUp
* Moves selected cells one cell down * Linked to python.datascience.moveCellsDown
👋 @greazer Here are changes I made for the keyboard editing shortcuts on the python interactive cells. There are a few check points on the PR that I'm not sure about.
|
* command will use selected cell and if cell_type is not markdown will convert to markdown * linked to python.datascience.changeCellToMarkdown
@earthastronaut Thanks for doing this! We will take a look and let you know next steps! |
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.
🕐
To answer your questions:
We log just about every operation but it's probably not necessary for the changes you made. Unless they are complex enough that they may fail in the real world. I think we can live without it for now though.
I think you should add telemetry for each new command you added. Follow the pattern for the other commands in the codewatcher.ts file.
Right now I don't think we need to add these changes to the test plan. (https://github.com/microsoft/vscode-python/blob/master/.github/test_plan.md). We generally use the test plan for manual testing and only higher order things. Since we have automated tests, that should be sufficient.
Our wiki is here: https://github.com/microsoft/vscode-python/wiki. We don't generally put every piece of code on it though as it'd be too much to keep up to date. |
* command will use selected cell and if cell_type is not code then it'll convert to code * linked to python.datascience.changeCellToCode
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.
🕐
@earthastronaut just wanted to double check you weren't waiting for more feedback. The comments I made about some of the async functions don't all seem to have been addressed yet. |
Hi @rchiodo, yes will address them in the next few days. I was afk the last week and half. |
@rchiodo what is the standard for handling these conflicts? Is a rebase or merge preferred? I started a rebase but am struggling with a change that's unrelated to mine that seems to have broken. |
Hey @earthastronaut, Rich is OOF this week. I believe merge is preferred. Could you try that and let me know if the merge conflict persists? i.e. after setting this repo as |
979b507
to
02cc7a5
Compare
Thanks @joyceerhl merge worked well. Just needed to combine a few changes from master into mine. After merging master, my workspace is highlighting a warning with "categories" within the package.json file. Specifically, it's highlighting |
Apologies, I think you may need to delete these lines in |
Resolved conflicts by merging master changes into branch changes manually to keep all new master changes. Conflicts: package.nls.json src/client/common/application/commands.ts src/client/datascience/editor-integration/codewatcher.ts
02cc7a5
to
6ac5741
Compare
Thanks @joyceerhl! I thought I pushed those changes up but they should be up now. |
Codecov Report
@@ Coverage Diff @@
## master #12529 +/- ##
==========================================
+ Coverage 59.63% 59.79% +0.15%
==========================================
Files 670 670
Lines 36823 37172 +349
Branches 5188 5263 +75
==========================================
+ Hits 21960 22226 +266
- Misses 13770 13816 +46
- Partials 1093 1130 +37
Continue to review full report at Codecov.
|
package.json
Outdated
"command": "python.datascience.selectCellContents", | ||
"title": "%python.command.python.datascience.selectCellContents.title%", | ||
"category": "Python", | ||
"when": "python.datascience.hascodecells && python.datascience.featureenabled && python.datascience.ispythonornativeactive" |
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.
This ispythonornativeactive
will ensure this command is available in python files and notebook.
However in notebooks it does nothing. If this purpose of this PR is to add commnds for interactive window, then we shouldn't use this condition, i.e. it should be done only when a python file is active, e.,g. python.datascience.hascodecells && editorFocus && editorLangId == python && python.datascience.featureenabled
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.e. we need to ensure these commands are only displayed when we are in a python file with cells.
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.
Thanks @DonJayamanne. I pushed up a change for that. Should that also be the same for runcurrentcell or runcurrentcelladvance? Those are what I modeled my choices after.
Kudos, SonarCloud Quality Gate passed!
|
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.
@earthastronaut, just want to thank you more personally for the effort you made here to get this in. We really appreciate outside contributions and this one, in particular, was one that is close to my heart. See, I really, really think the interactive experience has a lot of potential to not just appeal to software engineers who find themselves doing data science activities (as it's original intent was), but also has potential for establishing a more flexible, maintainable, and productive way of doing any work that is currently being done in traditional notebooks. These commands you added for us (and others who requested them) continue to blur the line between what notebook and script development is. Finally, I took the step to add the ability to navigate from cell to cell (also requested) and connect ALL of the new commands to a default set of keyboard bindings. See PR #13334. Thanks again! |
@greazer thank you so much for your words! That's fantastic you added the additional navigation. I'm excited to see if this finds traction in the world because I definitely agree with your points about flexible, maintainable and productive. I've started using the functions in my own coding and am loving it. |
For #12414
Has sufficient logging.Not needed. See comment thread.Has telemetry for enhancements.Not needed. See comment thread.Test plan is updated as appropriate.Not needed. See comment thread.No Changespackage-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).The wiki is updated with any design decisions/details.Not needed. See comment thread.