113 Commits

Author SHA1 Message Date
Paladox none
d1dab17ce4 Update codemirror to 5.25.0
See release notes at https://codemirror.net/doc/releases.html

Change-Id: Ia55811afecc9bc6c2fcf0a0edaa9a35b05152ae4
2017-03-22 21:44:40 +00:00
David Pursehouse
9561f38f14 Format BUILD and WORKSPACE files with buildifier
Formatted with buildifier version 0.4.3 installed via homebrew
on OSX.

Change-Id: Iab54e118a5d119b5c031838c267b848b8ead30f2
2017-02-28 17:32:44 +09:00
Paladox none
33d4eafec0 Update CodeMirror to 5.24.2
Change-Id: I9e86bdb59b5f9295bc1ff50e04174856e5b00444
2017-02-22 23:24:18 +00:00
David Ostrovsky
fdbfcad77d Remove Buck based build
Bug: Issue 5302
Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
2017-01-23 12:44:58 +00:00
Paladox
1e55a382d6 Update codemirror to 5.22.0
Highlights include:
 - New themes duotone-light and duotone-dark
 - Various small fixes to language modes

Change-Id: I632cc2dd3815767293ea9638b0551f7a98f330b2
2016-12-22 23:40:25 -04:00
Han-Wen Nienhuys
42ea853037 bazel: remove code to sniff license field in bower.json.
Instead, use a hard-coded map of licenses.

Hardcode a false dependency on diff-match-patch to avoid a diff for
the Apache2.0 license.

Tested:
  bazel build Documentation:js_licenses.txt
  buck build Documentation:js_licenses.txt
  diff -u  buck-out/gen/Documentation/js_licenses.txt/js_licenses.txt \
    bazel-genfiles/Documentation/js_licenses.txt
 diff shows only diffs for added [[header]] anchors.

Change-Id: I7886e1fadec900cf854a1b3b7c538b83d66af7a4
2016-12-20 15:44:52 +01:00
Dave Borowitz
8cadb33267 Improve documentation of diff-match-patch build
Output the actual jar path used for the build in the generated JS
file, rather than a broken Google Code link. This requires extracting
a constant for the version string.

Rename the addon_merge target to indicate that it includes bundled
dependency code from diff-match-patch, which fact is not otherwise
obvious.

Change-Id: I6512e5d65b81802d917f718f8e62ac414e8bffda
2016-12-19 16:51:56 -05:00
Han-Wen Nienhuys
238c6e9763 Add license for diff-match-patch JS.
Fix dependencies for codemirror targets.

Change-Id: Ibda5573438b0ab76c42f5faaa3a463b5975bd43c
2016-12-19 11:53:43 +01:00
David Pursehouse
2d08500516 Format .bzl files with Bazel Buildifier
Change-Id: I3ab30565e5ac110a18cbe3d34f76307801c30373
2016-12-11 19:00:21 +09:00
David Ostrovsky
fa18907d7f Bazel: Reformat build files
Reformat the Bazel build files with the buildifier tool [1].

The style is different for Bazel files. Most notably, indentation level
is 4 spaces instead of 2, and " is used instead of '.

[1] https://github.com/bazelbuild/buildifier

Change-Id: I95c0c6f11b6d76572797853b4ebb5cee5ebd3c98
2016-12-07 11:33:07 +00:00
David Ostrovsky
76eac6f3fc Bazel: Fix build
Iaab184501 renamed out to outs in genrule2, but missed to replace some
places.

Change-Id: I3e9673b95ab7e6ff8cd0feab42d5c7569297be54
2016-11-03 08:06:21 +01:00
Han-Wen Nienhuys
29cced5e29 bazel: remove 'out' attribute from genrule2, and use throughout.
This centralizes the OSX mktemp solution.

Change-Id: Iaab18450146b649245b36865bedc5d7b50d1aa07
2016-11-02 13:54:10 +01:00
Han-Wen Nienhuys
c9be186e0a bazel: Fix codemirror license name.
Change-Id: Ice7ab6e946cf70f44dcf513c1598a495307f42aa
2016-09-28 17:32:09 +02:00
David Pursehouse
7c1d6f6f35 Merge "Update CodeMirror to 5.19.0" 2016-09-27 01:38:48 +00:00
Yuxuan 'fishy' Wang
75b98f77d9 bazel: add license to appropriate lib/ targets
This is to prepare for implementing genlicenses rule in bazel.

Change-Id: I60d79d5b53f9dd05c9f9ebfe6e6f658604c5a037
2016-09-26 16:42:38 +08:00
Michael Zhou
0284c79052 Update CodeMirror to 5.19.0
Highlights include:
  - javascript mode: Better indentation when semicolons are missing.
    Better support for TypeScript classes, optional parameters, and the
    type keyword.

Change-Id: I7a46c8dc058278ce484dacfa870050ed4c04f2eb
2016-09-26 03:20:20 -04:00
David Ostrovsky
868b68dd6c Implement Bazel build for codemirror library
This is more or less straightforward migration of Buck codemirror
packaging rules: "jar" with non-minified JS version and "jar_r"
with minified JS version.

TEST PLAN:

  bazel build //lib/codemirror:codemirror
  bazel build //lib/codemirror:codemirror_r

Change-Id: I68a22902b5a24af9aa9479d27e6d160978631108
2016-09-20 09:25:26 +02:00
Michael Zhou
4919dd852f Update CodeMirror to 5.18.2
Highlights include:
  - Make sure gutter backgrounds stick to the rest of the gutter during
    horizontal scrolling.
  - JavaScript mode: Fix some small parsing bugs and improve TypeScript
    support.
  - The "jade" mode has been renamed to "pug".

Change-Id: I5079f75490586aec851d5cf99860a91b1a5d590b
2016-08-23 22:21:48 -04:00
Michael Zhou
05484541e5 Update CodeMirror to 5.17.0
Highlights include:
 - Fix problem with wrapped trailing whitespace displaying incorrectly.
 - Prevent IME dialog from overlapping typed content in Chrome.
 - Improve measuring of characters near a line wrap.
 - javascript mode: Improve support for async, allow trailing commas in
   import lists.
 - vim bindings: Fix backspace in replace mode.
 - sublime bindings: Fix some key bindings on OS X to match Sublime Text.
 - markdown mode: Add more classes to image links in highlight-formatting
   mode.

Change-Id: I206cc21c7a01940225b152134539af034c91237b
2016-07-23 17:01:39 -04:00
Michael Zhou
72ba17faa6 Update CodeMirror to 5.16.0
This update contains small fixes to a few addons. No new language mode
was added.

Change-Id: Ic042c8fa280fa3058d245a78a72c0e40b8227301
2016-06-20 22:51:19 -04:00
Michael Zhou
17ed76a1cf Update CodeMirror to 5.15.2
Interesting changes in the core library that might affect Gerrit
include:
  - Fix issue where the editor would complain about overlapping
    collapsed ranges when there weren't any.
  - Optimize document tree building when loading or pasting huge chunks
    of content.

No new language mode was added. Some improvements were done on several
existing language modes:
  - markdown mode: Fix several issues in matching link targets.
  - clike mode: Improve indentation of C++ template declarations.
  - javascript mode: Support async / await and improve support for
    TypeScript type syntax.

Change-Id: If40cb074527e7dcc73d1630c89baa5fe713b44bc
2016-05-20 22:27:47 +00:00
Michael Zhou
ecaf9b075c EditScreen: Show the base version of the file in a CodeMirror merge view
This adds a merge view to the inline editing screen so that users can
diff against the patch set the change edit is based on while editing.

This new functionality makes use of CodeMirror's merge view addon, which
requires Google's diff-match-patch library to be loaded. The library
implements an algorithm based on the Myers diff in JavaScript on the
client side, so there is no extra usage of Gerrit's DiffApi.

The minified diff-match-patch library is bundled with CodeMirror's merge
view addon during the build process.

By default, the merge view is disabled. This can be changed via
EditPreferencesBox. Also added a checkbox to the EditScreen header to
toggle the view.

The loading of the content of the base version is lazy - it is only
loaded when the merge view is actually used.

The documentation and tutorial on this new feature will be added in
later changes.

Screenshot: https://i.imgur.com/uNMNzjM.png

Change-Id: I5eb4af9b67bbfcb0b149965b3c818c1f6118e6de
2016-04-27 03:05:00 -04:00
Michael Zhou
efa8e484ce Add all the CodeMirror themes as of 5.14.2
This change makes all the CodeMirror themes as of the 5.14.2 release
available in DiffScreen and EditScreen.

Updated Documentation/rest-api-accounts.txt to reflect the addition.

Change-Id: Ic37e2ac5cfae91ed3cf61d7dc9d3345668715dae
2016-04-26 08:18:58 +00:00
Gabor Somossy
b72d4c6d8f Allow file annotations (blame) in side-by-side diff
Using CodeMirror's lint addon on the UI to display the blame
annotations. It works on both sides of the side-by-side
diff and also supports the auto-merge commit. It requires manual
step to enable the annotations to avoid any unnecessary git
processing and network traffic between the server and client.

Introduces a new dependency on blame-cache in gerrit-server
to reuse BlameCache.

In a following change, the gutter showing the blame info will be
made clickable. Clicking on the gutter will open a new tab that
takes the user to the corresponding change in Gerrit.

The commit SHA-1 hashes are currently not selectable. Making it
so might require an upstream change in CodeMirror's lint addon.

Bug: Issue 1642
Change-Id: I6267d30cbee448f8137e11c7120959dc424eaeeb
2016-04-25 08:38:55 -04:00
Michael Zhou
ef0833da2a Update CodeMirror to 5.14.2
Added 5 new language modes: mbox, PowerShell, SAS, Web IDL and Yacas.

Change-Id: I2c035d9cd813afb2d575e1b46be05586813fc869
2016-04-20 17:05:25 -04:00
Michael Zhou
b72c03222c InlineEdit: Add Sublime Text keymap
Sublime Text keymap has been available since CodeMirror 4.0. This change
enables using it in the EditScreen.

Change-Id: I34e82fceb9502405d8d03a6c6117d4900d08248e
2016-04-18 15:53:55 -04:00
David Ostrovsky
05ac94d390 Merge "Revert "Revert "InlineEdit: Switch to using native jump-to-line addon""" 2016-04-18 18:52:52 +00:00
Michael Zhou
c411fccb31 Revert "Revert "InlineEdit: Switch to using native jump-to-line addon""
This reverts commit 81b830df4e37d398ad957bb979b039f8e13a73ab.

Now that CodeMirror has been updated to 5.13.4, we are free to reapply
the original change.

Change-Id: I91edca137f52ca18c47b25fbc20cdf337189d9ef
2016-04-16 08:16:49 +00:00
Michael Zhou
fae6bb2365 Use the "NPM WebJar" instead of "classic WebJar" for CodeMirror
The NPM WebJar is easier to deploy. As soon as the CodeMirror author
publishes a new version to NPM, anyone can deploy it to WebJars in one
click. In contrast, the classic WebJar requires a WebJars team member to
manually update and deploy it, which usually takes longer [1].

Also update version to 5.13.4, which was a trivial fix to include the
LICENSE file and brought no functionality change.

[1]: http://www.webjars.org/

Change-Id: I9328f371aa99cac7e81b3f8a442d6582275ad3a7
2016-04-06 21:26:50 -04:00
David Ostrovsky
34d7eb1f3e Buck: Fix non obfuscated CodeMirror fetching
I36b4c29e2 introduced a typo in group id for non obfuscated CodeMirror
distribution.

Change-Id: If4f396d314fb7a6e689d3389676a5c73252a88b3
Reported-By: Marco Miller <marco.miller@ericsson.com>
2016-04-06 20:39:17 +02:00
David Ostrovsky
cc825eea10 Merge changes from topic 'codemirror-obfuscation'
* changes:
  Use a pre-built minified CodeMirror in the release build
  Buck: Turn off Codemirror obfuscation in non release build
2016-04-06 08:55:48 +00:00
Edwin Kempin
66e51048fb Fix showing diff for *.ini.erb files
Showing the diff for *.ini.erb files may fail with the following
CodeMirror error:

  SEVERE: (TypeError) : a.multiplexingMode is not a function
    Class$S155: (TypeError) : a.multiplexingMode is not a function
      at Unknown.wrap_4(gerrit_ui-0.js)
      at Unknown.entry0(gerrit_ui-0.js)
      at Unknown.<anonymous>(gerrit_ui-0.js)
      ...

This is because the htmlembedded mode requires the CodeMirror
mode/multiplex addon [1]. Adding it fixes the issue.

[1] https://github.com/fixlr/codemirror-rails/issues/37

Change-Id: I5d33f0d073b9c9329dd4eaad1c4667d419777693
Signed-off-by: Edwin Kempin <ekempin@google.com>
2016-04-05 16:00:35 +02:00
Michael Zhou
9a7f4493a7 Use a pre-built minified CodeMirror in the release build
I've started to maintain a minified CodeMirror distribution at
https://www.npmjs.com/package/codemirror-minified. It is released
on both NPM and WebJars with a version number that matches the
current version of CodeMirror. It comes with all non-test
JavaScript and CSS files minified.

Commit 7b11d6ad305f5106f3116146b4c442e81aa63b3f
(change I05d925c94a3c0368366e9d3ad109cf84492810fc) already turned off
CodeMirror obfuscation in non-release builds. With this further change,
we can avoid running Closure Compiler altogether.

Removed the special case for CodeMirror in
Documentation/gen_licenses.py since it's no longer needed.

Removed the now unused js_minify() rule and the rules for downloading
Closure Compiler and its externs. They will be re-added to tools/js for
minifying PolyGerrit.

Change-Id: I36b4c29e2300384f49d3660266cc7b89140c9faf
2016-04-04 20:33:27 -04:00
David Ostrovsky
7b11d6ad30 Buck: Turn off Codemirror obfuscation in non release build
In I24790e84 I activated Closure Compiler tool chain to minify JS code.
In retrospective, it was wrong, of course, to unconditionally activate
the obfuscation, even in developer mode. As the consequence, devs have
hard time to troubleshoot Codemirror integration problems. Not to
mention, that the minifcation takes tons of time and not needed on dev
build. Also note, that every single language mode file is compiled.

In Ia9964735 I already disabled cast checking only in release mode. Use
the same differentiation and disable Codemirror obfuscation in non
release build.

Test Plan:

1. `buck build gerrit` should include non obfuscated Codemirror code
2. `buck build release` should include obfuscated Codemirror code

Change-Id: I05d925c94a3c0368366e9d3ad109cf84492810fc
2016-04-04 20:30:55 -04:00
Dave Borowitz
83e36d7425 Merge "Pass "--language_out ECMASCRIPT5_STRICT" to Closure Compiler" 2016-03-28 16:51:12 +00:00
Michael Zhou
02ce5a6de1 Pass "--language_out ECMASCRIPT5_STRICT" to Closure Compiler
This makes Closure Compiler add a "use strict;" directive to the
beginning of the output, which might improve the performance
on JavaScript engines.

Change-Id: I239d08bdbc47e98a373cf1b1d3b0417e36875dea
2016-03-28 12:33:24 -04:00
Michael Zhou
045be4992a Update Closure Compiler to v20160315
Closure Compiler now runs an additional flow sensitive variable
inlining pass before function inlining, which brings a small
improvement on code size.

Change-Id: I01a2f87c085b49091567467be107d211e769b085
2016-03-28 12:18:31 -04:00
Michael Zhou
2b4a2080d4 Update CodeMirror to 5.13.2
This includes a hotfix for a gutter displaying problem which may
affect us.

Change-Id: I9571640694edbccd39c3bb4aa9be4d9c867e66d8
2016-03-23 17:03:37 -04:00
Michael Zhou
993cbcba78 Add all language modes from CodeMirror 5.13
We forgot to include these in the past CodeMirror upgrades.
Updated to include all language modes available as of 5.13.

Also add many more extensions to mime-types.properties so we get more
syntax highlighting.

Bug: Issue 3947
Change-Id: Ib5d45bce5b02d42d3b58423f97079d8d73318057
2016-03-22 13:31:31 -04:00
David Pursehouse
2561273bd7 Upgrade CodeMirror to 5.13
At least version 5.11 is needed to enable JSX mode, but we
couldn't use 5.11 or 5.12 due to a known issue with
bidirectional text [1]. Release 5.13 included Michael Zhou's
fix for [1].

Now that 5.13 is released and deployed to Maven, upgrade to that
version. JSX support, along with many more language modes that
we missed during previous upgrades, will be added in a follow-up
change.

[1] https://github.com/codemirror/CodeMirror/issues/3846

Change-Id: I37314d9d4f8aef98fe724a999c08f09aa7d411fa
2016-03-22 13:13:03 -04:00
David Pursehouse
2a6d9cdcdc Codemirror: Update comment to mention that ModeInfo must be updated
Change-Id: I15ebd269dcb07a340d8848400a9795ef7a99fdec
2016-03-04 17:30:58 +09:00
Michael Zhou
4cb0ffbd10 Update Closure Compiler to v20160208
Includes minor improvements to constant folding.

Release note:
https://github.com/google/closure-compiler/wiki/Releases#february-08-2016-v20160208

Change-Id: Ifaa9eb1fce316daec0fd4652e698da4488837e23
2016-02-29 19:31:52 -05:00
Edwin Kempin
2f5e968b00 Revert "Update CodeMirror to 5.11"
This reverts commit 7c504473b0c16d4327f895b88240c3979c39ac7f.

We need to revert this CodeMirror upgrade because it broke displaying
the file diff for certain files as reported by issue 3927 [1].

[1] https://code.google.com/p/gerrit/issues/detail?id=3927

Bug: issue 3927
Change-Id: Id6ee70e3a8e9b5e5e31cde9bddc09106088ff31d
2016-02-19 16:02:56 +01:00
Edwin Kempin
81b830df4e Revert "InlineEdit: Switch to using native jump-to-line addon"
This reverts commit 99d8d3c21f2bcdcc15390964e893f0de5221ef18.

We need to revert the CodeMirror upgrade to 5.11 which was done by
Id02e65 because it broke displaying the file diff for certain files as
reported by issue 3927 [1]. Since this commit relies on the new
CodeMirror version is must be reverted as well.

[1] https://code.google.com/p/gerrit/issues/detail?id=3927

Change-Id: I6b15aa239666348e5c4ac50f4b248ef9a8f00cc5
2016-02-19 15:57:40 +01:00
David Ostrovsky
99d8d3c21f InlineEdit: Switch to using native jump-to-line addon
The feature request to add native jump-to-line dialog to CodeMirror: [1]
was solved in context of this PR: [2]. So that now we can switch from
native and ugly Window#prompt() to nice looking CodeMirror addon.

Test Plan:

- Open change editor
- Type Alt-G|Ctrl-L|Cmd-L
- Jump to line dialog appears
- Type the line number: 42 and hit enter
- Confirm that the cursor is jumped to line 42

[1] https://github.com/codemirror/CodeMirror/issues/3030
[2] https://github.com/codemirror/CodeMirror/pull/3682

Change-Id: Ic9b889ea1efe26b3a19c5e885f1668009acc12ad
2016-02-10 09:12:14 +00:00
Michael Zhou
7c504473b0 Update CodeMirror to 5.11
Includes bug fixes and new modes: JSX, literate Haskell, Crystal.

Change-Id: Id02e659ee162b5746994a2352de1989312a196f9
2016-02-08 18:17:59 -05:00
Karol Wrótniak
52c23ef4db Enable syntax highlighting for Swift
Change-Id: I252789ad5414902641ba46a0afb3d3219202bc3a
2016-01-11 19:28:32 +00:00
Michael Zhou
f4a06114cc Bump Closure Compiler version to v20151216
The closure-compiler jar now incudes its Java dependencies.

closure-compiler-externs no longer publishes a sources jar.

Change parse_graph() in Documentation/gen_licenses.py to always exclude
the edge from //lib/codemirror:js to //lib/codemirror:js_minifier.

Change-Id: I6a9160ffdb02347202a2b64c226f00c13cc0e19c
2016-01-05 17:38:12 -05:00
David Ostrovsky
2c303e12d2 Upgrade Codemirror to version 5.8
This version added new modes (NSIS, Ceylon) improvements and bug fixes.

Bug: Issue 3643
Change-Id: I7bbc8c0e90f997b73f1b7efcdc7f7af18d1e37f6
2015-11-05 10:23:22 +09:00
David Ostrovsky
3c08d56e23 Upgrade Codemirror to version 5.7
This version added new modes, improvements and bug fixes. One of
interesting new features is "Replace all" command that was added
to search addon and can now be used in inline editor. To invoke
this command from default mode:

  replaceAll:  Shift-Ctrl-R (PC), Shift-Cmd-Alt-F (Mac)

Change-Id: Ie7ed3d6139394424a9d682fdb1dba6003d490ef2
2015-10-16 04:41:02 +00:00