-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A proper mixed codemirror mode #52
Comments
This is something that I have always wanted to do, but could not do it with my limited experience in JS, until now. The new SoS mode has the following features
The goal here is to help users edit and debug SoS script. For example, without Many things can be fine tuned because we now can define our own styles. Suggestions on further improvements are welcome. The next step is to use |
I see ... I was about to comment that I do not see R syntax properly highlighted, judged by (input something like But maybe it is what it is?
Will happily give that a go! |
It should work with Jupyter. Did you The
style should be the same as |
I did not try myself, I'm only commenting on what you've posted, that screen shot, that |
I do not see that operator highlighted in Jupyter. I suppose that page used some special css. |
I suppose a good indicator should be the $ symbol, which was marked as red (error) by python. |
Could you send me the pure text version? |
Sure, see below:
and
|
Try again now. |
Perfect! Although I'm not sure if I like scripts being italic. I personally think it reads better that maybe just action options written in italic but step options and script use regular font. It is just a bit weird to read italic for long scripts. |
I would vote for only what follows |
This is interesting ... italic and upright fonts are sharply different, and the version above reads good in my eyes. So maybe for that reason this is not very obvious to you, but in your first step of output,
Also, maybe using some other font color, or even and underline is better than background color? |
The are different if I look for it... background color let me know instantly which code block has
It is a bug in the detection of end of options. Will fix.
Maybe, but underline would not work well with |
OK, I checked other codemirror "nested" style and they do not highlight inside style with italic etc, so I have removed the which I will have to use more to like/dislike it. It is disappointing that codemirror does not highlight python expressions inside f-string though. Perhaps I will figure out a patch and submit to CodeMirror later. |
Looks good to me! Will keep posting like/dislikes after using it more. |
Syntax highlighter does not handle
or
|
The SoS CodeMirror mode, as defined in kernel.js, is a Python mode + magic and SoS statements. It does not highlight code in other languages correctly. In theory, we should
R
code mirror mode (plus magics) forR
cells, and so on.R:
as R code etc. It should in theory also recognizeexpand=True
etc to correctly identify and highlightSoS
expressions.Item 1 could be done when the language of a cell is switched. We should be able to create new codemirror mode and switch to it. There is however a slight problem with the name of the language (e.g. R) might not match name of code mirror.
Item 2 could be done with nested codemirror mode, and there are examples such as htmlmixedmode.
The text was updated successfully, but these errors were encountered: