Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 08 2019 17:20
    mmagnuski closed #219
  • Oct 12 2018 13:40
    gdkrmr closed #218
  • May 19 2018 02:07
    yehielliv commented #223
  • May 19 2018 02:03
    yehielliv opened #223
  • Feb 10 2018 11:08
    currymj closed #171
  • Jul 25 2016 19:04
    jingpengwu commented #203
  • May 24 2016 12:19
    JonWel closed #183
  • May 24 2016 12:19
    JonWel commented #183
  • Apr 12 2016 11:11
    MikeInnes closed #185
  • Apr 12 2016 11:11
    MikeInnes closed #166
  • Apr 12 2016 11:11
    MikeInnes closed #163
  • Apr 12 2016 11:11
    MikeInnes closed #101
  • Apr 12 2016 11:11
    MikeInnes closed #82
  • Apr 12 2016 11:11
    MikeInnes closed #73
  • Apr 12 2016 11:11
    MikeInnes closed #68
  • Apr 12 2016 11:11
    MikeInnes closed #69
  • Apr 12 2016 11:11
    MikeInnes closed #61
  • Apr 12 2016 11:10
    MikeInnes closed #59
  • Apr 12 2016 11:10
    MikeInnes closed #57
  • Apr 12 2016 11:08
    MikeInnes closed #32
Mike J Innes
@MikeInnes
Liking your theme so far! So far I think I'll probably split June into it's own plugin so that it's usable from other languages, so doing that with yours too is probably the best thing
Mike J Innes
@MikeInnes
I actually really like this idea – I'll probably have a go at something like that for functions/vars
Wouldn't be too hard to keep track of the n variables in the current scope and emit the style variable-n
Eric West
@edubkendo
I remember seeing Douglas Crockford suggest something like that in a talk a while back
Mike J Innes
@MikeInnes
Ok, must be worth a try then
Mike J Innes
@MikeInnes
An even better might be to "hash" each variable in some way, mod n
Mike J Innes
@MikeInnes
Just pushed this feature – any thoughts? I have to say, I like it a lot personally
@Varanas I've included the css color generator, feel free to play around with it for June Dark
Mike J Innes
@MikeInnes
(value = 1 and saturation = 0.5 works well for me)
Sebastian Pfitzner
@pfitzseb
my thoughts: a decisive hmm...
I'm not quite sure I like it... it seems to be very cluttered, although I can understand why it could be very beneficial to have that form of highlighting
Sebastian Pfitzner
@pfitzseb
should you want to go this way: It might be very beneficial to readability and create a more distinctive look if the distance in colorspace would depend on the number of used variables/functions.
furthermore, variables internal to functions could be treated as seperate which would cut down on the total number of colors needed (everything that is input or output to a function will be in global "colorspace").
Sebastian Pfitzner
@pfitzseb
Of course, implementing that would require the parser to have a pretty deep understanding of the language itself and I'm not sure if it's feasible at all. Although that kind of distinction in scope is internal to Julia, if I'm not mistaken.
Sebastian Pfitzner
@pfitzseb
To elaborate on my first reply: Syntax highlighting (at least for me) is about structuring code. That structuring does happen (in a way) with conventional highlighting, but the main difference there is between data and functions. I agree with the article you cited above in that it would be more beneficial to be able to follow the usage of certain variables throughout a document (and to a lesser extent the usage of a function) simply by having a look at the color, but for that to work the colors would have to be distinct enough to be seperable on the first glance.
Sebastian Pfitzner
@pfitzseb
Uh, sorry for the wall of text without any concrete suggestions... Here are two:
  1. Give functions not defined in the current document a second class that makes them bold.
  2. Change the scheme of assigning a color to a certain hash, so that two hashs always have the biggest possible distance to each other (without changing any previously assigned colors). For example, the first variable gets assigned variable-1, the second variable-100, then variable-50, -25, -75 and so on. Of course those colors aren't the same in different documents and there are probably additional issues, but it's all I could come up with for now.
Sebastian Pfitzner
@pfitzseb
and an example I found (the scope coloring is pretty interesting too): https://github.com/daniellmb/JavaScript-Scope-Context-Coloring
Mike J Innes
@MikeInnes
Thanks for the feedback! It's always useful to have input from people with different tastes.
Mike J Innes
@MikeInnes

I really like a lot of these ideas, but it's really a question of feasibility – at least in the short term, it's probably best to have either a very basic version of this or none at all, rather than spending weeks on something that may not work well.

