73

I watched a video from YUIConf 2012 in which Douglas Crockford gives a talk about implementing monads in JavaScript. In this talk he gives a code example that utilizes what he calls "Context Coloring" which throws out the idea of coloring by language syntax and introduces different colors for different levels of scope. Here is the link to that specific part of the video.

http://www.youtube.com/watch?feature=player_embedded&v=dkZFtimgAcM#t=15m58s

Is this context coloring scheme implemented by any code editor for JavaScript or any language?

I use Sublime Text and this editor like every other code editor I have come across allows color to be applied to syntax. Im not sure if a plugin could solve this problem or if an editor would have to be designed from the ground up to allow this context coloring scheme.

4

6 に答える 6

25

I just watched his video on that, great stuff. Had to give it a try, or checkout the project on GitHub https://github.com/daniellmb/JavaScript-Scope-Context-Coloring.

JavaScript Scope Context Coloring

于 2013-04-06T00:31:52.510 に答える
11

Vim (GitHub):

enter image description here

Emacs (GitHub):

Screenshot of context coloring in Emacs.

于 2014-02-13T06:35:14.733 に答える
9

As of Feb-13th 2013 Crockford has added an experimental context coloring feature to JSLint.

https://plus.google.com/118095276221607585885/posts/FzKnHk96m2C

于 2013-03-15T14:16:14.623 に答える
8

There's a package for sublime now: https://github.com/mazurov/sublime-levels

It also has an online live demo at http://mazurov.github.io/eslevels-demo/

于 2013-07-13T16:51:39.160 に答える
3

BlueJにはそれがあります(1)-しかし、そうでない場合もあります。javascriptのスコープのコンテキストカラーリングは、このエディタが機能するjavaなどの他の言語よりも確かに複雑になります。

ブラケットを書いている人々は、彼らがクロックフォードを崇拝しているので、おそらく最終的にそれをするでしょう(2,3)

彼らと一緒にそれを書くのを手伝ったり、少なくとも彼らに言ってみませんか?

出典:

1)http://blogs.kent.ac.uk/mik/2010/05/bluej-3-0-whats-new/

2)https://github.com/adobe/brackets/issues/search?q=Crockford

3)http://www.adobe.com/devnet/html5/articles/bracket-code-architecture.html

于 2013-01-18T17:16:08.867 に答える
-1

Not that I know of. This would be great, but it would need a lexical analyzer specific to JavaScript and it would probably not work when there are any syntax errors.

于 2012-12-19T08:38:53.110 に答える