New in Datalore: Intentions, magics, command mode, and more
In the last update, Datalore gained some code editing features from PyCharm: inspections and quick-fixes. Today we are coming back to you with more updates in code insight and some other new useful features.
Intention is a special action that can be executed on code. The concept is similar to quick-fix, with the difference that while quick-fix is applied to erroneous code, intention is a way to modify valid code to make it express what you mean even better.
The Datalore kernel is now fully compatible with the IPython kernel, which means that all the features of the IPython kernel work the same way when you use the incremental Datalore kernel. This includes IPython magic commands.
Some of you are probably familiar with the concept of Command Mode from editors like Vim and Jupyter Notebook. We find this feature very helpful since it allows users to quickly navigate between cells, and select multiple cells to cut/delete/paste.
Now we have implemented Command Mode in Datalore, so why not give it a try?
The basic keystrokes are:
- Esc – enable Command Mode (editor loses focus and caret disappears)
- Enter – disable Command Mode and return to Edit Mode (brings the caret back to the editor)
- Up / k – select previous block
- Down / j – select next block
- Shift + j / Shift + Down – extend selected blocks downwards
- Shift + k / Shift + up – extend selected blocks upwards
- copy/cut/paste selected blocks (hotkeys:
- Delete or Backspace – delete block
If you did something wrong – don’t forget that Undo (Ctrl + z) works from Command Mode as well.
If you forget the shortcuts – you can always find them in the Help -> Shortcuts menu.
The Datalore kernel preserves the consistency of workbook cells by incremental updates – after you’ve made an edit, only the code cells that depend on this edit will be recalculated. However, in some cases you may want to tell the Datalore kernel that the variables in a particular cell shouldn’t be changed during execution – in other words, they are read-only variables. To do this you can use the readonly annotation to signify that these variables are not to be changed during cell execution. Subsequent cells that use these variables will not be recalculated, and so computation time is reduced and your experiments iterate more quickly:
By using readonly you can skip unnecessary recalculations.
Please note that readonly won’t “freeze” the value of the variable – it should be used only when you’re sure that the variable will remain unchanged during the cell execution.
Distraction free mode
Distraction free mode (View -> Distraction free mode) hides the menu, status bar, and the editor tabs allowing you to focus on the editor content.
In distraction free mode you can still access the menu and editor tabs by hovering over where they would normally be.
Table of contents
Enable the option Tools -> Table of Contents to display a table of contents that will help you to navigate through your notebook with ease.
That’s all for today! We look forward to hearing your feedback! Especially about the incremental Datalore kernel as we’ve made some improvements already and are going to implement some more changes. What do you think about the incrementality? Do you like it? How can it be improved? You can give us your feedback in the comments under this post or in the Datalore forum.