Skip to content
This repository has been archived by the owner on Aug 25, 2019. It is now read-only.

harupy/dbeditor

Repository files navigation

DBEditor

A Chrome extension to provide useful code editting features on Databricks.

What this extension provides

  • Shortcuts
  • Code Snippets

Installation

DBEditor - Chrome Web Store

Getting Started

  1. Open a Databricks notebook on the browser
  2. Make sure the extension logo is enabled (the extension logo is enabled)
  3. Select a cell and enter the edit mode
  4. Type dp and press Tab (dp will be expanded to display())
  5. Type df.gb and press Tab (gb will be expanded to groupBy())
  6. Press Ctrl-U (The current line will be duplicated below)

Build from the Source

  1. Clone this repository
  2. npm install
  3. npm build
  4. Open chrome://extensions on Chrome
  5. Enable Developer mode if it's disabled
  6. Click Load unpacked
  7. Select src in the extension directory

Shortcuts

Note that some default shortcuts in Chrome are overridden.

Shortcut Action
Ctrl-K Delete the word the cursor is on
Ctrl-O Open a blank line below
Ctrl-Shift-O Open a blank line above
Ctrl-L Delete up to the end of the current line
Ctrl-H Delete up to the start of the current line
Ctrl-U Duplicate the current line below
Ctrl-Shift-U Duplicate the current line above

Snippets (Press Tab to expand)

Snippets List

Add your own snippets

You can add your own snippets by inserting a new key/value pair to the variable snippets in snippets.js.

const snippets = {
  ...
  // your own snippet
  'mf'   : 'myFunc(${args})',
}

How this extension works

Each cell on the notebook has an object called CodeMirror which manages the cell content and state. This extension injects a JS script to override the properties related to key bindings and add new features not provided by default.

Other Extensions

Extension Name Purpose
DBVim Enable Vim on Databricks
DBDark Provide a dark theme on Databricks
DBToc Create a table of contents with one click
DBHide Hide unnecessary code and cells

References

Acknowledgements

A huge thanks to Databricks for making big data simple.

License

MIT