Uh oh!
There was an error while loading. Please reload this page.
ZEPPELIN-219: Paragaph mode auto-detection - initial impl - #206
Conversation
There was a problem hiding this comment.
reuse the text gotten in aceChanged? how bad is it to get this again?
There was a problem hiding this comment.
I will reuse the text value. Don't know what is the performance implication of calling it again.
tzolov
commented
Aug 13, 2015
Note: apparently i didn't commit all changes with the latest commit (40b9a33). Will redo it again. |
7fe3b19 to
ff896a4Comparedjoelz
commented
Aug 14, 2015
I would love to see some unit tests for this. |
tzolov
commented
Aug 16, 2015
@djoelz, this change affects paragraph.controller.js. I am not sure i've seen units tests for this or the other js controllers? But i might have missed something. @Leemoonsoo is there some samples for testing such behavior? |
Leemoonsoo
commented
Aug 16, 2015
Two possible places for test. test controllers and directives or test using selenium |
7a779b0 to
c0cdbc2Comparetzolov
commented
Aug 24, 2015
@Leemoonsoo thanks for the references. If not mistaken the test controllers and directives doesn't contain any real controller tests at the moment. As i've mentioned earlier i'm not much of js/angular authority and would prefer to learn from someone else's experience and examples. @djoelz do you feel like you can help here? |
corneadoug
commented
Aug 24, 2015
Maybe I can help with those tests, I guess we need:
|
tzolov
commented
Aug 24, 2015
@corneadoug, your help will be well appreciated! The suggested testset sounds good and covering the functionality. |
djoelz
commented
Aug 24, 2015
@tzolov I am also new to the angular/js world but if @corneadoug can provide a starting point I can help with the more tests. |
b24f0d5 to
a507e3eComparecorneadoug
commented
Aug 27, 2015
Hi, Sorry guys I'm taking a bit of time on this one. |
bzz
commented
Aug 27, 2015
@corneadoug not sure but think that to be able to see it in "create new PR" ui you need to make sure that the branch you are using is actually derived from https://github.com/tzolov/incubator-zeppelin/tree/ZEPPELIN-219 (either checkouted from ZEPPELIN-219 branch of the clean clone of tzolov/incubator-zeppelin or from the new 'remote' pointing here, inside your existing repo) You can verify it with |
corneadoug
commented
Aug 27, 2015
I created a remote from his repo, then used his branch as a base. |
corneadoug
commented
Aug 27, 2015
@tzolov can you merge this into your branch then? https://github.com/corneadoug/incubator-zeppelin/tree/improve/ZEPPELIN-219 |
tzolov
commented
Aug 28, 2015
@corneadoug, thanks for the improvements. |
fe37ef9 to
518f009Comparetzolov
commented
Sep 3, 2015
@corneadoug, have you had chance on writing an unit test(s) for this PR? |
corneadoug
commented
Sep 3, 2015
@tzolov I started doing it, if possible give me a day to finish it up |
tzolov
commented
Sep 3, 2015
@corneadoug, glad to hear you are working on this. Take your time. Your help is highly appreciated and will help me/us learn how to write such tests! |
corneadoug
commented
Sep 6, 2015
tzolov
commented
Sep 6, 2015
@corneadoug it is done. just rebased (after ZEPPELIN-228) and pushed. |
corneadoug
commented
Sep 7, 2015
Just spent a lot of time on this. |
tzolov
commented
Sep 7, 2015
Thanks for the update @corneadoug. I've faced the ace upgrade issue while preparing the (ZEPPELIN-216). When i tried to upgrade ace to 1.2.0 the existing ui-ace version complained. I've managed to increase ui-ace but had to force some dependency resolutions and was not confident it will not cause side effects. So i upgraded ace to safest ace 1.1.9 version instead. But if you manage to upgrade ui-ace (very outdated it seems) it will allow us upgrade ace-build as well. @Leemoonsoo , @felixcheung it seems that this PR (e.g. ZEPPELIN-219) is ready to merge. |
Madhuka
commented
Sep 7, 2015
Leemoonsoo
commented
Sep 7, 2015
Looks good to me! |
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'] ]; ``` Author: Damien Corneau <corneadoug@gmail.com> Author: tzolov <christian.tzolov@gmail.com> Closesapache#206 from tzolov/ZEPPELIN-219 and squashes the following commits: fda3f5e [Damien Corneau] Improve loop performances 153f327 [Damien Corneau] Change setParagraphMode function ea76881 [tzolov] ZEPPELIN-219: Add paragraph text as setPargraphMode() argument aab3b7c [tzolov] ZEPPELIN-219: Paragaph mode auto-detection - initial impl (cherry picked from commit eebae39) Signed-off-by: Lee moon soo <moon@apache.org>
Here are the mode autodetection rules (and optimizations):
aceChangeevent.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:
For example: