113 Commits

Author SHA1 Message Date
David Ostrovsky
92ca421222 Codemirror: Add vhdl mode
Verilog mode was always supported by Codemirror, but support for VHDL
was only added in recent Codemirror version, so that we can only
include it now.

Bug: Issue 3447
Change-Id: I91028acf3f41f51981f710db00bee9a8c9398aee
2015-10-15 17:22:27 +02:00
Edwin Kempin
0d609b839f Merge "Upgrade Codemirror to version 5.6" 2015-10-07 10:42:24 +00:00
David Ostrovsky
3cd7a19ea0 InlineEdit: Allow to activate auto-close brackets Codemirror addon
Codemirror closebrackets.js addons defines an option `autoCloseBrackets`
that will auto-close brackets and quotes when typed. By default, it will
auto-close ()[]{}''"".

Change-Id: I844d49c7d60d8fc78808df566e4c4f9aff1b012e
2015-09-14 07:30:22 +02:00
David Ostrovsky
c232840a1a InlineEdit: Allow to activate match brackets Codemirror addon
Codemirror matchbrackets.js addon defines an option `matchBrackets`
which, when set to true, causes matching brackets to be highlighted
whenever the cursor is next to them. Set default to be true.

Change-Id: I8d107a70af484562f5938fe41245f0603b820492
2015-09-14 07:30:22 +02:00
David Ostrovsky
c4e01806ff InlineEdit: Support Emacs and Vim key maps
Change-Id: I980afc3848f267811ab5890f9447fba16beed5d4
2015-09-14 07:30:22 +02:00
David Pursehouse
76492c0325 Upgrade Codemirror to version 5.6
Includes the fix for syntax highlighting of raw string
literals in go.

Bug: Issue 3499
Change-Id: Ibbce189245a3109f107aa2946b4d23bf0b97986f
2015-09-14 10:37:08 +09:00
Shawn Pearce
887a502256 Update CodeMirror to 5.5.0
Change-Id: Ie6894682557c6b153c858f165f3581d2b5b80c9c
2015-07-24 18:02:09 -07:00
David Ostrovsky
ba1197390d Bump Codemirror version to 5.3
New Codemirror version fixed number of bugs and implemented
improvements to existing modes: [1].

[1] http://codemirror.net/doc/releases.html

Change-Id: I15b3e17b256526cb2c7f088f30b83143df5b4978
2015-05-27 08:00:06 +02:00
Khai Do
626201c697 Add syntax highlighting support for puppet
This change will let Gerrit do proper syntax highlighting on
puppet files since CodeMirror supports puppet [1].

[1] http://codemirror.net/mode/puppet/index.html

Feature: issue 3293
Change-Id: Ib9bb66ee4cc656a7911672d62a4bde0e458a3f80
2015-04-14 08:53:15 -07:00
David Pursehouse
7ab104782d Update CodeMirror to 5.0 and consume from Maven Central
Change-Id: Iac85d62a70b6d831909c0b7fd73f6bb3b2e0a2da
2015-03-19 18:46:01 +09:00
David Pursehouse
f326c904ff Add support to consume CodeMirror from org.webjars on Maven Central
CodeMirror is available as a JAR file on Maven Central under the
org.webjars group ID.

Add support in the download wrapper to consume CodeMirror from this
location and extract from the JAR file rather than a ZIP file.

The support to download as a ZIP file from the Gerrit bucket is kept
for backward compatibility in case we want to use our own build of
the library at any point in the future.

Change-Id: Ie21b72b57fe1a90894c4aadd7ef4bdc91d055cd5
2015-03-04 14:56:10 +09:00
Dan Albert
3a19184672 Enable syntax highlighting for Go.
Interestingly enough there was already an entry for go in
mime-types.properties.

Change-Id: Ibf4742cbab1e18370a88616fd857eb133405b4f6
Signed-off-by: Dan Albert <danalbert@google.com>
2015-02-03 18:13:39 -08:00
David Ostrovsky
eb430c447c Buck: Cleanup dependencies in CM integration code
Since [1] Buck implicitly adds :foo and :bar in $(exe :foo) and
$(location :bar) macros to the dependency list of genrule(). The
code base was adjusted to reflect this enhancement in Ie3a9de0b2.
In I996b8d2a1 the unneeded dependencies were partially re-added
in CM integration code.

Re-remove it again.

[1] https://github.com/facebook/buck/issues/128
Change-Id: I8d0aaa5c9f7586f04f169f8362709b1fc7b04dcc
2015-01-05 11:06:49 -08:00
Shawn Pearce
57c239c0ea SideBySide2: Highlight search results on scrollbar
With an updated CodeMirror search results from vim mode are marked in
the vertical scrollbar with gold colored annotations.

Change-Id: Ibac2a32987201f077eecc99ac1ac9407ebe61d89
2015-01-05 10:39:47 -08:00
Shawn Pearce
a2346d1f0a Dynamically load CodeMirror themes
Most users run with the default theme, which does not require any
additional CSS. The total set of themes costs 7.3 KiB of download
when added into the default CSS file.

Split the themes into their own files and only load the theme when
it is required by the browser.

Change-Id: I48f274347e1ca94895c0756fa17479661c78fd57
2015-01-05 10:38:15 -08:00
Shawn Pearce
3a52cede92 Simplify CodeMirror build by splitting out addons
The addon list is very repetitive with 'addon/' at the start of each
name.  Split these out into their own list of files and append them
after the other JavaScript in the build rule.

As GWT manages the CodeMirror CSS and JS resources with strong names
the internal names "cm4.{js,css}" only exist between the Buck build
system and the GWT compiler. Drop the major version number, as it
provides no value and complicates upgrades.

Change-Id: Ie0def2fee3a2109a2da21af6b3ce7495006c239e
2015-01-05 09:14:33 -08:00
Shawn Pearce
60a77b0562 Use CodeMirror meta.js to describe modes
Instead of writing out the mode_map table by hand, compile and include
meta.js from the CodeMirror distribution.  This script lists all modes
in simple JavaScript objects.

An advantage of this format is the name property is human readable,
and does not require munging MIME type strings.  Adding new modes now
changes only 2 files in the client (Modes and ModeInfo).

Change-Id: Ifa0c7af77681f72b8210fca83a7af6a9ef1c6541
2014-12-31 13:56:12 -05:00
Shawn Pearce
3c9816c3cc Switch to CodeMirror simplescrollbars addon
Instead of implementing the scrollbar inside of Gerrit, use the
simplescrollbars addon available with CodeMirror 4.9. The addon has
handlers for scroll wheel support and other basic browser behavior
that was broken or missing in Gerrit's own scrollbar replacement.

Markers in the overview bar can now be simpler widgets that track the
vertical scale ratio of the CM3 instance and position accordingly.

Change-Id: Ib117668ee0f85955d1e47034e32676bc9796d0d2
2014-12-29 21:25:29 -05:00
Shawn Pearce
6176f00f0a Parallelize JavaScript minify of CodeMirror modes
Allow Buck to run minify for each mode independently of the
main CodeMirror JS. This cuts the build time roughly in half
as the modes minify concurrently with the main lib/cm.js.

Add the LICENSE file header to each mode. The MIT license
that covers the standard modes requires end-user redistribution
to include the notice along with the code.

Simplify the definition of modes by just naming the directory.
CodeMirror has a convention that the JavaScript is inside of
a same named JS file. This cleans up both the cm.defs file
and the Modes.java listing of every mode supported by Gerrit.

Fix dependencies for genrules used during the CodeMirror build.
A genrule must use deps to name each $(location) rule used within
the cmd string.

Change-Id: I996b8d2a1da8fe1b023c71c4a86bdcd4443c8c03
2014-12-29 21:25:29 -05:00
Shawn Pearce
18c5483ac8 Syntax highlighting: Dockerfile, Dart, Soy
These modes are now supported by CodeMirror 4.9.
Dockfiler requires the mode/simple addon.

Change-Id: I42e546449e524a2de4fe70ac764fb5837f720f46
2014-12-29 21:25:03 -05:00
David Ostrovsky
498edaf1d2 Syntax highlighting: reStructuredText (rst)
rst mode depends on stex mode and makes use of overlay.

[1] works nicely on CM3 4.9 version [2], so [3] is fixed now.

Bug: issue 2779
[1] https://ceres-solver-review.googlesource.com/#/c/5683/18/docs/source/faqs.rst
[2] http://imgur.com/y8QEylt
[3] https://github.com/codemirror/CodeMirror/issues/2850
Change-Id: I03f134aadbb8c2c3c2a8d3dc027d2b7f234cd176
2014-12-29 19:58:24 -05:00
Shawn Pearce
ddecf8fe2c Update CodeMirror to 4.10
The beforeChange event API has been completely changed from 3.x.  It
now receives an object with an array of ranges.  The last range is the
"primary" range that most selection methods will default to.

Cursor position CSS was updated in CM 4.x and needs to be adapted to
keep the prior behavior of an underline for current cursor with no
blinking box on selected text.

CM3 related constants in the build system were renamed to CM_ prefix
to avoid needing to rename them again when CodeMirror updates to 5.x.

JavaScript and CSS output were updated to be cm4.{css,js}.  Keep the
major version number in the file names clarifying the content being
loaded into the browser.

Change-Id: I49c70f7155f96c63c94521eeb1d676b4429d6962
2014-12-29 19:50:04 -05:00
David Ostrovsky
5b160c5f1a Consume closure compiler binary from Maven Central
With the fix of [1] we can remove the hack and integrate closure
compiler toolchain the right way.

[1] https://github.com/google/closure-compiler/issues/450

Change-Id: Iec3b0f0833d2898821f20a06c2dad4d2d7d8557c
2014-12-17 00:38:08 +00:00
David Ostrovsky
7fc13dca82 Buck: upgrade to recent version
This version fixes a critical bug [1] that prevents us from simplifying
bucklets intergration. In this version, Buck only allows defining new
rule functions in files included with include_defs, not actually
instantiating rules, so we need to reshuffle some rules.

After this commit [2] "$(macro ...)" syntax is preserved for buck
macros, we need to use a backslash to send commands directly to the
shell: "\$(macro ...)". It turns out this doesn't work yet, shell
backticks seem to work though [3].

[1] https://github.com/facebook/buck/issues/182
[2] d6f3252170
[3] https://github.com/facebook/buck/issues/212

Change-Id: Ie99757bafc626d4ac2c5a75a2983d91b0c4f6d24
2014-10-27 20:13:42 +00:00
David Pursehouse
5047e6ef90 Merge "Update to latest version of CM3" 2014-10-21 06:31:09 +00:00
Dave Borowitz
b42cb8d7db Temporarily disable Go syntax highlighting
Unlike I0b4032d4, this bug is not reproducible by pasting the offending
contents into a plain HTML page; it appears to be an issue with our
diff context folding.

Change-Id: I64cd1793c46a3668ee8c67a37b0e09c7ede34c2c
2014-10-09 20:39:02 +00:00
Dave Borowitz
7f51d251ce Revert "CM3: Add reStructuredText mode"
Causing rendering failures in some cases. Filed a bug upstream:

https://github.com/codemirror/CodeMirror/issues/2850

Change-Id: I0b4032d41b1fe5b9756ff59f752f5fce86634c41
2014-10-09 20:04:02 +00:00
Dave Borowitz
46b1c4f6d8 Update to latest version of CM3
Change-Id: Ib493e00181b4f16c64940dbc5f84a204f8b9e6f7
2014-10-09 18:36:55 +00:00
David Ostrovsky
095d7f86a1 CM3: Add reStructuredText mode
Rst mode depends on stex mode and makes use of overlay.

Bug: Issue 2779
Change-Id: Idf745f50459b3d058d9a84496e43745c64ddfe5d
2014-07-18 01:36:52 +00:00
David Ostrovsky
0369183e92 Buck: Set up Closure Compiler tool chain to minify JavaScript code
Extend the build tool chain to minify JavaScript from CodeMirror
distribution.

Currently SIMPLE_OPTIMIZATIONS mode is used, as ADVANCED_OPTIMIZATIONS
doesn't seem to work.  But even with simple mode the minification factor
is:

393441:cm3-verbose.js
167971:cm3_minified.js

And even more for language modes:

56029:perl-verbose.js
10122:perl-minified.js

Disadvantage: Longer compilation time. In follow-up changes we may want
to optimize it by disabling JS minification in development build.

Change-Id: I24790e84484add4f02b3821cca4b69e62fde0c22
2014-06-16 13:56:15 +00:00
David Ostrovsky
95df52979c Buck: Fix lib/codemirror:jar rule by making it repeatable
Replace "mv" with "cp" in //lib/codemirror:jar target. Usage of "mv" is
wrong here, while it makes the rule not repeatable: when the rule is
changed and thus must be reevaluated, it cannot: css and js were moved
and cannot be accessed any more.

Note: That is expected that after applying this change the build of jar
is failing:

  $ buck build lib/codemirror:jar
  cp: cannot stat <path to /buck-out/gen/lib/codemirror/cm3.css>:
  No such file or directory

That's the bug this change is fixing.  To recover wipe out the Buck output
directory:

  rm -rf buck-out

Change-Id: I1bfc5bb10eaa52332043914641a72510c8e539c5
2014-06-11 10:50:23 +02:00
David Ostrovsky
5dacc8bcc2 Buck: Make deps to $(exe :foo) and $(location :bar) implicitly
Apply [1] on our Buck tree.

[1] https://github.com/facebook/buck/issues/128

Change-Id: Ie3a9de0b2ee3725170bcbd06df059ea5d9ae5252
2014-06-10 07:29:42 +00:00
David Ostrovsky
d8af092c0a Buck: Remove usage of genfile()
genfile() is considered to be deprecated and is going to be discontinued
in future Buck releases [1].

[1] https://groups.google.com/forum/#!topic/buck-build/Ci8Y95USD8I

Change-Id: I7a5a1ee99d1448c412bb51b793c1e874dd3c62f4
2014-06-10 07:14:18 +00:00
Shawn Pearce
5478148f6f SideBySide2: Add syntax highlighting for 18 more languages
Include more languages into the CM3 mapping supported by Gerrit:

* coffeescript
* d
* diff
* dtd
* erlang
* gas
* gfm (GitHub Flavored Markdown)
* haskell
* lua
* markdown
* php
* pig
* r
* scheme
* smalltalk
* tcl
* verilog
* yaml

Change-Id: Ie3cc3657183a475fb71a71e0fe35be848deb985f
2014-04-30 19:31:37 +00:00
David Ostrovsky
3f3e9ad20c Remove unnecessary reference to $SRCDIR in Buck genrules
In new buck version `$SRCDIR` is not necessary any more.  Buck now
always runs genrule relative to the $SRCDIR link forest.

Change-Id: Iee88bb575c7baa62bc087527927be5347a7f8f95
2014-03-26 18:20:13 -07:00
David Ostrovsky
51b373679e CM3: Add support for dark themes
84a66d82d36d554c1844acff11d1a62f10c174ed added support for light and
dark themes, but dark themes weren't enabled, as diff styles have
to be adjusted to correspond with dark colors.

101a8c4b65ebee4d54afddad10db05f5b9698ba9 reverted the preparation
for dark themes support.

This change enables support for subset of dark themes and switch
dynamicaly the diff styles to dark colors, when dark theme was
selected.

Change-Id: Ic220baf8f19366c04520b61e893a0d11912805ef
2014-03-04 19:51:49 +01:00
Shawn Pearce
101a8c4b65 Only pack CM3 themes selectable by the user
This avoids packing too many CSS rules, which bloats the download
to the browser and may slow down rendering while the browser picks
matching CSS classes.

Change-Id: I8888bc9daa9693ff2598ccfe29d150fa3fac0916
2014-01-21 15:07:10 -08:00
David Ostrovsky
84a66d82d3 SideBySide2: Add preference for a subset of supported CM3 themes
Add support for CM3 themes. CM3 has built in support for themes.
Unfortunately we can not use all of them out of the box, because
we set statically background colors on diff styles.  However we
can use light themes. Especially "eclipse" theme looks very sexy
for Java developers that use this IDE and are acquainted with its
look and feel.

Integrate all supported themes in Buck tool chain, so that we are
prepared to extend the support for dark themes. To do that we must
dynamically assign background colors for different diff styles per
theme.

Change-Id: Ic97c237d789dc4daeff6b8bb4f7606da83f5d532
2014-01-21 14:36:20 -08:00
David Ostrovsky
59da23e4ca Codemirror: Add support for Groovy mode
Change-Id: I7654e4c9911a3c6da9023155440445a4e777516b
2014-01-16 21:34:34 +01:00
David Ostrovsky
893b5b13b7 Codemirror: Add support for Clojure mode
Change-Id: Ie814a7f7b5a97554617889b439f02aec065b8189
2014-01-16 21:34:34 +01:00
David Ostrovsky
d225f608a8 Codemirror: Add support for Lisp mode
Change-Id: I653b8a385029bd89516206ac67e022915d5713c1
2014-01-16 21:34:34 +01:00
David Ostrovsky
1f9e50cdb7 Codemirror: Add support for ruby mode
Change-Id: I0077bf99ec9960beb6d40911b65ee92af523b093
2014-01-16 21:34:34 +01:00
David Ostrovsky
22fa35d6cf Codemirror: Add support for perl mode
Bug: issue 2398
Change-Id: Ie7c2b4583a71ad9646ef745df156bcb31ae1f9a4
2014-01-16 21:34:32 +01:00
Shawn Pearce
3f7e5a3892 Update CodeMirror3
Upstream fixed an issue with line numbers
disappearing after a skip bar.

Change-Id: Ia7765f6956d7fc85d83b94fb6ec14a9d3ea4e42b
(cherry picked from commit 4bbf8b01672a7d1dddb34b3af535d4c4c7805523)
2013-11-25 22:45:18 +00:00
Shawn Pearce
30ea943624 Update CodeMirror3
- Fixes hiding of the first line
- Fixes random moving of line number gutters

Change-Id: Iae501b7b85798fe3e164467d1b6ffb55e85bdddf
2013-11-15 09:52:01 -08:00
Shawn Pearce
1e035cf005 Update CodeMirror
Change-Id: I28a4c8851157e3e9640ae9898ea89c5146ce59d2
2013-09-02 12:10:33 -07:00
Shawn Pearce
050d3d5eaf Update CodeMirror
Change-Id: I804fd6c7454320524e80d1d4be61108da4d1c654
2013-08-22 14:29:40 -07:00
Shawn Pearce
0d0405a04a Update CodeMirror to latest upstream version
Change-Id: I88b67b79373db90ff70ff83078746764da41b387
2013-07-29 11:36:21 -07:00
Shawn Pearce
4f85736d88 Combine all required CodeMirror3 CSS and JS at build time
Instead of loading a list of script elements at runtime combine
required script fragments together at build time into one file.

This cleans up the Loader class and allows the browser to perform a
single HTTP GET to download the JavaScript code at runtime.

Include CodeMirror3's license text as part of the CSS and JavaScript
that is downloaded by browsers.

Change-Id: I0cd2b5924da1eda9b9445e6a64752ff59f21b64b
2013-07-27 18:42:45 +00:00
Shawn Pearce
11d27c8ee8 Update Buck
Latest version of buck is faster than the prior version used by
Gerrit.  No-op updates when loading a debug version of the UI now take
only 1.804s on my laptop (previously 7s) and a draft UI compile is
only 24.659s (previously 39s).

The slow acceptance tests must now be excluded with `--exclude slow`.
Buck changed the meaning of the -e option to be --emulator, which is
unfortunately useful only for Android application developers.

genrule() now needs to use $(exe) to reference the binary to run,
offers $(location) to make it easier to find files in the build tree.

The empty srcs array is no longer required for genrule().  Buck has
determined it is sufficiently powerful with $(location) and deps that
requiring srcs is unnecessary.

Supporting .src.zip files in the srcs array of java_library() means
Gerrit no longer needs to run a separate genrule() to extract files
produced by ANTLR, or call javac inside of the BuckPrologCompiler
support glue.

Change-Id: Ib03042921a081b867a7aad0423bd45523e42917a
2013-07-26 18:11:51 -07:00