From eb818be2df9bd4fd49d90b0ef3ce4342aef39db2 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 16 Jul 2014 11:07:18 +0100 Subject: [PATCH] Use Ace in no-conflict mode --- .../auto-complete/AutoCompleteManager.coffee | 77 ---------- .../ide/editor/directives/aceEditor.coffee | 6 +- .../auto-complete/AutoCompleteManager.coffee | 8 +- .../highlights/HighlightsManager.coffee | 2 +- .../spell-check/HighlightedWordManager.coffee | 4 +- .../spell-check/SpellCheckManager.coffee | 2 +- .../aceEditor/undo/UndoManager.coffee | 6 +- .../editor/sharejs/vendor/client/ace.coffee | 2 +- services/web/public/js/ace/ace.js | 132 +++++++++--------- services/web/public/js/ace/ext-beautify.js | 6 +- services/web/public/js/ace/ext-chromevox.js | 4 +- .../js/ace/ext-elastic_tabstops_lite.js | 4 +- services/web/public/js/ace/ext-emmet.js | 6 +- .../web/public/js/ace/ext-error_marker.js | 2 +- .../web/public/js/ace/ext-keybinding_menu.js | 8 +- .../web/public/js/ace/ext-language_tools.js | 14 +- services/web/public/js/ace/ext-linking.js | 4 +- services/web/public/js/ace/ext-modelist.js | 4 +- services/web/public/js/ace/ext-old_ie.js | 6 +- services/web/public/js/ace/ext-searchbox.js | 4 +- .../web/public/js/ace/ext-settings_menu.js | 18 +-- services/web/public/js/ace/ext-spellcheck.js | 4 +- services/web/public/js/ace/ext-split.js | 6 +- .../web/public/js/ace/ext-static_highlight.js | 4 +- services/web/public/js/ace/ext-statusbar.js | 4 +- services/web/public/js/ace/ext-textarea.js | 8 +- services/web/public/js/ace/ext-themelist.js | 4 +- services/web/public/js/ace/ext-whitespace.js | 4 +- .../web/public/js/ace/keybinding-emacs.js | 10 +- services/web/public/js/ace/keybinding-vim.js | 14 +- services/web/public/js/ace/mode-abap.js | 6 +- .../web/public/js/ace/mode-actionscript.js | 6 +- services/web/public/js/ace/mode-ada.js | 4 +- .../web/public/js/ace/mode-apache_conf.js | 6 +- .../web/public/js/ace/mode-applescript.js | 6 +- services/web/public/js/ace/mode-asciidoc.js | 6 +- .../web/public/js/ace/mode-assembly_x86.js | 6 +- services/web/public/js/ace/mode-autohotkey.js | 6 +- services/web/public/js/ace/mode-batchfile.js | 6 +- services/web/public/js/ace/mode-c9search.js | 8 +- services/web/public/js/ace/mode-c_cpp.js | 12 +- services/web/public/js/ace/mode-cirru.js | 6 +- services/web/public/js/ace/mode-clojure.js | 6 +- services/web/public/js/ace/mode-cobol.js | 4 +- services/web/public/js/ace/mode-coffee.js | 8 +- services/web/public/js/ace/mode-coldfusion.js | 38 ++--- services/web/public/js/ace/mode-csharp.js | 14 +- services/web/public/js/ace/mode-css.js | 12 +- services/web/public/js/ace/mode-curly.js | 38 ++--- services/web/public/js/ace/mode-d.js | 8 +- services/web/public/js/ace/mode-dart.js | 16 +-- services/web/public/js/ace/mode-diff.js | 6 +- services/web/public/js/ace/mode-django.js | 36 ++--- services/web/public/js/ace/mode-dockerfile.js | 12 +- services/web/public/js/ace/mode-dot.js | 10 +- services/web/public/js/ace/mode-ejs.js | 42 +++--- services/web/public/js/ace/mode-erlang.js | 6 +- services/web/public/js/ace/mode-forth.js | 6 +- services/web/public/js/ace/mode-ftl.js | 14 +- services/web/public/js/ace/mode-gherkin.js | 4 +- services/web/public/js/ace/mode-gitignore.js | 4 +- services/web/public/js/ace/mode-glsl.js | 16 +-- services/web/public/js/ace/mode-golang.js | 12 +- services/web/public/js/ace/mode-groovy.js | 16 +-- services/web/public/js/ace/mode-haml.js | 8 +- services/web/public/js/ace/mode-handlebars.js | 40 +++--- services/web/public/js/ace/mode-haskell.js | 6 +- services/web/public/js/ace/mode-haxe.js | 12 +- services/web/public/js/ace/mode-html.js | 34 ++--- services/web/public/js/ace/mode-html_ruby.js | 44 +++--- services/web/public/js/ace/mode-ini.js | 6 +- services/web/public/js/ace/mode-jack.js | 10 +- services/web/public/js/ace/mode-jade.js | 24 ++-- services/web/public/js/ace/mode-java.js | 16 +-- services/web/public/js/ace/mode-javascript.js | 12 +- services/web/public/js/ace/mode-json.js | 10 +- services/web/public/js/ace/mode-jsoniq.js | 24 ++-- services/web/public/js/ace/mode-jsp.js | 22 +-- services/web/public/js/ace/mode-jsx.js | 12 +- services/web/public/js/ace/mode-julia.js | 6 +- services/web/public/js/ace/mode-latex.js | 6 +- services/web/public/js/ace/mode-less.js | 12 +- services/web/public/js/ace/mode-liquid.js | 16 +-- services/web/public/js/ace/mode-lisp.js | 4 +- services/web/public/js/ace/mode-livescript.js | 4 +- services/web/public/js/ace/mode-logiql.js | 10 +- services/web/public/js/ace/mode-lsl.js | 10 +- services/web/public/js/ace/mode-lua.js | 6 +- services/web/public/js/ace/mode-luapage.js | 44 +++--- services/web/public/js/ace/mode-lucene.js | 4 +- services/web/public/js/ace/mode-makefile.js | 8 +- services/web/public/js/ace/mode-markdown.js | 42 +++--- services/web/public/js/ace/mode-matlab.js | 4 +- services/web/public/js/ace/mode-mel.js | 8 +- services/web/public/js/ace/mode-mushcode.js | 6 +- services/web/public/js/ace/mode-mysql.js | 6 +- services/web/public/js/ace/mode-nix.js | 16 +-- services/web/public/js/ace/mode-objectivec.js | 10 +- services/web/public/js/ace/mode-ocaml.js | 6 +- services/web/public/js/ace/mode-pascal.js | 6 +- services/web/public/js/ace/mode-perl.js | 8 +- services/web/public/js/ace/mode-pgsql.js | 14 +- services/web/public/js/ace/mode-php.js | 20 +-- services/web/public/js/ace/mode-plain_text.js | 2 +- services/web/public/js/ace/mode-powershell.js | 10 +- services/web/public/js/ace/mode-prolog.js | 6 +- services/web/public/js/ace/mode-properties.js | 4 +- services/web/public/js/ace/mode-protobuf.js | 16 +-- services/web/public/js/ace/mode-python.js | 6 +- services/web/public/js/ace/mode-r.js | 8 +- services/web/public/js/ace/mode-rdoc.js | 8 +- services/web/public/js/ace/mode-rhtml.js | 42 +++--- services/web/public/js/ace/mode-ruby.js | 8 +- services/web/public/js/ace/mode-rust.js | 6 +- services/web/public/js/ace/mode-sass.js | 8 +- services/web/public/js/ace/mode-scad.js | 12 +- services/web/public/js/ace/mode-scala.js | 16 +-- services/web/public/js/ace/mode-scheme.js | 4 +- services/web/public/js/ace/mode-scss.js | 12 +- services/web/public/js/ace/mode-sh.js | 8 +- services/web/public/js/ace/mode-sjs.js | 16 +-- services/web/public/js/ace/mode-smarty.js | 38 ++--- services/web/public/js/ace/mode-snippets.js | 4 +- .../web/public/js/ace/mode-soy_template.js | 38 ++--- services/web/public/js/ace/mode-space.js | 6 +- services/web/public/js/ace/mode-sql.js | 4 +- services/web/public/js/ace/mode-stylus.js | 8 +- services/web/public/js/ace/mode-svg.js | 26 ++-- services/web/public/js/ace/mode-tcl.js | 8 +- services/web/public/js/ace/mode-tex.js | 6 +- services/web/public/js/ace/mode-textile.js | 6 +- services/web/public/js/ace/mode-toml.js | 6 +- services/web/public/js/ace/mode-twig.js | 38 ++--- services/web/public/js/ace/mode-typescript.js | 16 +-- services/web/public/js/ace/mode-vala.js | 10 +- services/web/public/js/ace/mode-vbscript.js | 4 +- services/web/public/js/ace/mode-velocity.js | 40 +++--- services/web/public/js/ace/mode-verilog.js | 4 +- services/web/public/js/ace/mode-vhdl.js | 4 +- services/web/public/js/ace/mode-xml.js | 8 +- services/web/public/js/ace/mode-xquery.js | 24 ++-- services/web/public/js/ace/mode-yaml.js | 8 +- services/web/public/js/ace/snippets/abap.js | 2 +- .../public/js/ace/snippets/actionscript.js | 2 +- services/web/public/js/ace/snippets/ada.js | 2 +- .../web/public/js/ace/snippets/apache_conf.js | 2 +- .../web/public/js/ace/snippets/applescript.js | 2 +- .../web/public/js/ace/snippets/asciidoc.js | 2 +- .../public/js/ace/snippets/assembly_x86.js | 2 +- .../web/public/js/ace/snippets/autohotkey.js | 2 +- .../web/public/js/ace/snippets/batchfile.js | 2 +- .../web/public/js/ace/snippets/c9search.js | 2 +- services/web/public/js/ace/snippets/c_cpp.js | 2 +- services/web/public/js/ace/snippets/cirru.js | 2 +- .../web/public/js/ace/snippets/clojure.js | 2 +- services/web/public/js/ace/snippets/cobol.js | 2 +- services/web/public/js/ace/snippets/coffee.js | 2 +- .../web/public/js/ace/snippets/coldfusion.js | 2 +- services/web/public/js/ace/snippets/csharp.js | 2 +- services/web/public/js/ace/snippets/css.js | 2 +- services/web/public/js/ace/snippets/curly.js | 2 +- services/web/public/js/ace/snippets/d.js | 2 +- services/web/public/js/ace/snippets/dart.js | 2 +- services/web/public/js/ace/snippets/diff.js | 2 +- services/web/public/js/ace/snippets/django.js | 2 +- .../web/public/js/ace/snippets/dockerfile.js | 2 +- services/web/public/js/ace/snippets/dot.js | 2 +- services/web/public/js/ace/snippets/ejs.js | 2 +- services/web/public/js/ace/snippets/erlang.js | 8 +- services/web/public/js/ace/snippets/forth.js | 2 +- services/web/public/js/ace/snippets/ftl.js | 2 +- .../web/public/js/ace/snippets/gherkin.js | 2 +- .../web/public/js/ace/snippets/gitignore.js | 2 +- services/web/public/js/ace/snippets/glsl.js | 2 +- services/web/public/js/ace/snippets/golang.js | 2 +- services/web/public/js/ace/snippets/groovy.js | 2 +- services/web/public/js/ace/snippets/haml.js | 2 +- .../web/public/js/ace/snippets/handlebars.js | 2 +- .../web/public/js/ace/snippets/haskell.js | 2 +- services/web/public/js/ace/snippets/haxe.js | 2 +- services/web/public/js/ace/snippets/html.js | 2 +- .../web/public/js/ace/snippets/html_ruby.js | 2 +- services/web/public/js/ace/snippets/ini.js | 2 +- services/web/public/js/ace/snippets/jack.js | 2 +- services/web/public/js/ace/snippets/jade.js | 2 +- services/web/public/js/ace/snippets/java.js | 2 +- .../web/public/js/ace/snippets/javascript.js | 4 +- services/web/public/js/ace/snippets/json.js | 2 +- services/web/public/js/ace/snippets/jsoniq.js | 2 +- services/web/public/js/ace/snippets/jsp.js | 2 +- services/web/public/js/ace/snippets/jsx.js | 2 +- services/web/public/js/ace/snippets/julia.js | 2 +- services/web/public/js/ace/snippets/latex.js | 2 +- services/web/public/js/ace/snippets/less.js | 2 +- services/web/public/js/ace/snippets/liquid.js | 2 +- services/web/public/js/ace/snippets/lisp.js | 2 +- .../web/public/js/ace/snippets/livescript.js | 2 +- services/web/public/js/ace/snippets/logiql.js | 2 +- services/web/public/js/ace/snippets/lsl.js | 2 +- services/web/public/js/ace/snippets/lua.js | 2 +- .../web/public/js/ace/snippets/luapage.js | 2 +- services/web/public/js/ace/snippets/lucene.js | 2 +- .../web/public/js/ace/snippets/makefile.js | 2 +- .../web/public/js/ace/snippets/markdown.js | 2 +- services/web/public/js/ace/snippets/matlab.js | 2 +- services/web/public/js/ace/snippets/mel.js | 2 +- .../web/public/js/ace/snippets/mushcode.js | 2 +- services/web/public/js/ace/snippets/mysql.js | 2 +- services/web/public/js/ace/snippets/nix.js | 2 +- .../web/public/js/ace/snippets/objectivec.js | 2 +- services/web/public/js/ace/snippets/ocaml.js | 2 +- services/web/public/js/ace/snippets/pascal.js | 2 +- services/web/public/js/ace/snippets/perl.js | 2 +- services/web/public/js/ace/snippets/pgsql.js | 2 +- services/web/public/js/ace/snippets/php.js | 8 +- .../web/public/js/ace/snippets/plain_text.js | 2 +- .../web/public/js/ace/snippets/powershell.js | 2 +- services/web/public/js/ace/snippets/prolog.js | 2 +- .../web/public/js/ace/snippets/properties.js | 2 +- .../web/public/js/ace/snippets/protobuf.js | 2 +- services/web/public/js/ace/snippets/python.js | 2 +- services/web/public/js/ace/snippets/r.js | 2 +- services/web/public/js/ace/snippets/rdoc.js | 2 +- services/web/public/js/ace/snippets/rhtml.js | 2 +- services/web/public/js/ace/snippets/ruby.js | 2 +- services/web/public/js/ace/snippets/rust.js | 2 +- services/web/public/js/ace/snippets/sass.js | 2 +- services/web/public/js/ace/snippets/scad.js | 2 +- services/web/public/js/ace/snippets/scala.js | 2 +- services/web/public/js/ace/snippets/scheme.js | 2 +- services/web/public/js/ace/snippets/scss.js | 2 +- services/web/public/js/ace/snippets/sh.js | 2 +- services/web/public/js/ace/snippets/sjs.js | 2 +- services/web/public/js/ace/snippets/smarty.js | 2 +- .../web/public/js/ace/snippets/snippets.js | 2 +- .../public/js/ace/snippets/soy_template.js | 2 +- services/web/public/js/ace/snippets/space.js | 2 +- services/web/public/js/ace/snippets/sql.js | 2 +- services/web/public/js/ace/snippets/stylus.js | 2 +- services/web/public/js/ace/snippets/svg.js | 2 +- services/web/public/js/ace/snippets/tcl.js | 2 +- services/web/public/js/ace/snippets/tex.js | 2 +- services/web/public/js/ace/snippets/text.js | 2 +- .../web/public/js/ace/snippets/textile.js | 2 +- services/web/public/js/ace/snippets/toml.js | 2 +- services/web/public/js/ace/snippets/twig.js | 2 +- .../web/public/js/ace/snippets/typescript.js | 2 +- services/web/public/js/ace/snippets/vala.js | 2 +- .../web/public/js/ace/snippets/vbscript.js | 2 +- .../web/public/js/ace/snippets/velocity.js | 2 +- .../web/public/js/ace/snippets/verilog.js | 2 +- services/web/public/js/ace/snippets/vhdl.js | 2 +- services/web/public/js/ace/snippets/xml.js | 2 +- services/web/public/js/ace/snippets/xquery.js | 2 +- services/web/public/js/ace/snippets/yaml.js | 2 +- services/web/public/js/ace/theme-ambiance.js | 2 +- services/web/public/js/ace/theme-chaos.js | 2 +- services/web/public/js/ace/theme-chrome.js | 2 +- services/web/public/js/ace/theme-clouds.js | 2 +- .../public/js/ace/theme-clouds_midnight.js | 2 +- services/web/public/js/ace/theme-cobalt.js | 2 +- .../web/public/js/ace/theme-crimson_editor.js | 2 +- services/web/public/js/ace/theme-dawn.js | 2 +- .../web/public/js/ace/theme-dreamweaver.js | 2 +- services/web/public/js/ace/theme-eclipse.js | 2 +- services/web/public/js/ace/theme-github.js | 2 +- .../web/public/js/ace/theme-idle_fingers.js | 2 +- .../web/public/js/ace/theme-katzenmilch.js | 2 +- services/web/public/js/ace/theme-kr.js | 2 +- services/web/public/js/ace/theme-kuroir.js | 2 +- services/web/public/js/ace/theme-merbivore.js | 2 +- .../web/public/js/ace/theme-merbivore_soft.js | 2 +- .../public/js/ace/theme-mono_industrial.js | 2 +- services/web/public/js/ace/theme-monokai.js | 2 +- .../web/public/js/ace/theme-pastel_on_dark.js | 2 +- .../web/public/js/ace/theme-solarized_dark.js | 2 +- .../public/js/ace/theme-solarized_light.js | 2 +- services/web/public/js/ace/theme-terminal.js | 2 +- services/web/public/js/ace/theme-textmate.js | 2 +- services/web/public/js/ace/theme-tomorrow.js | 2 +- .../web/public/js/ace/theme-tomorrow_night.js | 2 +- .../js/ace/theme-tomorrow_night_blue.js | 2 +- .../js/ace/theme-tomorrow_night_bright.js | 2 +- .../js/ace/theme-tomorrow_night_eighties.js | 2 +- services/web/public/js/ace/theme-twilight.js | 2 +- .../web/public/js/ace/theme-vibrant_ink.js | 2 +- services/web/public/js/ace/theme-xcode.js | 2 +- services/web/public/js/ace/worker-coffee.js | 32 ++--- services/web/public/js/ace/worker-css.js | 20 +-- services/web/public/js/ace/worker-html.js | 20 +-- .../web/public/js/ace/worker-javascript.js | 22 +-- services/web/public/js/ace/worker-json.js | 20 +-- services/web/public/js/ace/worker-lua.js | 20 +-- services/web/public/js/ace/worker-php.js | 20 +-- services/web/public/js/ace/worker-xquery.js | 22 +-- 295 files changed, 1120 insertions(+), 1197 deletions(-) delete mode 100644 services/web/public/coffee/auto-complete/AutoCompleteManager.coffee diff --git a/services/web/public/coffee/auto-complete/AutoCompleteManager.coffee b/services/web/public/coffee/auto-complete/AutoCompleteManager.coffee deleted file mode 100644 index 52ae4a6b49..0000000000 --- a/services/web/public/coffee/auto-complete/AutoCompleteManager.coffee +++ /dev/null @@ -1,77 +0,0 @@ -define [ - "auto-complete/SuggestionManager" - "auto-complete/Snippets" - "ace/autocomplete/util" - "ace/autocomplete" - "ace/range" - "ace/ext/language_tools" -], (SuggestionManager, Snippets, Util, AutoComplete) -> - Range = require("ace/range").Range - Autocomplete = AutoComplete.Autocomplete - - Util.retrievePrecedingIdentifier = (text, pos, regex) -> - currentLineOffset = 0 - for i in [(pos-1)..0] - if text[i] == "\n" - currentLineOffset = i + 1 - break - currentLine = text.slice(currentLineOffset, pos) - fragment = getLastCommandFragment(currentLine) or "" - return fragment - - getLastCommandFragment = (lineUpToCursor) -> - if m = lineUpToCursor.match(/(\\[^\\ ]+)$/) - return m[1] - else - return null - - class AutoCompleteManager - constructor: (@ide) -> - @aceEditor = @ide.editor.aceEditor - @aceEditor.setOptions({ - enableBasicAutocompletion: true, - enableSnippets: true - }) - - SnippetCompleter = - getCompletions: (editor, session, pos, prefix, callback) -> - callback null, Snippets - @suggestionManager = new SuggestionManager() - - @aceEditor.completers = [@suggestionManager, SnippetCompleter] - - insertMatch = Autocomplete::insertMatch - editor = @aceEditor - Autocomplete::insertMatch = (data) -> - pos = editor.getCursorPosition() - range = new Range(pos.row, pos.column, pos.row, pos.column + 1) - nextChar = editor.session.getTextRange(range) - - # If we are in \begin{it|}, then we need to remove the trailing } - # since it will be adding in with the autocomplete of \begin{item}... - if this.completions.filterText.match(/^\\begin\{/) and nextChar == "}" - editor.session.remove(range) - - insertMatch.call editor.completer, data - - @bindToEditorEvents() - - bindToEditorEvents: () -> - @ide.editor.on "change:doc", (@aceSession) => - @aceSession.on "change", (change) => @onChange(change) - - onChange: (change) -> - cursorPosition = @aceEditor.getCursorPosition() - end = change.data.range.end - # Check that this change was made by us, not a collaborator - # (Cursor is still one place behind) - if end.row == cursorPosition.row and end.column == cursorPosition.column + 1 - if change.data.action == "insertText" - range = new Range(end.row, 0, end.row, end.column) - lineUpToCursor = @aceSession.getTextRange(range) - commandFragment = getLastCommandFragment(lineUpToCursor) - - if commandFragment? and commandFragment.length > 2 - setTimeout () => - @aceEditor.execCommand("startAutocomplete") - , 0 diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index c2c79b862d..9a83b457c4 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -8,7 +8,7 @@ define [ "ide/editor/directives/aceEditor/highlights/HighlightsManager" "ide/editor/directives/aceEditor/cursor-position/CursorPositionManager" ], (App, Ace, SearchBox, UndoManager, AutoCompleteManager, SpellCheckManager, HighlightsManager, CursorPositionManager) -> - EditSession = require('ace/edit_session').EditSession + EditSession = ace.require('ace/edit_session').EditSession App.directive "aceEditor", ["$timeout", "$compile", "$rootScope", ($timeout, $compile, $rootScope) -> monkeyPatchSearch($rootScope, $compile) @@ -39,7 +39,7 @@ define [ else @$originalApply(fn); - editor = Ace.edit(element.find(".ace-editor-body")[0]) + editor = ace.edit(element.find(".ace-editor-body")[0]) window.editors ||= [] window.editors.push editor @@ -225,7 +225,7 @@ define [ ] monkeyPatchSearch = ($rootScope, $compile) -> - SearchBox = Ace.require("ace/ext/searchbox").SearchBox + SearchBox = ace.require("ace/ext/searchbox").SearchBox searchHtml = """