GitHub user minahlee opened a pull request:
https://github.com/apache/zeppelin/pull/1415
[ZEPPELIN-1026] set syntax highlight based on default bound interpreter
### What is this PR for?
This is complete work of #1148. Comments and tasks on #1148 has been
handled in this PR.
- Add syntax language information in `interpreter-setting.json`
- When user type `%replName` in paragraph, back-end check if the
interpreter name with `replName` exists, and return language information to
front-end if it does
- If user doesn't specify `%replName`, default interpreter's language will
be used
- Using alias name for paragraph syntax highlight
### What type of PR is it?
[Bug Fix | Improvement]
### What is the Jira issue?
[ZEPPELIN-1026](https://issues.apache.org/jira/browse/ZEPPELIN-1026)
### How should this be tested?
1. Create new note and make markdown interpreter to be default.
2. See if markdown syntax is applied.
### Screenshots (if appropriate)
#### Case 1. When the default interpreter set to python interpreter.
**Before**
Has `scala` as syntax highlight language when %python is not set.
<img width="665" alt="screen shot 2016-07-07 at 10 46 20 pm"
src="https://cloud.githubusercontent.com/assets/8503346/16655312/af67a302-4494-11e6-949e-793ad0515d7a.png">
**After**
Has `python` as syntax highlight language even when %python is not set.
<img width="666" alt="screen shot 2016-07-07 at 10 44 39 pm"
src="https://cloud.githubusercontent.com/assets/8503346/16655248/769d8ba4-4494-11e6-9b3c-dc5e026e9c53.png">
#### Case 2. When use alias name as repl name.
**Before**
<img width="742" alt="screen shot 2016-09-08 at 4 22 39 pm"
src="https://cloud.githubusercontent.com/assets/8503346/18353471/620c5ede-75e2-11e6-9d01-0726bc900dc0.png">
**After**
<img width="741" alt="screen shot 2016-09-08 at 4 34 57 pm"
src="https://cloud.githubusercontent.com/assets/8503346/18353487/6cdaa406-75e2-11e6-831a-08e0fa3a85d8.png">
### Further possible improvements
There are still several cases that Zeppelin doesn't handle syntax highlight
well. These can be handled with another jira ticket/PR.
1. When default bound interpreter changes, syntax highlight is not changed
accordingly
2. When copy/paste code, syntax highlight won't be applied properly since
Zeppelin only checks changes when cursor is in first line.
### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? yes(for creating new interpreter)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/minahlee/zeppelin ZEPPELIN-1026
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1415.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 #1415
----
commit b2742977a375f19897844fe20b1a0a53eec68166
Author: Mina Lee <[email protected]>
Date: 2016-08-24T13:39:05Z
Add editor field
commit bb0beaa59c0f89d00fe96e3c2239b43845f9b8db
Author: Mina Lee <[email protected]>
Date: 2016-08-24T14:04:51Z
Align comments for readability
commit b715fda9d7c5e5c2c0a212d8ce4b6df9585b1d64
Author: Mina Lee <[email protected]>
Date: 2016-08-24T20:57:08Z
Get paragraph editor mode from backend
commit 27f4a843015aa32896961562bdbc0c50f7d3ab9e
Author: Mina Lee <[email protected]>
Date: 2016-08-24T20:57:19Z
[DOC] Setting syntax highlight when writing new interpreter
commit 98e21c9e484982ece371783baad3c53a2aeaab3f
Author: Mina Lee <[email protected]>
Date: 2016-08-24T20:57:28Z
Add test
commit e1b4feae4207dd62bc40132aeabd8f4ae277d5ba
Author: Mina Lee <[email protected]>
Date: 2016-09-08T13:12:40Z
Change the way to read interpreter language from interpreter-setting.json
after #1145
commit 5c18f0ff38c0fbe8becca4d5723fecbd07dc983b
Author: Mina Lee <[email protected]>
Date: 2016-09-08T14:05:05Z
Change condition for triggering 'getAndSetEditorSetting' to reduce
front-end <-> back-end communication
commit 9bc9e886d359783dd5e14f18e22a3d79031e11a1
Author: Mina Lee <[email protected]>
Date: 2016-09-08T14:53:05Z
Fix test
----
---
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.
---