I think the best thing will be to split out this functionality into a separate plugin. It should be easy to switch on and off, so that themes (including custom ones like yours) work just as well with or without it. I realise that at the moment I've stopped you from having different styles for function calls, so that will be fixed when I do this.

It's definitely a challenge to strike the balance between having distinct colours and not making the editor look like a pile of skittles, but hopefully with enough tweaking I can get something decent going. Unfortunately I don't have nearly enough time to actually do work using the editor at the moment.

Sebastian Pfitzner
@pfitzseb

I agree that most changes would definitely need a lot of time to tweak and get just right, but the two I proposed should be relatively straightforward to implement (unfortunately I don't have all that much time rght now, but I'll take a look at your js and see if I can figure out what you're doing). The second one should also address the probem with conventional styles not working, since any function call would have two classes: The one from the definition of said class and another one that marks them as a function. If the first one doesn't provide any information regarding color than the "conventional fallback" can kick in and deliver the same look as before your changes.

A plugin for LT called match-highlighter provides a nice way to visualize any occurences of an variable (much like Matlab), so that definitely helps. Actually, it highlights anything that's called the same as the word the cursor is over - that could/should probably be tweaked to only apply...

Mike J Innes
@MikeInnes

Cool, it would be great if you could have a look at doing this – here's a couple of notes:

  1. CodeMirror modes can't look forward through the source code, but with a separate plugin it should be easy to extract all .cm-def (function definition) and .cm-variable-2 (function call) nodes from outputted DOM and apply additional CSS classes as appropriate. (Like I said, I like this idea so I'll probably have a go at it if you don't – but I don't know anything about writing CodeMirror addons yet.)
  2. CodeMirror modes also can't apply multiple styles to a token, which is my main reason for wanting to write the rainbow-vars plugin separately.

match-highlighter is neat – I might have it enabled by default if it plays well with unicode.

Sebastian Pfitzner
@pfitzseb

re 2: The CodeMirror manual (see http://codemirror.net/doc/manual.html , Writing CodeMirror Modes) says it is possible.

Regarding unicode: Ah, well... Nope, match-highlighter can't deal with it - but neither can your implementation of the parser. So right now it doesn't matter ;)

Mike J Innes
@MikeInnes

Woops, you're right – well spotted! Well, it'd still be nice to have a rainbow-vars plugin at some point, but that does solve some issues.

I was actually wondering if match-highlighter uses the DOM to find tokens – if it does then it will support unicode once the parser does with no extra effort, which would be nice

Mike J Innes
@MikeInnes
Ok, I got rid of the rainbow vars in the light theme, that wasn't working – but I had a go at a more pastel-y/zenburnesque dark theme which I think works quite nicely with it.
Sebastian Pfitzner
@pfitzseb

Just one random thought I had while staring at some code:
Wouldn't it be pretty cool if some plugin not only highlights the exact same variable but also any it is assigned to? So you'd have something like a common thread running through your code, branching when necessary? I think it's pretty important to be able to immediatly see data flow...

Although that should probably be a mode in addition to conventional syntax highlighting... But still, I somehow like it. Thoughts?

Sebastian Pfitzner
@pfitzseb
While playing a bit with your css I noticed that it doesn't look half bad if function calls are a bit transparent and bold (e.g. .cm-s-june-night span.cm-variable-2 {color: #ffc; font-weight: bold; opacity: .55;}).
And btw, thanks for fixing that backwards-compatibility-thing!
Mike J Innes
@MikeInnes

Some kind of data-flow-based highlighting is an interesting idea – you could take x = f(y, z) and colour x as a mix of y and z's colours, too. It would be fairly hard to do well, I think, but it would definitely be worth a shot.

Reducing the opacity is a nice way to distinguish functions from variables without making them really pop out – I'll play around with it a bit. For the record, I do think that bold functions work nicely with your theme. Oh, and no problem!

Mike J Innes
@MikeInnes
Backtraces should be much nicer now, let me know if there's any problems with the new code. Also, the highlighter now supports splicing ($(...)), which I think is pretty neat :)
Sebastian Pfitzner
@pfitzseb

About the data-flow-highlighting: While it does sound pretty neat in theory, I'm not at all sure if it can be implemented in any reasonable fashion. Might have to look into that... I think I'll just throw together a sketch for something a bit more feasible (hopefully).

