Community
Participate
Working Groups
Currently the syntax highlighter is tied to setup.js. It is hard for the compare editor to use it. We should move the syntax highlighter to a common place. We also need a better way to understand the file type. We can't assume we can always tell file type by extension. E.g. : RTC has special fileURI, where the file extension is not there. But their server can tell file type.
Bug 370126 may also require this. One more thing not sure : If there are 1000 lines in the file but I only use 5 lines, will the syntax highlight work ?
(In reply to comment #1) > Bug 370126 may also require this. > One more thing not sure : > If there are 1000 lines in the file but I only use 5 lines, will the syntax > highlight work ? In the general case, no -- you won't get a correct result with just a snippet of the file. But it might be good enough for a preview.
I moved the 'syntaxHighlighter' object that was declared in setup.js (and copied in a few other places) into its own class. That class is shared between setup, search, and compare-container. This should allow the latter 2 places to automatically pick up additional language grammars that are plugged in or new content types that are registered. At the moment it's very simple: it picks an appropriate styler for a content type, taking into account registered highlight provider services. (Note however, that you can't currently use the orion-codemirror plugin to style anything but the file editor on the coding page, see bug 370286.) [1] http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=6bcb13d0739b534c47f4f77104b268afc90bfa4e [2] http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=cabea058a81517f5b111acf53adeac47528d1016