GitHub user tzolov opened a pull request:
https://github.com/apache/incubator-zeppelin/pull/206
ZEPPELIN-219: Paragaph mode auto-detection - initial impl
Here are the mode autodetection rules (and optimizations):
- Evaluates the editor mode on each `aceChange` event.
- (Optimization 1) Evaluates the mode only if the cursor is within the
first 30 characters of the buffer.
- (Optimization 2) Sets the mode (e.g. `session.setMode(new mode)` ) only
if the new mode differs from the previous one.
Also the mode tag detection structure is refactored to bring together the
interpreter tag test and the mode reference. The convention looks like this:
```javascript
var editorModes = [
[<Your Mode 1 Reg Expression Test>, <ACE Mode 1>],
......
[<Your Mode N Reg Expression Test>, <ACE Mode N>]
];
```
For example:
```javascript
var editorModes = [
[/^%spark/, 'ace/mode/scala'],
[/^%(\w*\.)?\wql/, 'ace/mode/sql'],
[/^%md/, 'ace/mode/markdown'],
[/^%sh/, 'ace/mode/sh']
];
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tzolov/incubator-zeppelin ZEPPELIN-219
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-zeppelin/pull/206.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #206
----
commit 7cdefa7b63abe0939d2eab36cd21f7126dbb7357
Author: tzolov <[email protected]>
Date: 2015-08-12T21:34:50Z
ZEPPELIN-219: Paragaph mode auto-detection - initial impl
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---