About backtraces: Sadly, there still are some cases where it's not terribly helpful yet. One case that is pretty annoying for my style of development:
There's a function defined in some file and I try to call it within that same file. But if I've made a mistake in the function definition the line numbers displayed in the error message is about the representation of that function in init.jl and the line numbers displayed aren't the ones I would want to see.

Sebastian Pfitzner
@pfitzseb
codesketch.jpg
What I had in mind was something similar to the picture above. Whenever your cursor is above some variable (and/or some key is pressed), that variable and it's "first-order-children" (or whatever those might be called) are highlighted while the rest of the code is a bit dimmed. Otherwise it looks just like the version to the left.
That seems to be a compromise between rainbow vars and conventional highlighting - which of course doesn't have to be a good thing ;).
Mike J Innes
@MikeInnes

I like that idea for highlighting matching variables. It'd probably be fairly straightforward to prototype something like that if you're interested in having a go.

Could you give me an example of the kind of backtraces you're getting? That's exactly what I had tried to fix, on my system backtraces are very to-the-point. Are you sure you have the latest Jewel.jl code (the fix isn't in a released version yet)?

Sebastian Pfitzner
@pfitzseb
Ugh, stupid me... Works like a charm! No I finally don't have to debug in the REPL because I won't get proper backtraces in LT. Thanks!
Mike J Innes
@MikeInnes
Great!
Mike J Innes
@MikeInnes
Just so everyone knows – I'm going to change Jewel's URL to one-more-minute/Jewel-LT. gitter.im doesn't handle renames AFAIK so there won't be a redirect, but the URL of the chat room will change accordingly.
Mike J Innes
@MikeInnes
0.5.0 released yesterday, with much better highlighting/indentation support, new commands to interrupt and and kill the Julia process and improved error messages
Ethan Sherbondy
@sherbondy
Loving the project so far. Is there a means for the inline evaluator to run relative to the path of the file being evaluated rather than the LightTable directory? e.g. run(pwd) yields /Applications/LightTable.app/Contents/Resources/app.nw. Is the expectation to launch a terminal client instead?
Mike J Innes
@MikeInnes
Sure, you can change the working directory at any time with cd – in your case you probably want to put cd(dirname(@__FILE__)) at the top of the file and evaluate it before anything else. You can also add a cd call to ~/juliarc.jl to have it run every time Julia is booted.
Oh, and thanks!
Mike J Innes
@MikeInnes
(also, just in case you don't know, include statements will always work relative to the path of the file they are called from whether you cd or not)
Mike J Innes
@MikeInnes
If anyone on master is using the #jewel module ... directives, they're no longer necessary – you should see the current module come up automatically in the status bar
Sebastian Pfitzner
@pfitzseb
Hey, I just had a look at this after some time - the changes and added functionality are very impressive! Just one minor nitpick: I think it'd be more consistent if any css changes were to be done by June and not by Jewel itself. Except for that fancy error background (.CodeMirror-linebackground.error) that isn't implemented anywhere else.
Mike J Innes
@MikeInnes
Thanks!
Unfortunately a couple of patches are currently necessary (at least until I get some PRs merged into LT) and it'll always be good to have some defaults for things like data frames. (Although I notice there's a font change there that really shouldn't be.) I'm going to do a lot more work on graphical output and CSS so I'll start making sure things are a bit more organised then.
Ismael Venegas Castelló
@Ismael-VC
Hello! I'm using Arch Linux and I just instaled julia from the repos, then Pkg.add("Jewel"), finally I install the Jupiter plugin in Light Table, but I get this error: http://bit.ly/UXFvG8
I mean I get that error when I try to evaluate some Julia code with ctrl+enter.
Ismael Venegas Castelló
@Ismael-VC
Julia Version 0.3.0-prerelease+2954
Commit 3985890 (2014-05-08 04:14 UTC)
Mike J Innes
@MikeInnes
Look like gotos were only added to Julia recently, so the slightly older version you've got doesn't have them. I'd better fix that so it doesn't cause problems.
Sebastian Pfitzner
@pfitzseb
I ran into that problem too, but with the latest prerelease it works flawlessly. Not sure if you really need to do something about it...
Ismael Venegas Castelló
@Ismael-VC
ok I will compile julia insted of using the one provided by the Arch repos and test again then, thanks!
Mike J Innes
@MikeInnes
@Ismael-VC Great, let me know if you have any other issues!