Skip to content

Conversation

@minahlee
Copy link
Member

@minahlee minahlee commented Sep 8, 2016

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

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.
screen shot 2016-07-07 at 10 46 20 pm

After
Has python as syntax highlight language even when %python is not set.
screen shot 2016-07-07 at 10 44 39 pm

Case 2. When use alias name as repl name.

Before
screen shot 2016-09-08 at 4 22 39 pm

After
screen shot 2016-09-08 at 4 34 57 pm

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)

@minahlee minahlee changed the title [ZEPPELIN-1026] set syntax highlight based on default bound interpreter [WIP][ZEPPELIN-1026] set syntax highlight based on default bound interpreter Sep 9, 2016
@minahlee minahlee changed the title [WIP][ZEPPELIN-1026] set syntax highlight based on default bound interpreter [ZEPPELIN-1026] set syntax highlight based on default bound interpreter Sep 12, 2016
@minahlee
Copy link
Member Author

CI is green, ready for review.

"description": "Property 2 description"
}, ...
},
"editor": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question - it's a bit not clear if this section is mandatory and if not, what is going to be the default one? May be it could be described in docs below.
Asking as there are i.e PRs that implement a new interpreters, before this section was introduced.

Copy link
Member Author

@minahlee minahlee Sep 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! If the language is not specified plain text mode will be used for syntax highlight, which will highlight nothing. I added description in fd7896e. Thanks for review :)

@bzz
Copy link
Member

bzz commented Sep 13, 2016

Looks great to me.

return factory.getInterpreter(getId(), name);
}

public Map<String, Object> getEditorSetting(String replName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method is more make sense to be placed in InterpreterFactory, while editor setting is related interpreter and interpreter setting, not each note. What do you think?

Copy link
Member Author

@minahlee minahlee Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Leemoonsoo It totally makes sense, I made change in e810da4. Please review.

@Leemoonsoo
Copy link
Member

@minahlee Great work! LGTM

@minahlee minahlee force-pushed the ZEPPELIN-1026 branch 3 times, most recently from ed2f473 to aa5eb2f Compare September 22, 2016 09:53
@minahlee
Copy link
Member Author

Merge if there is no more discussion

@asfgit asfgit closed this in a3ca800 Sep 23, 2016
@minahlee minahlee deleted the ZEPPELIN-1026 branch September 24, 2016 19:05
pedrozatta pushed a commit to pedrozatta/zeppelin that referenced this pull request Oct 27, 2016
### What is this PR for?
This is complete work of apache#1148. Comments and tasks on apache#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)

Author: Mina Lee <[email protected]>

Closes apache#1415 from minahlee/ZEPPELIN-1026 and squashes the following commits:

c66fb0e [Mina Lee] Move getEditorSetting to InterpreterFactory class
2d56222 [Mina Lee] Add description about default syntax highlight in doc
08ccad9 [Mina Lee] Fix test
0874522 [Mina Lee] Change condition for triggering 'getAndSetEditorSetting' to reduce front-end <-> back-end communication
9e4f2e9 [Mina Lee] Change the way to read interpreter language from interpreter-setting.json after apache#1145
75543b3 [Mina Lee] Add test
565d9d0 [Mina Lee] [DOC] Setting syntax highlight when writing new interpreter
20132ca [Mina Lee] Get paragraph editor mode from backend
52f4207 [Mina Lee] Align comments for readability
26cbbb8 [Mina Lee] Add editor field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants