ace-rails-ap 4.1.3 → 4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitmodules +1 -1
- data/Gemfile +2 -3
- data/ace-rails-ap.gemspec +0 -2
- data/lib/ace/rails/version.rb +1 -1
- data/update.sh +1 -1
- data/vendor/assets/javascripts/ace/ace.js +5192 -3414
- data/vendor/assets/javascripts/ace/ext-beautify.js +281 -288
- data/vendor/assets/javascripts/ace/ext-code_lens.js +238 -0
- data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +6 -3
- data/vendor/assets/javascripts/ace/ext-emmet.js +353 -246
- data/vendor/assets/javascripts/ace/ext-error_marker.js +6 -3
- data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +61 -38
- data/vendor/assets/javascripts/ace/ext-language_tools.js +532 -343
- data/vendor/assets/javascripts/ace/ext-linking.js +8 -5
- data/vendor/assets/javascripts/ace/ext-modelist.js +46 -12
- data/vendor/assets/javascripts/ace/ext-options.js +793 -0
- data/vendor/assets/javascripts/ace/ext-prompt.js +2783 -0
- data/vendor/assets/javascripts/ace/ext-rtl.js +122 -0
- data/vendor/assets/javascripts/ace/ext-searchbox.js +45 -40
- data/vendor/assets/javascripts/ace/ext-settings_menu.js +520 -369
- data/vendor/assets/javascripts/ace/ext-spellcheck.js +6 -4
- data/vendor/assets/javascripts/ace/ext-split.js +7 -46
- data/vendor/assets/javascripts/ace/ext-static_highlight.js +90 -22
- data/vendor/assets/javascripts/ace/ext-statusbar.js +9 -6
- data/vendor/assets/javascripts/ace/ext-textarea.js +21 -18
- data/vendor/assets/javascripts/ace/ext-themelist.js +10 -6
- data/vendor/assets/javascripts/ace/ext-whitespace.js +13 -6
- data/vendor/assets/javascripts/ace/keybinding-emacs.js +49 -61
- data/vendor/assets/javascripts/ace/keybinding-sublime.js +422 -0
- data/vendor/assets/javascripts/ace/keybinding-vim.js +620 -287
- data/vendor/assets/javascripts/ace/keybinding-vscode.js +262 -0
- data/vendor/assets/javascripts/ace/mode-abap.js +10 -3
- data/vendor/assets/javascripts/ace/mode-abc.js +14 -4
- data/vendor/assets/javascripts/ace/mode-actionscript.js +13 -5
- data/vendor/assets/javascripts/ace/mode-ada.js +54 -4
- data/vendor/assets/javascripts/ace/mode-alda.js +311 -0
- data/vendor/assets/javascripts/ace/mode-apache_conf.js +12 -5
- data/vendor/assets/javascripts/ace/mode-apex.js +457 -0
- data/vendor/assets/javascripts/ace/mode-applescript.js +11 -4
- data/vendor/assets/javascripts/ace/mode-aql.js +102 -0
- data/vendor/assets/javascripts/ace/mode-asciidoc.js +9 -2
- data/vendor/assets/javascripts/ace/mode-asl.js +422 -0
- data/vendor/assets/javascripts/ace/mode-assembly_x86.js +11 -4
- data/vendor/assets/javascripts/ace/mode-autohotkey.js +17 -8
- data/vendor/assets/javascripts/ace/mode-batchfile.js +12 -5
- data/vendor/assets/javascripts/ace/mode-c9search.js +9 -3
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +23 -7
- data/vendor/assets/javascripts/ace/mode-cirru.js +11 -4
- data/vendor/assets/javascripts/ace/mode-clojure.js +9 -1
- data/vendor/assets/javascripts/ace/mode-cobol.js +8 -1
- data/vendor/assets/javascripts/ace/mode-coffee.js +12 -4
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +163 -134
- data/vendor/assets/javascripts/ace/mode-crystal.js +642 -0
- data/vendor/assets/javascripts/ace/mode-csharp.js +13 -6
- data/vendor/assets/javascripts/ace/mode-csound_document.js +4036 -0
- data/vendor/assets/javascripts/ace/mode-csound_orchestra.js +2966 -0
- data/vendor/assets/javascripts/ace/mode-csound_score.js +462 -0
- data/vendor/assets/javascripts/ace/mode-csp.js +59 -0
- data/vendor/assets/javascripts/ace/mode-css.js +48 -27
- data/vendor/assets/javascripts/ace/mode-curly.js +162 -133
- data/vendor/assets/javascripts/ace/mode-d.js +12 -5
- data/vendor/assets/javascripts/ace/mode-dart.js +46 -20
- data/vendor/assets/javascripts/ace/mode-diff.js +11 -3
- data/vendor/assets/javascripts/ace/mode-django.js +164 -134
- data/vendor/assets/javascripts/ace/mode-dockerfile.js +12 -4
- data/vendor/assets/javascripts/ace/mode-dot.js +11 -4
- data/vendor/assets/javascripts/ace/mode-drools.js +46 -5
- data/vendor/assets/javascripts/ace/mode-edifact.js +166 -0
- data/vendor/assets/javascripts/ace/mode-eiffel.js +8 -1
- data/vendor/assets/javascripts/ace/mode-ejs.js +832 -298
- data/vendor/assets/javascripts/ace/mode-elixir.js +11 -4
- data/vendor/assets/javascripts/ace/mode-elm.js +10 -3
- data/vendor/assets/javascripts/ace/mode-erlang.js +13 -5
- data/vendor/assets/javascripts/ace/mode-forth.js +12 -5
- data/vendor/assets/javascripts/ace/mode-fortran.js +10 -3
- data/vendor/assets/javascripts/ace/mode-fsharp.js +316 -0
- data/vendor/assets/javascripts/ace/{mode-mipsassembler.js → mode-fsl.js} +91 -28
- data/vendor/assets/javascripts/ace/mode-ftl.js +23 -12
- data/vendor/assets/javascripts/ace/mode-gcode.js +8 -1
- data/vendor/assets/javascripts/ace/mode-gherkin.js +9 -4
- data/vendor/assets/javascripts/ace/mode-gitignore.js +8 -1
- data/vendor/assets/javascripts/ace/mode-glsl.js +24 -8
- data/vendor/assets/javascripts/ace/mode-gobstones.js +267 -99
- data/vendor/assets/javascripts/ace/mode-golang.js +11 -4
- data/vendor/assets/javascripts/ace/mode-graphqlschema.js +11 -3
- data/vendor/assets/javascripts/ace/mode-groovy.js +14 -5
- data/vendor/assets/javascripts/ace/mode-haml.js +442 -116
- data/vendor/assets/javascripts/ace/mode-handlebars.js +162 -133
- data/vendor/assets/javascripts/ace/mode-haskell.js +14 -6
- data/vendor/assets/javascripts/ace/mode-haskell_cabal.js +8 -1
- data/vendor/assets/javascripts/ace/mode-haxe.js +11 -4
- data/vendor/assets/javascripts/ace/mode-hjson.js +13 -6
- data/vendor/assets/javascripts/ace/mode-html.js +162 -133
- data/vendor/assets/javascripts/ace/mode-html_elixir.js +165 -136
- data/vendor/assets/javascripts/ace/mode-html_ruby.js +832 -298
- data/vendor/assets/javascripts/ace/mode-ini.js +8 -1
- data/vendor/assets/javascripts/ace/mode-io.js +14 -12
- data/vendor/assets/javascripts/ace/mode-jack.js +10 -3
- data/vendor/assets/javascripts/ace/mode-jade.js +272 -376
- data/vendor/assets/javascripts/ace/mode-java.js +110 -7
- data/vendor/assets/javascripts/ace/mode-javascript.js +14 -5
- data/vendor/assets/javascripts/ace/mode-json.js +13 -3
- data/vendor/assets/javascripts/ace/mode-json5.js +360 -0
- data/vendor/assets/javascripts/ace/mode-jsoniq.js +25 -12
- data/vendor/assets/javascripts/ace/mode-jsp.js +60 -15
- data/vendor/assets/javascripts/ace/mode-jssm.js +325 -0
- data/vendor/assets/javascripts/ace/mode-jsx.js +11 -4
- data/vendor/assets/javascripts/ace/mode-julia.js +12 -5
- data/vendor/assets/javascripts/ace/mode-kotlin.js +18 -7
- data/vendor/assets/javascripts/ace/mode-latex.js +87 -15
- data/vendor/assets/javascripts/ace/mode-less.js +47 -27
- data/vendor/assets/javascripts/ace/mode-liquid.js +2030 -472
- data/vendor/assets/javascripts/ace/mode-lisp.js +9 -2
- data/vendor/assets/javascripts/ace/mode-livescript.js +10 -2
- data/vendor/assets/javascripts/ace/mode-logiql.js +10 -3
- data/vendor/assets/javascripts/ace/mode-logtalk.js +352 -0
- data/vendor/assets/javascripts/ace/mode-lsl.js +11 -3
- data/vendor/assets/javascripts/ace/mode-lua.js +40 -12
- data/vendor/assets/javascripts/ace/mode-luapage.js +194 -144
- data/vendor/assets/javascripts/ace/mode-lucene.js +106 -22
- data/vendor/assets/javascripts/ace/mode-makefile.js +11 -3
- data/vendor/assets/javascripts/ace/mode-markdown.js +530 -201
- data/vendor/assets/javascripts/ace/mode-mask.js +101 -84
- data/vendor/assets/javascripts/ace/mode-matlab.js +8 -1
- data/vendor/assets/javascripts/ace/mode-maze.js +11 -3
- data/vendor/assets/javascripts/ace/mode-mediawiki.js +592 -0
- data/vendor/assets/javascripts/ace/mode-mel.js +11 -4
- data/vendor/assets/javascripts/ace/mode-mixal.js +122 -0
- data/vendor/assets/javascripts/ace/mode-mushcode.js +9 -2
- data/vendor/assets/javascripts/ace/mode-mysql.js +11 -4
- data/vendor/assets/javascripts/ace/mode-nginx.js +298 -0
- data/vendor/assets/javascripts/ace/mode-nim.js +363 -0
- data/vendor/assets/javascripts/ace/mode-nix.js +23 -7
- data/vendor/assets/javascripts/ace/mode-nsis.js +15 -8
- data/vendor/assets/javascripts/ace/mode-nunjucks.js +2698 -0
- data/vendor/assets/javascripts/ace/mode-objectivec.js +23 -8
- data/vendor/assets/javascripts/ace/mode-ocaml.js +8 -1
- data/vendor/assets/javascripts/ace/mode-pascal.js +92 -67
- data/vendor/assets/javascripts/ace/mode-perl.js +11 -3
- data/vendor/assets/javascripts/ace/mode-perl6.js +593 -0
- data/vendor/assets/javascripts/ace/mode-pgsql.js +314 -71
- data/vendor/assets/javascripts/ace/mode-php.js +1042 -995
- data/vendor/assets/javascripts/ace/mode-php_laravel_blade.js +13104 -0
- data/vendor/assets/javascripts/ace/mode-pig.js +13 -6
- data/vendor/assets/javascripts/ace/mode-plain_text.js +8 -1
- data/vendor/assets/javascripts/ace/mode-powershell.js +10 -3
- data/vendor/assets/javascripts/ace/mode-praat.js +17 -7
- data/vendor/assets/javascripts/ace/mode-prisma.js +489 -0
- data/vendor/assets/javascripts/ace/mode-prolog.js +12 -5
- data/vendor/assets/javascripts/ace/mode-properties.js +8 -1
- data/vendor/assets/javascripts/ace/mode-protobuf.js +23 -7
- data/vendor/assets/javascripts/ace/mode-puppet.js +368 -0
- data/vendor/assets/javascripts/ace/mode-python.js +306 -63
- data/vendor/assets/javascripts/ace/mode-qml.js +381 -0
- data/vendor/assets/javascripts/ace/mode-r.js +15 -4
- data/vendor/assets/javascripts/ace/mode-razor.js +166 -136
- data/vendor/assets/javascripts/ace/mode-rdoc.js +41 -3
- data/vendor/assets/javascripts/ace/mode-red.js +450 -0
- data/vendor/assets/javascripts/ace/mode-redshift.js +360 -0
- data/vendor/assets/javascripts/ace/mode-rhtml.js +162 -133
- data/vendor/assets/javascripts/ace/mode-rst.js +9 -1
- data/vendor/assets/javascripts/ace/mode-ruby.js +678 -166
- data/vendor/assets/javascripts/ace/mode-rust.js +16 -7
- data/vendor/assets/javascripts/ace/mode-sass.js +211 -116
- data/vendor/assets/javascripts/ace/mode-scad.js +11 -4
- data/vendor/assets/javascripts/ace/mode-scala.js +14 -5
- data/vendor/assets/javascripts/ace/mode-scheme.js +9 -2
- data/vendor/assets/javascripts/ace/mode-scss.js +412 -125
- data/vendor/assets/javascripts/ace/mode-sh.js +12 -4
- data/vendor/assets/javascripts/ace/mode-sjs.js +16 -7
- data/vendor/assets/javascripts/ace/mode-slim.js +5240 -0
- data/vendor/assets/javascripts/ace/mode-smarty.js +164 -135
- data/vendor/assets/javascripts/ace/mode-snippets.js +24 -16
- data/vendor/assets/javascripts/ace/mode-soy_template.js +164 -135
- data/vendor/assets/javascripts/ace/mode-space.js +8 -1
- data/vendor/assets/javascripts/ace/mode-sparql.js +13 -6
- data/vendor/assets/javascripts/ace/mode-sql.js +10 -2
- data/vendor/assets/javascripts/ace/mode-sqlserver.js +13 -5
- data/vendor/assets/javascripts/ace/mode-stylus.js +20 -10
- data/vendor/assets/javascripts/ace/mode-svg.js +27 -13
- data/vendor/assets/javascripts/ace/mode-swift.js +21 -8
- data/vendor/assets/javascripts/ace/mode-tcl.js +14 -3
- data/vendor/assets/javascripts/ace/mode-terraform.js +400 -0
- data/vendor/assets/javascripts/ace/mode-tex.js +9 -1
- data/vendor/assets/javascripts/ace/mode-text.js +8 -0
- data/vendor/assets/javascripts/ace/mode-textile.js +9 -1
- data/vendor/assets/javascripts/ace/mode-toml.js +9 -2
- data/vendor/assets/javascripts/ace/mode-tsx.js +28 -31
- data/vendor/assets/javascripts/ace/mode-turtle.js +13 -6
- data/vendor/assets/javascripts/ace/mode-twig.js +163 -134
- data/vendor/assets/javascripts/ace/mode-typescript.js +28 -31
- data/vendor/assets/javascripts/ace/mode-vala.js +14 -6
- data/vendor/assets/javascripts/ace/mode-vbscript.js +453 -17
- data/vendor/assets/javascripts/ace/mode-velocity.js +163 -133
- data/vendor/assets/javascripts/ace/mode-verilog.js +19 -5
- data/vendor/assets/javascripts/ace/mode-vhdl.js +13 -7
- data/vendor/assets/javascripts/ace/mode-visualforce.js +2640 -0
- data/vendor/assets/javascripts/ace/mode-wollok.js +17 -8
- data/vendor/assets/javascripts/ace/mode-xml.js +21 -9
- data/vendor/assets/javascripts/ace/mode-xquery.js +25 -12
- data/vendor/assets/javascripts/ace/mode-yaml.js +59 -18
- data/vendor/assets/javascripts/ace/mode-zeek.js +539 -0
- data/vendor/assets/javascripts/ace/snippets/abap.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/abc.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/actionscript.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/ada.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/alda.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/apache_conf.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/apex.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/applescript.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/aql.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/asciidoc.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/asl.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/autohotkey.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/batchfile.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/c9search.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/c_cpp.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/cirru.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/clojure.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/cobol.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/coffee.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/coldfusion.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/crystal.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/csharp.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/csound_document.js +24 -0
- data/vendor/assets/javascripts/ace/snippets/csound_orchestra.js +61 -0
- data/vendor/assets/javascripts/ace/snippets/csound_score.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/csp.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/css.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/curly.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/d.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/dart.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/diff.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/django.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/dockerfile.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/dot.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/drools.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/edifact.js +254 -0
- data/vendor/assets/javascripts/ace/snippets/eiffel.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/ejs.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/elixir.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/elm.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/erlang.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/forth.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/fortran.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/fsharp.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/fsl.js +14 -0
- data/vendor/assets/javascripts/ace/snippets/ftl.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/gcode.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/gherkin.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/gitignore.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/glsl.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/gobstones.js +1701 -24
- data/vendor/assets/javascripts/ace/snippets/golang.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/graphqlschema.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/groovy.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/haml.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/handlebars.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/haskell.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/haskell_cabal.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/haxe.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/hjson.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/html.js +36 -2
- data/vendor/assets/javascripts/ace/snippets/html_elixir.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/html_ruby.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/ini.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/io.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/jack.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/jade.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/java.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/javascript.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/json.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/json5.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/jsoniq.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/jsp.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/jssm.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/jsx.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/julia.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/kotlin.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/latex.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/less.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/liquid.js +890 -2
- data/vendor/assets/javascripts/ace/snippets/lisp.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/livescript.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/logiql.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/logtalk.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/lsl.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/lua.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/luapage.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/lucene.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/makefile.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/markdown.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/mask.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/matlab.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/maze.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/mediawiki.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/mel.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/mixal.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/mushcode.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/mysql.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/nginx.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/nim.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/nix.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/nsis.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/nunjucks.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/objectivec.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/ocaml.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/pascal.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/perl.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/perl6.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/pgsql.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/php.js +49 -36
- data/vendor/assets/javascripts/ace/snippets/php_laravel_blade.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/pig.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/plain_text.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/powershell.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/praat.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/prisma.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/prolog.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/properties.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/protobuf.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/puppet.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/python.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/qml.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/r.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/razor.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/rdoc.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/red.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/redshift.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/rhtml.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/rst.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/ruby.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/rust.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/sass.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/scad.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/scala.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/scheme.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/scss.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/sh.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/sjs.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/slim.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/smarty.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/snippets.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/soy_template.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/space.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/sparql.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/sql.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/sqlserver.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/stylus.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/svg.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/swift.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/tcl.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/terraform.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/tex.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/text.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/textile.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/toml.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/tsx.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/turtle.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/twig.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/typescript.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/vala.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/vbscript.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/velocity.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/verilog.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/vhdl.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/visualforce.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/wollok.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/xml.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/xquery.js +8 -1
- data/vendor/assets/javascripts/ace/snippets/yaml.js +8 -6
- data/vendor/assets/javascripts/ace/snippets/zeek.js +9 -0
- data/vendor/assets/javascripts/ace/theme-ambiance.js +11 -8
- data/vendor/assets/javascripts/ace/theme-chaos.js +9 -2
- data/vendor/assets/javascripts/ace/theme-chrome.js +8 -1
- data/vendor/assets/javascripts/ace/theme-clouds.js +8 -1
- data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +8 -1
- data/vendor/assets/javascripts/ace/theme-cobalt.js +8 -1
- data/vendor/assets/javascripts/ace/theme-crimson_editor.js +8 -1
- data/vendor/assets/javascripts/ace/theme-dawn.js +8 -1
- data/vendor/assets/javascripts/ace/theme-dracula.js +135 -0
- data/vendor/assets/javascripts/ace/theme-dreamweaver.js +8 -1
- data/vendor/assets/javascripts/ace/theme-eclipse.js +8 -1
- data/vendor/assets/javascripts/ace/theme-github.js +8 -1
- data/vendor/assets/javascripts/ace/theme-gob.js +8 -1
- data/vendor/assets/javascripts/ace/theme-gruvbox.js +8 -1
- data/vendor/assets/javascripts/ace/theme-idle_fingers.js +8 -1
- data/vendor/assets/javascripts/ace/theme-iplastic.js +8 -1
- data/vendor/assets/javascripts/ace/theme-katzenmilch.js +8 -1
- data/vendor/assets/javascripts/ace/theme-kr_theme.js +8 -1
- data/vendor/assets/javascripts/ace/theme-kuroir.js +8 -1
- data/vendor/assets/javascripts/ace/theme-merbivore.js +8 -1
- data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +8 -1
- data/vendor/assets/javascripts/ace/theme-mono_industrial.js +8 -1
- data/vendor/assets/javascripts/ace/theme-monokai.js +8 -1
- data/vendor/assets/javascripts/ace/theme-nord_dark.js +102 -0
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +8 -1
- data/vendor/assets/javascripts/ace/theme-solarized_dark.js +8 -1
- data/vendor/assets/javascripts/ace/theme-solarized_light.js +9 -2
- data/vendor/assets/javascripts/ace/theme-sqlserver.js +8 -1
- data/vendor/assets/javascripts/ace/theme-terminal.js +8 -1
- data/vendor/assets/javascripts/ace/theme-textmate.js +9 -1
- data/vendor/assets/javascripts/ace/theme-tomorrow.js +8 -1
- data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +8 -1
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +8 -1
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +8 -1
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +8 -1
- data/vendor/assets/javascripts/ace/theme-twilight.js +8 -1
- data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +8 -1
- data/vendor/assets/javascripts/ace/theme-xcode.js +8 -1
- data/vendor/assets/javascripts/ace/worker-base.js +1421 -0
- data/vendor/assets/javascripts/ace/worker-coffee.js +55 -742
- data/vendor/assets/javascripts/ace/worker-css.js +66 -739
- data/vendor/assets/javascripts/ace/worker-html.js +55 -738
- data/vendor/assets/javascripts/ace/worker-javascript.js +6693 -4209
- data/vendor/assets/javascripts/ace/worker-json.js +56 -737
- data/vendor/assets/javascripts/ace/worker-lua.js +56 -738
- data/vendor/assets/javascripts/ace/worker-php.js +897 -1512
- data/vendor/assets/javascripts/ace/worker-xml.js +129 -808
- data/vendor/assets/javascripts/ace/worker-xquery.js +54 -737
- metadata +74 -19
- data/vendor/assets/javascripts/ace/ext-chromevox.js +0 -540
- data/vendor/assets/javascripts/ace/ext-old_ie.js +0 -502
- data/vendor/assets/javascripts/ace/mode-bash.js +0 -247
- data/vendor/assets/javascripts/ace/mode-bro.js +0 -327
- data/vendor/assets/javascripts/ace/mode-lean.js +0 -281
- data/vendor/assets/javascripts/ace/mode-live_script.js +0 -481
- data/vendor/assets/javascripts/ace/mode-mips_assembler.js +0 -235
- data/vendor/assets/javascripts/ace/mode-swig.js +0 -1099
- data/vendor/assets/javascripts/ace/snippets/bro.js +0 -7
- data/vendor/assets/javascripts/ace/snippets/lean.js +0 -7
- data/vendor/assets/javascripts/ace/snippets/live_script.js +0 -7
- data/vendor/assets/javascripts/ace/snippets/mips_assembler.js +0 -7
- data/vendor/assets/javascripts/ace/snippets/mipsassembler.js +0 -7
- data/vendor/assets/javascripts/ace/snippets/swig.js +0 -7
@@ -1,6 +1,9 @@
|
|
1
1
|
|
2
|
-
;
|
3
|
-
|
4
|
-
|
2
|
+
; (function() {
|
3
|
+
window.require(["ace/ext/error_marker"], function(m) {
|
4
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
5
|
+
module.exports = m;
|
6
|
+
}
|
7
|
+
});
|
5
8
|
})();
|
6
9
|
|
@@ -22,7 +22,6 @@ color: black;\
|
|
22
22
|
}\
|
23
23
|
.ace_optionsMenuEntry:hover {\
|
24
24
|
background-color: rgba(100, 100, 100, 0.1);\
|
25
|
-
-webkit-transition: all 0.5s;\
|
26
25
|
transition: all 0.3s\
|
27
26
|
}\
|
28
27
|
.ace_closeButton {\
|
@@ -33,7 +32,7 @@ padding: 7px;\
|
|
33
32
|
position: absolute;\
|
34
33
|
right: -8px;\
|
35
34
|
top: -8px;\
|
36
|
-
z-index:
|
35
|
+
z-index: 100000;\
|
37
36
|
}\
|
38
37
|
.ace_closeButton{\
|
39
38
|
background: rgba(245, 146, 146, 0.9);\
|
@@ -45,56 +44,77 @@ font-weight: bold;\
|
|
45
44
|
.ace_optionsMenuCommand {\
|
46
45
|
color: darkcyan;\
|
47
46
|
font-weight: normal;\
|
47
|
+
}\
|
48
|
+
.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\
|
49
|
+
vertical-align: middle;\
|
50
|
+
}\
|
51
|
+
.ace_optionsMenuEntry button[ace_selected_button=true] {\
|
52
|
+
background: #e7e7e7;\
|
53
|
+
box-shadow: 1px 0px 2px 0px #adadad inset;\
|
54
|
+
border-color: #adadad;\
|
55
|
+
}\
|
56
|
+
.ace_optionsMenuEntry button {\
|
57
|
+
background: white;\
|
58
|
+
border: 1px solid lightgray;\
|
59
|
+
margin: 0px;\
|
60
|
+
}\
|
61
|
+
.ace_optionsMenuEntry button:hover{\
|
62
|
+
background: #f0f0f0;\
|
48
63
|
}";
|
49
64
|
dom.importCssString(cssText);
|
50
|
-
module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
|
51
|
-
top = top ? 'top: ' + top + ';' : '';
|
52
|
-
bottom = bottom ? 'bottom: ' + bottom + ';' : '';
|
53
|
-
right = right ? 'right: ' + right + ';' : '';
|
54
|
-
left = left ? 'left: ' + left + ';' : '';
|
55
65
|
|
66
|
+
module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
|
56
67
|
var closer = document.createElement('div');
|
57
|
-
var
|
68
|
+
var ignoreFocusOut = false;
|
58
69
|
|
59
70
|
function documentEscListener(e) {
|
60
71
|
if (e.keyCode === 27) {
|
61
|
-
|
72
|
+
close();
|
62
73
|
}
|
63
74
|
}
|
64
75
|
|
65
|
-
|
66
|
-
|
67
|
-
'z-index: 9990; ' +
|
68
|
-
'background-color: rgba(0, 0, 0, 0.3);';
|
69
|
-
closer.addEventListener('click', function() {
|
76
|
+
function close() {
|
77
|
+
if (!closer) return;
|
70
78
|
document.removeEventListener('keydown', documentEscListener);
|
71
79
|
closer.parentNode.removeChild(closer);
|
72
|
-
editor
|
80
|
+
if (editor) {
|
81
|
+
editor.focus();
|
82
|
+
}
|
73
83
|
closer = null;
|
84
|
+
callback && callback();
|
85
|
+
}
|
86
|
+
function setIgnoreFocusOut(ignore) {
|
87
|
+
ignoreFocusOut = ignore;
|
88
|
+
if (ignore) {
|
89
|
+
closer.style.pointerEvents = "none";
|
90
|
+
contentElement.style.pointerEvents = "auto";
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
closer.style.cssText = 'margin: 0; padding: 0; ' +
|
95
|
+
'position: fixed; top:0; bottom:0; left:0; right:0;' +
|
96
|
+
'z-index: 9990; ' +
|
97
|
+
(editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
|
98
|
+
closer.addEventListener('click', function(e) {
|
99
|
+
if (!ignoreFocusOut) {
|
100
|
+
close();
|
101
|
+
}
|
74
102
|
});
|
75
103
|
document.addEventListener('keydown', documentEscListener);
|
76
104
|
|
77
|
-
|
78
|
-
contentContainer.addEventListener('click', function(e) {
|
105
|
+
contentElement.addEventListener('click', function (e) {
|
79
106
|
e.stopPropagation();
|
80
107
|
});
|
81
108
|
|
82
|
-
|
83
|
-
wrapper.style.position = "relative";
|
84
|
-
|
85
|
-
var closeButton = dom.createElement("div");
|
86
|
-
closeButton.className = "ace_closeButton";
|
87
|
-
closeButton.addEventListener('click', function() {
|
88
|
-
closer.click();
|
89
|
-
});
|
90
|
-
|
91
|
-
wrapper.appendChild(closeButton);
|
92
|
-
contentContainer.appendChild(wrapper);
|
93
|
-
|
94
|
-
contentContainer.appendChild(contentElement);
|
95
|
-
closer.appendChild(contentContainer);
|
109
|
+
closer.appendChild(contentElement);
|
96
110
|
document.body.appendChild(closer);
|
97
|
-
editor
|
111
|
+
if (editor) {
|
112
|
+
editor.blur();
|
113
|
+
}
|
114
|
+
return {
|
115
|
+
close: close,
|
116
|
+
setIgnoreFocusOut: setIgnoreFocusOut
|
117
|
+
};
|
98
118
|
};
|
99
119
|
|
100
120
|
});
|
@@ -115,7 +135,7 @@ module.exports.getEditorKeybordShortcuts = function(editor) {
|
|
115
135
|
commands = [commands];
|
116
136
|
commands.forEach(function(command) {
|
117
137
|
if (typeof command != "string")
|
118
|
-
command = command.name
|
138
|
+
command = command.name;
|
119
139
|
if (commandMap[command]) {
|
120
140
|
commandMap[command].key += "|" + key;
|
121
141
|
} else {
|
@@ -132,7 +152,7 @@ module.exports.getEditorKeybordShortcuts = function(editor) {
|
|
132
152
|
|
133
153
|
define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"], function(require, exports, module) {
|
134
154
|
"use strict";
|
135
|
-
var Editor = require("
|
155
|
+
var Editor = require("../editor").Editor;
|
136
156
|
function showKeyboardShortcuts (editor) {
|
137
157
|
if(!document.getElementById('kbshortcutmenu')) {
|
138
158
|
var overlayPage = require('./menu_tools/overlay_page').overlayPage;
|
@@ -147,7 +167,7 @@ define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace
|
|
147
167
|
|
148
168
|
el.id = 'kbshortcutmenu';
|
149
169
|
el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
|
150
|
-
overlayPage(editor, el
|
170
|
+
overlayPage(editor, el);
|
151
171
|
}
|
152
172
|
}
|
153
173
|
module.exports.init = function(editor) {
|
@@ -163,8 +183,11 @@ define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace
|
|
163
183
|
}]);
|
164
184
|
};
|
165
185
|
|
166
|
-
});
|
167
|
-
|
168
|
-
|
186
|
+
}); (function() {
|
187
|
+
window.require(["ace/ext/keybinding_menu"], function(m) {
|
188
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
189
|
+
module.exports = m;
|
190
|
+
}
|
191
|
+
});
|
169
192
|
})();
|
170
193
|
|
@@ -1,13 +1,88 @@
|
|
1
|
-
define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/
|
1
|
+
define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/lib/dom","ace/editor"], function(require, exports, module) {
|
2
2
|
"use strict";
|
3
3
|
var oop = require("./lib/oop");
|
4
4
|
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
5
5
|
var lang = require("./lib/lang");
|
6
6
|
var Range = require("./range").Range;
|
7
|
-
var
|
7
|
+
var RangeList = require("./range_list").RangeList;
|
8
8
|
var HashHandler = require("./keyboard/hash_handler").HashHandler;
|
9
9
|
var Tokenizer = require("./tokenizer").Tokenizer;
|
10
|
-
var
|
10
|
+
var clipboard = require("./clipboard");
|
11
|
+
|
12
|
+
var VARIABLES = {
|
13
|
+
CURRENT_WORD: function(editor) {
|
14
|
+
return editor.session.getTextRange(editor.session.getWordRange());
|
15
|
+
},
|
16
|
+
SELECTION: function(editor, name, indentation) {
|
17
|
+
var text = editor.session.getTextRange();
|
18
|
+
if (indentation)
|
19
|
+
return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
|
20
|
+
return text;
|
21
|
+
},
|
22
|
+
CURRENT_LINE: function(editor) {
|
23
|
+
return editor.session.getLine(editor.getCursorPosition().row);
|
24
|
+
},
|
25
|
+
PREV_LINE: function(editor) {
|
26
|
+
return editor.session.getLine(editor.getCursorPosition().row - 1);
|
27
|
+
},
|
28
|
+
LINE_INDEX: function(editor) {
|
29
|
+
return editor.getCursorPosition().row;
|
30
|
+
},
|
31
|
+
LINE_NUMBER: function(editor) {
|
32
|
+
return editor.getCursorPosition().row + 1;
|
33
|
+
},
|
34
|
+
SOFT_TABS: function(editor) {
|
35
|
+
return editor.session.getUseSoftTabs() ? "YES" : "NO";
|
36
|
+
},
|
37
|
+
TAB_SIZE: function(editor) {
|
38
|
+
return editor.session.getTabSize();
|
39
|
+
},
|
40
|
+
CLIPBOARD: function(editor) {
|
41
|
+
return clipboard.getText && clipboard.getText();
|
42
|
+
},
|
43
|
+
FILENAME: function(editor) {
|
44
|
+
return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
|
45
|
+
},
|
46
|
+
FILENAME_BASE: function(editor) {
|
47
|
+
return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
|
48
|
+
},
|
49
|
+
DIRECTORY: function(editor) {
|
50
|
+
return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
|
51
|
+
},
|
52
|
+
FILEPATH: function(editor) { return "/not implemented.txt"; },
|
53
|
+
WORKSPACE_NAME: function() { return "Unknown"; },
|
54
|
+
FULLNAME: function() { return "Unknown"; },
|
55
|
+
BLOCK_COMMENT_START: function(editor) {
|
56
|
+
var mode = editor.session.$mode || {};
|
57
|
+
return mode.blockComment && mode.blockComment.start || "";
|
58
|
+
},
|
59
|
+
BLOCK_COMMENT_END: function(editor) {
|
60
|
+
var mode = editor.session.$mode || {};
|
61
|
+
return mode.blockComment && mode.blockComment.end || "";
|
62
|
+
},
|
63
|
+
LINE_COMMENT: function(editor) {
|
64
|
+
var mode = editor.session.$mode || {};
|
65
|
+
return mode.lineCommentStart || "";
|
66
|
+
},
|
67
|
+
CURRENT_YEAR: date.bind(null, {year: "numeric"}),
|
68
|
+
CURRENT_YEAR_SHORT: date.bind(null, {year: "2-digit"}),
|
69
|
+
CURRENT_MONTH: date.bind(null, {month: "numeric"}),
|
70
|
+
CURRENT_MONTH_NAME: date.bind(null, {month: "long"}),
|
71
|
+
CURRENT_MONTH_NAME_SHORT: date.bind(null, {month: "short"}),
|
72
|
+
CURRENT_DATE: date.bind(null, {day: "2-digit"}),
|
73
|
+
CURRENT_DAY_NAME: date.bind(null, {weekday: "long"}),
|
74
|
+
CURRENT_DAY_NAME_SHORT: date.bind(null, {weekday: "short"}),
|
75
|
+
CURRENT_HOUR: date.bind(null, {hour: "2-digit", hour12: false}),
|
76
|
+
CURRENT_MINUTE: date.bind(null, {minute: "2-digit"}),
|
77
|
+
CURRENT_SECOND: date.bind(null, {second: "2-digit"})
|
78
|
+
};
|
79
|
+
|
80
|
+
VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
|
81
|
+
|
82
|
+
function date(dateFormat) {
|
83
|
+
var str = new Date().toLocaleString("en-us", dateFormat);
|
84
|
+
return str.length == 1 ? "0" + str : str;
|
85
|
+
}
|
11
86
|
|
12
87
|
var SnippetManager = function() {
|
13
88
|
this.snippetMap = {};
|
@@ -18,41 +93,40 @@ var SnippetManager = function() {
|
|
18
93
|
oop.implement(this, EventEmitter);
|
19
94
|
|
20
95
|
this.getTokenizer = function() {
|
21
|
-
|
96
|
+
return SnippetManager.$tokenizer || this.createTokenizer();
|
97
|
+
};
|
98
|
+
|
99
|
+
this.createTokenizer = function() {
|
100
|
+
function TabstopToken(str) {
|
22
101
|
str = str.substr(1);
|
23
|
-
if (/^\d+$/.test(str)
|
102
|
+
if (/^\d+$/.test(str))
|
24
103
|
return [{tabstopId: parseInt(str, 10)}];
|
25
104
|
return [{text: str}];
|
26
105
|
}
|
27
106
|
function escape(ch) {
|
28
107
|
return "(?:[^\\\\" + ch + "]|\\\\.)";
|
29
108
|
}
|
109
|
+
var formatMatcher = {
|
110
|
+
regex: "/(" + escape("/") + "+)/",
|
111
|
+
onMatch: function(val, state, stack) {
|
112
|
+
var ts = stack[0];
|
113
|
+
ts.fmtString = true;
|
114
|
+
ts.guard = val.slice(1, -1);
|
115
|
+
ts.flag = "";
|
116
|
+
return "";
|
117
|
+
},
|
118
|
+
next: "formatString"
|
119
|
+
};
|
120
|
+
|
30
121
|
SnippetManager.$tokenizer = new Tokenizer({
|
31
122
|
start: [
|
32
|
-
{regex: /:/, onMatch: function(val, state, stack) {
|
33
|
-
if (stack.length && stack[0].expectIf) {
|
34
|
-
stack[0].expectIf = false;
|
35
|
-
stack[0].elseBranch = stack[0];
|
36
|
-
return [stack[0]];
|
37
|
-
}
|
38
|
-
return ":";
|
39
|
-
}},
|
40
123
|
{regex: /\\./, onMatch: function(val, state, stack) {
|
41
124
|
var ch = val[1];
|
42
125
|
if (ch == "}" && stack.length) {
|
43
126
|
val = ch;
|
44
|
-
}else if ("`$\\".indexOf(ch) != -1) {
|
127
|
+
} else if ("`$\\".indexOf(ch) != -1) {
|
45
128
|
val = ch;
|
46
|
-
} else if (stack.inFormatString) {
|
47
|
-
if (ch == "n")
|
48
|
-
val = "\n";
|
49
|
-
else if (ch == "t")
|
50
|
-
val = "\n";
|
51
|
-
else if ("ulULE".indexOf(ch) != -1) {
|
52
|
-
val = {changeCase: ch, local: ch > "a"};
|
53
|
-
}
|
54
129
|
}
|
55
|
-
|
56
130
|
return [val];
|
57
131
|
}},
|
58
132
|
{regex: /}/, onMatch: function(val, state, stack) {
|
@@ -60,7 +134,7 @@ var SnippetManager = function() {
|
|
60
134
|
}},
|
61
135
|
{regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken},
|
62
136
|
{regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
|
63
|
-
var t = TabstopToken(str.substr(1)
|
137
|
+
var t = TabstopToken(str.substr(1));
|
64
138
|
stack.unshift(t[0]);
|
65
139
|
return t;
|
66
140
|
}, next: "snippetVar"},
|
@@ -68,39 +142,78 @@ var SnippetManager = function() {
|
|
68
142
|
],
|
69
143
|
snippetVar: [
|
70
144
|
{regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
val = this.splitRegex.exec(val);
|
79
|
-
ts.guard = val[1];
|
80
|
-
ts.fmt = val[2];
|
81
|
-
ts.flag = val[3];
|
82
|
-
return "";
|
83
|
-
}, next: "start"},
|
84
|
-
{regex: "`" + escape("`") + "*`", onMatch: function(val, state, stack) {
|
85
|
-
stack[0].code = val.splice(1, -1);
|
86
|
-
return "";
|
87
|
-
}, next: "start"},
|
88
|
-
{regex: "\\?", onMatch: function(val, state, stack) {
|
89
|
-
if (stack[0])
|
90
|
-
stack[0].expectIf = true;
|
145
|
+
var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
|
146
|
+
return operator.length == 2 ? operator[1] : "\x00";
|
147
|
+
}).split("\x00").map(function(value){
|
148
|
+
return {value: value};
|
149
|
+
});
|
150
|
+
stack[0].choices = choices;
|
151
|
+
return [choices[0]];
|
91
152
|
}, next: "start"},
|
153
|
+
formatMatcher,
|
92
154
|
{regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
|
93
155
|
],
|
94
156
|
formatString: [
|
95
|
-
{regex:
|
96
|
-
|
97
|
-
|
157
|
+
{regex: /:/, onMatch: function(val, state, stack) {
|
158
|
+
if (stack.length && stack[0].expectElse) {
|
159
|
+
stack[0].expectElse = false;
|
160
|
+
stack[0].ifEnd = {elseEnd: stack[0]};
|
161
|
+
return [stack[0].ifEnd];
|
162
|
+
}
|
163
|
+
return ":";
|
164
|
+
}},
|
165
|
+
{regex: /\\./, onMatch: function(val, state, stack) {
|
166
|
+
var ch = val[1];
|
167
|
+
if (ch == "}" && stack.length)
|
168
|
+
val = ch;
|
169
|
+
else if ("`$\\".indexOf(ch) != -1)
|
170
|
+
val = ch;
|
171
|
+
else if (ch == "n")
|
172
|
+
val = "\n";
|
173
|
+
else if (ch == "t")
|
174
|
+
val = "\t";
|
175
|
+
else if ("ulULE".indexOf(ch) != -1)
|
176
|
+
val = {changeCase: ch, local: ch > "a"};
|
177
|
+
return [val];
|
178
|
+
}},
|
179
|
+
{regex: "/\\w*}", onMatch: function(val, state, stack) {
|
180
|
+
var next = stack.shift();
|
181
|
+
if (next)
|
182
|
+
next.flag = val.slice(1, -1);
|
183
|
+
this.next = next && next.tabstopId ? "start" : "";
|
184
|
+
return [next || val];
|
185
|
+
}, next: "start"},
|
186
|
+
{regex: /\$(?:\d+|\w+)/, onMatch: function(val, state, stack) {
|
187
|
+
return [{text: val.slice(1)}];
|
188
|
+
}},
|
189
|
+
{regex: /\${\w+/, onMatch: function(val, state, stack) {
|
190
|
+
var token = {text: val.slice(2)};
|
191
|
+
stack.unshift(token);
|
192
|
+
return [token];
|
193
|
+
}, next: "formatStringVar"},
|
194
|
+
{regex: /\n/, token: "newline", merge: false},
|
195
|
+
{regex: /}/, onMatch: function(val, state, stack) {
|
196
|
+
var next = stack.shift();
|
197
|
+
this.next = next && next.tabstopId ? "start" : "";
|
198
|
+
return [next || val];
|
98
199
|
}, next: "start"}
|
200
|
+
],
|
201
|
+
formatStringVar: [
|
202
|
+
{regex: /:\/\w+}/, onMatch: function(val, state, stack) {
|
203
|
+
var ts = stack[0];
|
204
|
+
ts.formatFunction = val.slice(2, -1);
|
205
|
+
return [stack.shift()];
|
206
|
+
}, next: "formatString"},
|
207
|
+
formatMatcher,
|
208
|
+
{regex: /:[\?\-+]?/, onMatch: function(val, state, stack) {
|
209
|
+
if (val[1] == "+")
|
210
|
+
stack[0].ifEnd = stack[0];
|
211
|
+
if (val[1] == "?")
|
212
|
+
stack[0].expectElse = true;
|
213
|
+
}, next: "formatString"},
|
214
|
+
{regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString"}
|
99
215
|
]
|
100
216
|
});
|
101
|
-
SnippetManager.prototype.getTokenizer = function() {
|
102
|
-
return SnippetManager.$tokenizer;
|
103
|
-
};
|
104
217
|
return SnippetManager.$tokenizer;
|
105
218
|
};
|
106
219
|
|
@@ -109,59 +222,33 @@ var SnippetManager = function() {
|
|
109
222
|
return x.value || x;
|
110
223
|
});
|
111
224
|
};
|
112
|
-
|
113
|
-
this
|
114
|
-
if (
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
return (this.variables.__ || {})[name];
|
120
|
-
}
|
225
|
+
|
226
|
+
this.getVariableValue = function(editor, name, indentation) {
|
227
|
+
if (/^\d+$/.test(name))
|
228
|
+
return (this.variables.__ || {})[name] || "";
|
229
|
+
if (/^[A-Z]\d+$/.test(name))
|
230
|
+
return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
|
231
|
+
|
121
232
|
name = name.replace(/^TM_/, "");
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
var r = s.getWordRange();
|
129
|
-
case "SELECTION":
|
130
|
-
case "SELECTED_TEXT":
|
131
|
-
return s.getTextRange(r);
|
132
|
-
case "CURRENT_LINE":
|
133
|
-
return s.getLine(editor.getCursorPosition().row);
|
134
|
-
case "PREV_LINE": // not possible in textmate
|
135
|
-
return s.getLine(editor.getCursorPosition().row - 1);
|
136
|
-
case "LINE_INDEX":
|
137
|
-
return editor.getCursorPosition().column;
|
138
|
-
case "LINE_NUMBER":
|
139
|
-
return editor.getCursorPosition().row + 1;
|
140
|
-
case "SOFT_TABS":
|
141
|
-
return s.getUseSoftTabs() ? "YES" : "NO";
|
142
|
-
case "TAB_SIZE":
|
143
|
-
return s.getTabSize();
|
144
|
-
case "FILENAME":
|
145
|
-
case "FILEPATH":
|
146
|
-
return "";
|
147
|
-
case "FULLNAME":
|
148
|
-
return "Ace";
|
149
|
-
}
|
150
|
-
};
|
151
|
-
this.variables = {};
|
152
|
-
this.getVariableValue = function(editor, varName) {
|
153
|
-
if (this.variables.hasOwnProperty(varName))
|
154
|
-
return this.variables[varName](editor, varName) || "";
|
155
|
-
return this.$getDefaultValue(editor, varName) || "";
|
233
|
+
if (!this.variables.hasOwnProperty(name))
|
234
|
+
return "";
|
235
|
+
var value = this.variables[name];
|
236
|
+
if (typeof value == "function")
|
237
|
+
value = this.variables[name](editor, name, indentation);
|
238
|
+
return value == null ? "" : value;
|
156
239
|
};
|
240
|
+
|
241
|
+
this.variables = VARIABLES;
|
157
242
|
this.tmStrFormat = function(str, ch, editor) {
|
243
|
+
if (!ch.fmt) return str;
|
158
244
|
var flag = ch.flag || "";
|
159
245
|
var re = ch.guard;
|
160
|
-
re = new RegExp(re, flag.replace(/[^
|
161
|
-
var fmtTokens = this.tokenizeTmSnippet(ch.fmt, "formatString");
|
246
|
+
re = new RegExp(re, flag.replace(/[^gim]/g, ""));
|
247
|
+
var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
|
162
248
|
var _self = this;
|
163
249
|
var formatted = str.replace(re, function() {
|
164
|
-
_self.variables.__
|
250
|
+
var oldArgs = _self.variables.__;
|
251
|
+
_self.variables.__ = [].slice.call(arguments);
|
165
252
|
var fmtParts = _self.resolveVariables(fmtTokens, editor);
|
166
253
|
var gChangeCase = "E";
|
167
254
|
for (var i = 0; i < fmtParts.length; i++) {
|
@@ -186,40 +273,63 @@ var SnippetManager = function() {
|
|
186
273
|
fmtParts[i] = ch.toLowerCase();
|
187
274
|
}
|
188
275
|
}
|
276
|
+
_self.variables.__ = oldArgs;
|
189
277
|
return fmtParts.join("");
|
190
278
|
});
|
191
|
-
this.variables.__ = null;
|
192
279
|
return formatted;
|
193
280
|
};
|
281
|
+
|
282
|
+
this.tmFormatFunction = function(str, ch, editor) {
|
283
|
+
if (ch.formatFunction == "upcase")
|
284
|
+
return str.toUpperCase();
|
285
|
+
if (ch.formatFunction == "downcase")
|
286
|
+
return str.toLowerCase();
|
287
|
+
return str;
|
288
|
+
};
|
194
289
|
|
195
290
|
this.resolveVariables = function(snippet, editor) {
|
196
291
|
var result = [];
|
292
|
+
var indentation = "";
|
293
|
+
var afterNewLine = true;
|
197
294
|
for (var i = 0; i < snippet.length; i++) {
|
198
295
|
var ch = snippet[i];
|
199
296
|
if (typeof ch == "string") {
|
200
297
|
result.push(ch);
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
298
|
+
if (ch == "\n") {
|
299
|
+
afterNewLine = true;
|
300
|
+
indentation = "";
|
301
|
+
}
|
302
|
+
else if (afterNewLine) {
|
303
|
+
indentation = /^\t*/.exec(ch)[0];
|
304
|
+
afterNewLine = /\S/.test(ch);
|
305
|
+
}
|
206
306
|
continue;
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
307
|
+
}
|
308
|
+
if (!ch) continue;
|
309
|
+
afterNewLine = false;
|
310
|
+
|
311
|
+
if (ch.fmtString) {
|
312
|
+
var j = snippet.indexOf(ch, i + 1);
|
313
|
+
if (j == -1) j = snippet.length;
|
314
|
+
ch.fmt = snippet.slice(i + 1, j);
|
315
|
+
i = j;
|
316
|
+
}
|
317
|
+
|
318
|
+
if (ch.text) {
|
319
|
+
var value = this.getVariableValue(editor, ch.text, indentation) + "";
|
320
|
+
if (ch.fmtString)
|
321
|
+
value = this.tmStrFormat(value, ch, editor);
|
322
|
+
if (ch.formatFunction)
|
323
|
+
value = this.tmFormatFunction(value, ch, editor);
|
324
|
+
|
325
|
+
if (value && !ch.ifEnd) {
|
326
|
+
result.push(value);
|
327
|
+
gotoNext(ch);
|
328
|
+
} else if (!value && ch.ifEnd) {
|
329
|
+
gotoNext(ch.ifEnd);
|
222
330
|
}
|
331
|
+
} else if (ch.elseEnd) {
|
332
|
+
gotoNext(ch.elseEnd);
|
223
333
|
} else if (ch.tabstopId != null) {
|
224
334
|
result.push(ch);
|
225
335
|
} else if (ch.changeCase != null) {
|
@@ -263,23 +373,26 @@ var SnippetManager = function() {
|
|
263
373
|
ts = tabstops[id] = [];
|
264
374
|
ts.index = id;
|
265
375
|
ts.value = "";
|
376
|
+
ts.parents = {};
|
266
377
|
}
|
267
378
|
if (ts.indexOf(p) !== -1)
|
268
379
|
return;
|
380
|
+
if (p.choices && !ts.choices)
|
381
|
+
ts.choices = p.choices;
|
269
382
|
ts.push(p);
|
270
383
|
var i1 = tokens.indexOf(p, i + 1);
|
271
384
|
if (i1 === -1)
|
272
385
|
return;
|
273
386
|
|
274
387
|
var value = tokens.slice(i + 1, i1);
|
275
|
-
var isNested = value.some(function(t) {return typeof t === "object"});
|
388
|
+
var isNested = value.some(function(t) {return typeof t === "object";});
|
276
389
|
if (isNested && !ts.value) {
|
277
390
|
ts.value = value;
|
278
391
|
} else if (value.length && (!ts.value || typeof ts.value !== "string")) {
|
279
392
|
ts.value = value.join("");
|
280
393
|
}
|
281
394
|
});
|
282
|
-
tabstops.forEach(function(ts) {ts.length = 0});
|
395
|
+
tabstops.forEach(function(ts) {ts.length = 0;});
|
283
396
|
var expanding = {};
|
284
397
|
function copyValue(val) {
|
285
398
|
var copy = [];
|
@@ -300,19 +413,24 @@ var SnippetManager = function() {
|
|
300
413
|
if (typeof p != "object")
|
301
414
|
continue;
|
302
415
|
var id = p.tabstopId;
|
416
|
+
var ts = tabstops[id];
|
303
417
|
var i1 = tokens.indexOf(p, i + 1);
|
304
418
|
if (expanding[id]) {
|
305
|
-
if (expanding[id] === p)
|
306
|
-
expanding[id]
|
419
|
+
if (expanding[id] === p) {
|
420
|
+
delete expanding[id];
|
421
|
+
Object.keys(expanding).forEach(function(parentId) {
|
422
|
+
ts.parents[parentId] = true;
|
423
|
+
});
|
424
|
+
}
|
307
425
|
continue;
|
308
426
|
}
|
309
|
-
|
310
|
-
var ts = tabstops[id];
|
311
|
-
var arg = typeof ts.value == "string" ? [ts.value] : copyValue(ts.value);
|
312
|
-
arg.unshift(i + 1, Math.max(0, i1 - i));
|
313
|
-
arg.push(p);
|
314
427
|
expanding[id] = p;
|
315
|
-
|
428
|
+
var value = ts.value;
|
429
|
+
if (typeof value !== "string")
|
430
|
+
value = copyValue(value);
|
431
|
+
else if (p.fmt)
|
432
|
+
value = this.tmStrFormat(value, p, editor);
|
433
|
+
tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
|
316
434
|
|
317
435
|
if (ts.indexOf(p) === -1)
|
318
436
|
ts.push(p);
|
@@ -328,7 +446,7 @@ var SnippetManager = function() {
|
|
328
446
|
} else
|
329
447
|
column += t.length;
|
330
448
|
text += t;
|
331
|
-
} else {
|
449
|
+
} else if (t) {
|
332
450
|
if (!t.start)
|
333
451
|
t.start = {row: row, column: column};
|
334
452
|
else
|
@@ -499,6 +617,12 @@ var SnippetManager = function() {
|
|
499
617
|
}
|
500
618
|
snippetMap[scope].push(s);
|
501
619
|
|
620
|
+
if (s.prefix)
|
621
|
+
s.tabTrigger = s.prefix;
|
622
|
+
|
623
|
+
if (!s.content && s.body)
|
624
|
+
s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
|
625
|
+
|
502
626
|
if (s.tabTrigger && !s.trigger) {
|
503
627
|
if (!s.guard && /^\w/.test(s.tabTrigger))
|
504
628
|
s.guard = "\\b";
|
@@ -509,16 +633,19 @@ var SnippetManager = function() {
|
|
509
633
|
return;
|
510
634
|
|
511
635
|
s.startRe = guardedRegexp(s.trigger, s.guard, true);
|
512
|
-
s.triggerRe = new RegExp(s.trigger
|
636
|
+
s.triggerRe = new RegExp(s.trigger);
|
513
637
|
|
514
638
|
s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
|
515
|
-
s.endTriggerRe = new RegExp(s.endTrigger
|
639
|
+
s.endTriggerRe = new RegExp(s.endTrigger);
|
516
640
|
}
|
517
641
|
|
518
|
-
if (snippets
|
519
|
-
addSnippet(snippets);
|
520
|
-
else if (Array.isArray(snippets))
|
642
|
+
if (Array.isArray(snippets)) {
|
521
643
|
snippets.forEach(addSnippet);
|
644
|
+
} else {
|
645
|
+
Object.keys(snippets).forEach(function(key) {
|
646
|
+
addSnippet(snippets[key]);
|
647
|
+
});
|
648
|
+
}
|
522
649
|
|
523
650
|
this._signal("registerSnippets", {scope: scope});
|
524
651
|
};
|
@@ -568,7 +695,7 @@ var SnippetManager = function() {
|
|
568
695
|
snippet.tabTrigger = val.match(/^\S*/)[0];
|
569
696
|
if (!snippet.name)
|
570
697
|
snippet.name = val;
|
571
|
-
} else {
|
698
|
+
} else if (key) {
|
572
699
|
snippet[key] = val;
|
573
700
|
}
|
574
701
|
}
|
@@ -630,66 +757,44 @@ var TabstopManager = function(editor) {
|
|
630
757
|
};
|
631
758
|
|
632
759
|
this.onChange = function(delta) {
|
633
|
-
var changeRange = delta;
|
634
760
|
var isRemove = delta.action[0] == "r";
|
635
|
-
var
|
636
|
-
var
|
637
|
-
var
|
638
|
-
var
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
return this.detach();
|
653
|
-
}
|
654
|
-
var ranges = this.ranges;
|
655
|
-
for (var i = 0; i < ranges.length; i++) {
|
656
|
-
var r = ranges[i];
|
657
|
-
if (r.end.row < start.row)
|
658
|
-
continue;
|
659
|
-
|
660
|
-
if (isRemove && comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
|
661
|
-
this.removeRange(r);
|
662
|
-
i--;
|
663
|
-
continue;
|
761
|
+
var selectedTabstop = this.selectedTabstop || {};
|
762
|
+
var parents = selectedTabstop.parents || {};
|
763
|
+
var tabstops = (this.tabstops || []).slice();
|
764
|
+
for (var i = 0; i < tabstops.length; i++) {
|
765
|
+
var ts = tabstops[i];
|
766
|
+
var active = ts == selectedTabstop || parents[ts.index];
|
767
|
+
ts.rangeList.$bias = active ? 0 : 1;
|
768
|
+
|
769
|
+
if (delta.action == "remove" && ts !== selectedTabstop) {
|
770
|
+
var parentActive = ts.parents && ts.parents[selectedTabstop.index];
|
771
|
+
var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
|
772
|
+
startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
|
773
|
+
var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
|
774
|
+
endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
|
775
|
+
var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
|
776
|
+
for (var j = 0; j < toRemove.length; j++)
|
777
|
+
this.removeRange(toRemove[j]);
|
664
778
|
}
|
665
|
-
|
666
|
-
if (r.start.row == startRow && r.start.column > start.column)
|
667
|
-
r.start.column += colDiff;
|
668
|
-
if (r.end.row == startRow && r.end.column >= start.column)
|
669
|
-
r.end.column += colDiff;
|
670
|
-
if (r.start.row >= startRow)
|
671
|
-
r.start.row += lineDif;
|
672
|
-
if (r.end.row >= startRow)
|
673
|
-
r.end.row += lineDif;
|
674
|
-
|
675
|
-
if (comparePoints(r.start, r.end) > 0)
|
676
|
-
this.removeRange(r);
|
779
|
+
ts.rangeList.$onChange(delta);
|
677
780
|
}
|
678
|
-
|
781
|
+
var session = this.editor.session;
|
782
|
+
if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
|
679
783
|
this.detach();
|
680
784
|
};
|
681
785
|
this.updateLinkedFields = function() {
|
682
786
|
var ts = this.selectedTabstop;
|
683
|
-
if (!ts || !ts.hasLinkedRanges)
|
787
|
+
if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
|
684
788
|
return;
|
685
789
|
this.$inChange = true;
|
686
790
|
var session = this.editor.session;
|
687
791
|
var text = session.getTextRange(ts.firstNonLinked);
|
688
|
-
for (var i = ts.length; i
|
792
|
+
for (var i = 0; i < ts.length; i++) {
|
689
793
|
var range = ts[i];
|
690
794
|
if (!range.linked)
|
691
795
|
continue;
|
692
|
-
var
|
796
|
+
var original = range.original;
|
797
|
+
var fmt = exports.snippetManager.tmStrFormat(text, original, this.editor);
|
693
798
|
session.replace(range, fmt);
|
694
799
|
}
|
695
800
|
this.$inChange = false;
|
@@ -704,7 +809,7 @@ var TabstopManager = function(editor) {
|
|
704
809
|
var lead = this.editor.selection.lead;
|
705
810
|
var anchor = this.editor.selection.anchor;
|
706
811
|
var isEmpty = this.editor.selection.isEmpty();
|
707
|
-
for (var i = this.ranges.length; i
|
812
|
+
for (var i = 0; i < this.ranges.length; i++) {
|
708
813
|
if (this.ranges[i].linked)
|
709
814
|
continue;
|
710
815
|
var containsLead = this.ranges[i].contains(lead.row, lead.column);
|
@@ -738,23 +843,27 @@ var TabstopManager = function(editor) {
|
|
738
843
|
return;
|
739
844
|
|
740
845
|
this.selectedTabstop = ts;
|
741
|
-
|
846
|
+
var range = ts.firstNonLinked || ts;
|
847
|
+
if (ts.choices) range.cursor = range.start;
|
848
|
+
if (!this.editor.inVirtualSelectionMode) {
|
742
849
|
var sel = this.editor.multiSelect;
|
743
|
-
sel.toSingleRange(
|
744
|
-
for (var i = ts.length; i
|
850
|
+
sel.toSingleRange(range);
|
851
|
+
for (var i = 0; i < ts.length; i++) {
|
745
852
|
if (ts.hasLinkedRanges && ts[i].linked)
|
746
853
|
continue;
|
747
854
|
sel.addRange(ts[i].clone(), true);
|
748
855
|
}
|
749
|
-
if (sel.ranges[0])
|
750
|
-
sel.addRange(sel.ranges[0].clone());
|
751
856
|
} else {
|
752
|
-
this.editor.selection.
|
857
|
+
this.editor.selection.fromOrientedRange(range);
|
753
858
|
}
|
754
859
|
|
755
860
|
this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
861
|
+
if (this.selectedTabstop && this.selectedTabstop.choices)
|
862
|
+
this.editor.execCommand("startAutocomplete", {matches: this.selectedTabstop.choices});
|
756
863
|
};
|
757
864
|
this.addTabstops = function(tabstops, start, end) {
|
865
|
+
var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
|
866
|
+
|
758
867
|
if (!this.$openTabstops)
|
759
868
|
this.$openTabstops = [];
|
760
869
|
if (!tabstops[0]) {
|
@@ -770,8 +879,8 @@ var TabstopManager = function(editor) {
|
|
770
879
|
var ranges = this.ranges;
|
771
880
|
tabstops.forEach(function(ts, index) {
|
772
881
|
var dest = this.$openTabstops[index] || ts;
|
773
|
-
|
774
|
-
for (var i = ts.length; i
|
882
|
+
|
883
|
+
for (var i = 0; i < ts.length; i++) {
|
775
884
|
var p = ts[i];
|
776
885
|
var range = Range.fromPoints(p.start, p.end || p.start);
|
777
886
|
movePoint(range.start, start);
|
@@ -783,7 +892,7 @@ var TabstopManager = function(editor) {
|
|
783
892
|
dest.unshift(range);
|
784
893
|
else
|
785
894
|
dest[i] = range;
|
786
|
-
if (p.fmtString) {
|
895
|
+
if (p.fmtString || (dest.firstNonLinked && useLink)) {
|
787
896
|
range.linked = true;
|
788
897
|
dest.hasLinkedRanges = true;
|
789
898
|
} else if (!dest.firstNonLinked)
|
@@ -796,6 +905,9 @@ var TabstopManager = function(editor) {
|
|
796
905
|
this.$openTabstops[index] = dest;
|
797
906
|
}
|
798
907
|
this.addTabstopMarkers(dest);
|
908
|
+
dest.rangeList = dest.rangeList || new RangeList();
|
909
|
+
dest.rangeList.$bias = 0;
|
910
|
+
dest.rangeList.addList(dest);
|
799
911
|
}, this);
|
800
912
|
|
801
913
|
if (arg.length > 2) {
|
@@ -821,9 +933,11 @@ var TabstopManager = function(editor) {
|
|
821
933
|
};
|
822
934
|
this.removeRange = function(range) {
|
823
935
|
var i = range.tabstop.indexOf(range);
|
824
|
-
range.tabstop.splice(i, 1);
|
936
|
+
if (i != -1) range.tabstop.splice(i, 1);
|
825
937
|
i = this.ranges.indexOf(range);
|
826
|
-
this.ranges.splice(i, 1);
|
938
|
+
if (i != -1) this.ranges.splice(i, 1);
|
939
|
+
i = range.tabstop.rangeList.ranges.indexOf(range);
|
940
|
+
if (i != -1) range.tabstop.splice(i, 1);
|
827
941
|
this.editor.session.removeMarker(range.markerId);
|
828
942
|
if (!range.tabstop.length) {
|
829
943
|
i = this.tabstops.indexOf(range.tabstop);
|
@@ -836,39 +950,24 @@ var TabstopManager = function(editor) {
|
|
836
950
|
|
837
951
|
this.keyboardHandler = new HashHandler();
|
838
952
|
this.keyboardHandler.bindKeys({
|
839
|
-
"Tab": function(
|
840
|
-
if (exports.snippetManager && exports.snippetManager.expandWithTab(
|
953
|
+
"Tab": function(editor) {
|
954
|
+
if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
|
841
955
|
return;
|
842
|
-
|
843
|
-
|
844
|
-
ed.tabstopManager.tabNext(1);
|
845
|
-
},
|
846
|
-
"Shift-Tab": function(ed) {
|
847
|
-
ed.tabstopManager.tabNext(-1);
|
956
|
+
editor.tabstopManager.tabNext(1);
|
957
|
+
editor.renderer.scrollCursorIntoView();
|
848
958
|
},
|
849
|
-
"
|
850
|
-
|
959
|
+
"Shift-Tab": function(editor) {
|
960
|
+
editor.tabstopManager.tabNext(-1);
|
961
|
+
editor.renderer.scrollCursorIntoView();
|
851
962
|
},
|
852
|
-
"
|
853
|
-
|
963
|
+
"Esc": function(editor) {
|
964
|
+
editor.tabstopManager.detach();
|
854
965
|
}
|
855
966
|
});
|
856
967
|
}).call(TabstopManager.prototype);
|
857
968
|
|
858
969
|
|
859
970
|
|
860
|
-
var changeTracker = {};
|
861
|
-
changeTracker.onChange = Anchor.prototype.onChange;
|
862
|
-
changeTracker.setPosition = function(row, column) {
|
863
|
-
this.pos.row = row;
|
864
|
-
this.pos.column = column;
|
865
|
-
};
|
866
|
-
changeTracker.update = function(pos, delta, $insertRight) {
|
867
|
-
this.$insertRight = $insertRight;
|
868
|
-
this.pos = pos;
|
869
|
-
this.onChange(delta);
|
870
|
-
};
|
871
|
-
|
872
971
|
var movePoint = function(point, diff) {
|
873
972
|
if (point.row == 0)
|
874
973
|
point.column += diff.column;
|
@@ -928,7 +1027,7 @@ var $singleLineEditor = function(el) {
|
|
928
1027
|
editor.renderer.setShowGutter(false);
|
929
1028
|
editor.renderer.setHighlightGutterLine(false);
|
930
1029
|
|
931
|
-
editor.$mouseHandler.$
|
1030
|
+
editor.$mouseHandler.$focusTimeout = 0;
|
932
1031
|
editor.$highlightTagPending = true;
|
933
1032
|
|
934
1033
|
return editor;
|
@@ -1012,15 +1111,13 @@ var AcePopup = function(parentNode) {
|
|
1012
1111
|
var row = popup.getRow();
|
1013
1112
|
var t = popup.renderer.$textLayer;
|
1014
1113
|
var selected = t.element.childNodes[row - t.config.firstRow];
|
1015
|
-
if (selected
|
1016
|
-
return;
|
1017
|
-
if (t.selectedNode)
|
1114
|
+
if (selected !== t.selectedNode && t.selectedNode)
|
1018
1115
|
dom.removeCssClass(t.selectedNode, "ace_selected");
|
1019
1116
|
t.selectedNode = selected;
|
1020
1117
|
if (selected)
|
1021
1118
|
dom.addCssClass(selected, "ace_selected");
|
1022
1119
|
});
|
1023
|
-
var hideHoverMarker = function() { setHoverMarker(-1) };
|
1120
|
+
var hideHoverMarker = function() { setHoverMarker(-1); };
|
1024
1121
|
var setHoverMarker = function(row, suppressRedraw) {
|
1025
1122
|
if (row !== hoverMarker.start.row) {
|
1026
1123
|
hoverMarker.start.row = hoverMarker.end.row = row;
|
@@ -1055,30 +1152,37 @@ var AcePopup = function(parentNode) {
|
|
1055
1152
|
return tokens;
|
1056
1153
|
if (typeof data == "string")
|
1057
1154
|
data = {value: data};
|
1058
|
-
|
1059
|
-
data.caption = data.value || data.name;
|
1060
|
-
|
1061
|
-
var last = -1;
|
1062
|
-
var flag, c;
|
1063
|
-
for (var i = 0; i < data.caption.length; i++) {
|
1064
|
-
c = data.caption[i];
|
1065
|
-
flag = data.matchMask & (1 << i) ? 1 : 0;
|
1066
|
-
if (last !== flag) {
|
1067
|
-
tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c});
|
1068
|
-
last = flag;
|
1069
|
-
} else {
|
1070
|
-
tokens[tokens.length - 1].value += c;
|
1071
|
-
}
|
1072
|
-
}
|
1155
|
+
var caption = data.caption || data.value || data.name;
|
1073
1156
|
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1157
|
+
function addToken(value, className) {
|
1158
|
+
value && tokens.push({
|
1159
|
+
type: (data.className || "") + (className || ""),
|
1160
|
+
value: value
|
1161
|
+
});
|
1162
|
+
}
|
1163
|
+
|
1164
|
+
var lower = caption.toLowerCase();
|
1165
|
+
var filterText = (popup.filterText || "").toLowerCase();
|
1166
|
+
var lastIndex = 0;
|
1167
|
+
var lastI = 0;
|
1168
|
+
for (var i = 0; i <= filterText.length; i++) {
|
1169
|
+
if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
|
1170
|
+
var sub = filterText.slice(lastI, i);
|
1171
|
+
lastI = i;
|
1172
|
+
var index = lower.indexOf(sub, lastIndex);
|
1173
|
+
if (index == -1) continue;
|
1174
|
+
addToken(caption.slice(lastIndex, index), "");
|
1175
|
+
lastIndex = index + sub.length;
|
1176
|
+
addToken(caption.slice(index, lastIndex), "completion-highlight");
|
1079
1177
|
}
|
1080
|
-
tokens.push({type: "rightAlignedText", value: metaData});
|
1081
1178
|
}
|
1179
|
+
addToken(caption.slice(lastIndex, caption.length), "");
|
1180
|
+
|
1181
|
+
if (data.meta)
|
1182
|
+
tokens.push({type: "completion-meta", value: data.meta});
|
1183
|
+
if (data.message)
|
1184
|
+
tokens.push({type: "completion-message", value: data.message});
|
1185
|
+
|
1082
1186
|
return tokens;
|
1083
1187
|
};
|
1084
1188
|
bgTokenizer.$updateOnChange = noop;
|
@@ -1087,14 +1191,14 @@ var AcePopup = function(parentNode) {
|
|
1087
1191
|
popup.session.$computeWidth = function() {
|
1088
1192
|
return this.screenWidth = 0;
|
1089
1193
|
};
|
1090
|
-
|
1091
|
-
popup.$blockScrolling = Infinity;
|
1092
1194
|
popup.isOpen = false;
|
1093
1195
|
popup.isTopdown = false;
|
1094
1196
|
popup.autoSelect = true;
|
1197
|
+
popup.filterText = "";
|
1095
1198
|
|
1096
1199
|
popup.data = [];
|
1097
|
-
popup.setData = function(list) {
|
1200
|
+
popup.setData = function(list, filterText) {
|
1201
|
+
popup.filterText = filterText || "";
|
1098
1202
|
popup.setValue(lang.stringRepeat("\n", list.length), -1);
|
1099
1203
|
popup.data = list || [];
|
1100
1204
|
popup.setRow(0);
|
@@ -1151,7 +1255,6 @@ var AcePopup = function(parentNode) {
|
|
1151
1255
|
}
|
1152
1256
|
|
1153
1257
|
el.style.display = "";
|
1154
|
-
this.renderer.$textLayer.checkForSizeChanges();
|
1155
1258
|
|
1156
1259
|
var left = pos.left;
|
1157
1260
|
if (left + el.offsetWidth > screenWidth)
|
@@ -1164,6 +1267,21 @@ var AcePopup = function(parentNode) {
|
|
1164
1267
|
popup.isOpen = true;
|
1165
1268
|
};
|
1166
1269
|
|
1270
|
+
popup.goTo = function(where) {
|
1271
|
+
var row = this.getRow();
|
1272
|
+
var max = this.session.getLength() - 1;
|
1273
|
+
|
1274
|
+
switch(where) {
|
1275
|
+
case "up": row = row <= 0 ? max : row - 1; break;
|
1276
|
+
case "down": row = row >= max ? -1 : row + 1; break;
|
1277
|
+
case "start": row = 0; break;
|
1278
|
+
case "end": row = max; break;
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
this.setRow(row);
|
1282
|
+
};
|
1283
|
+
|
1284
|
+
|
1167
1285
|
popup.getTextLeftOffset = function() {
|
1168
1286
|
return this.$borderSize + this.renderer.$padding + this.$imageSize;
|
1169
1287
|
};
|
@@ -1179,45 +1297,53 @@ dom.importCssString("\
|
|
1179
1297
|
background-color: #CAD6FA;\
|
1180
1298
|
z-index: 1;\
|
1181
1299
|
}\
|
1300
|
+
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
|
1301
|
+
background-color: #3a674e;\
|
1302
|
+
}\
|
1182
1303
|
.ace_editor.ace_autocomplete .ace_line-hover {\
|
1183
1304
|
border: 1px solid #abbffe;\
|
1184
1305
|
margin-top: -1px;\
|
1185
1306
|
background: rgba(233,233,253,0.4);\
|
1186
|
-
}\
|
1187
|
-
.ace_editor.ace_autocomplete .ace_line-hover {\
|
1188
1307
|
position: absolute;\
|
1189
1308
|
z-index: 2;\
|
1190
1309
|
}\
|
1191
|
-
.ace_editor.ace_autocomplete .
|
1192
|
-
|
1193
|
-
|
1194
|
-
box-shadow: none;\
|
1310
|
+
.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\
|
1311
|
+
border: 1px solid rgba(109, 150, 13, 0.8);\
|
1312
|
+
background: rgba(58, 103, 78, 0.62);\
|
1195
1313
|
}\
|
1196
|
-
.
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
z-index: -1;\
|
1314
|
+
.ace_completion-meta {\
|
1315
|
+
opacity: 0.5;\
|
1316
|
+
margin: 0.9em;\
|
1317
|
+
}\
|
1318
|
+
.ace_completion-message {\
|
1319
|
+
color: blue;\
|
1203
1320
|
}\
|
1204
1321
|
.ace_editor.ace_autocomplete .ace_completion-highlight{\
|
1205
|
-
color: #
|
1206
|
-
|
1322
|
+
color: #2d69c7;\
|
1323
|
+
}\
|
1324
|
+
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\
|
1325
|
+
color: #93ca12;\
|
1207
1326
|
}\
|
1208
1327
|
.ace_editor.ace_autocomplete {\
|
1209
|
-
width:
|
1328
|
+
width: 300px;\
|
1210
1329
|
z-index: 200000;\
|
1211
|
-
background: #fbfbfb;\
|
1212
|
-
color: #444;\
|
1213
1330
|
border: 1px lightgray solid;\
|
1214
1331
|
position: fixed;\
|
1215
1332
|
box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
|
1216
1333
|
line-height: 1.4;\
|
1217
|
-
|
1334
|
+
background: #fefefe;\
|
1335
|
+
color: #111;\
|
1336
|
+
}\
|
1337
|
+
.ace_dark.ace_editor.ace_autocomplete {\
|
1338
|
+
border: 1px #484747 solid;\
|
1339
|
+
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\
|
1340
|
+
line-height: 1.4;\
|
1341
|
+
background: #25282c;\
|
1342
|
+
color: #c1c1c1;\
|
1343
|
+
}", "autocompletion.css");
|
1218
1344
|
|
1219
1345
|
exports.AcePopup = AcePopup;
|
1220
|
-
|
1346
|
+
exports.$singleLineEditor = $singleLineEditor;
|
1221
1347
|
});
|
1222
1348
|
|
1223
1349
|
define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module) {
|
@@ -1237,7 +1363,7 @@ exports.parForEach = function(array, fn, callback) {
|
|
1237
1363
|
}
|
1238
1364
|
};
|
1239
1365
|
|
1240
|
-
var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
|
1366
|
+
var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
|
1241
1367
|
|
1242
1368
|
exports.retrievePrecedingIdentifier = function(text, pos, regex) {
|
1243
1369
|
regex = regex || ID_REGEX;
|
@@ -1280,16 +1406,16 @@ exports.getCompletionPrefix = function (editor) {
|
|
1280
1406
|
|
1281
1407
|
});
|
1282
1408
|
|
1283
|
-
define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/
|
1409
|
+
define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"], function(require, exports, module) {
|
1284
1410
|
"use strict";
|
1285
1411
|
|
1286
1412
|
var HashHandler = require("./keyboard/hash_handler").HashHandler;
|
1287
1413
|
var AcePopup = require("./autocomplete/popup").AcePopup;
|
1288
1414
|
var util = require("./autocomplete/util");
|
1289
|
-
var event = require("./lib/event");
|
1290
1415
|
var lang = require("./lib/lang");
|
1291
1416
|
var dom = require("./lib/dom");
|
1292
1417
|
var snippetManager = require("./snippets").snippetManager;
|
1418
|
+
var config = require("./config");
|
1293
1419
|
|
1294
1420
|
var Autocomplete = function() {
|
1295
1421
|
this.autoInsert = false;
|
@@ -1334,9 +1460,9 @@ var Autocomplete = function() {
|
|
1334
1460
|
if (!this.popup)
|
1335
1461
|
this.$init();
|
1336
1462
|
|
1337
|
-
|
1463
|
+
this.popup.autoSelect = this.autoSelect;
|
1338
1464
|
|
1339
|
-
this.popup.setData(this.completions.filtered);
|
1465
|
+
this.popup.setData(this.completions.filtered, this.completions.filterText);
|
1340
1466
|
|
1341
1467
|
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
1342
1468
|
|
@@ -1360,6 +1486,7 @@ var Autocomplete = function() {
|
|
1360
1486
|
} else if (keepPopupPosition && !prefix) {
|
1361
1487
|
this.detach();
|
1362
1488
|
}
|
1489
|
+
this.changeTimer.cancel();
|
1363
1490
|
};
|
1364
1491
|
|
1365
1492
|
this.detach = function() {
|
@@ -1413,17 +1540,7 @@ var Autocomplete = function() {
|
|
1413
1540
|
};
|
1414
1541
|
|
1415
1542
|
this.goTo = function(where) {
|
1416
|
-
|
1417
|
-
var max = this.popup.session.getLength() - 1;
|
1418
|
-
|
1419
|
-
switch(where) {
|
1420
|
-
case "up": row = row <= 0 ? max : row - 1; break;
|
1421
|
-
case "down": row = row >= max ? -1 : row + 1; break;
|
1422
|
-
case "start": row = 0; break;
|
1423
|
-
case "end": row = max; break;
|
1424
|
-
}
|
1425
|
-
|
1426
|
-
this.popup.setRow(row);
|
1543
|
+
this.popup.goTo(where);
|
1427
1544
|
};
|
1428
1545
|
|
1429
1546
|
this.insertMatch = function(data, options) {
|
@@ -1432,13 +1549,15 @@ var Autocomplete = function() {
|
|
1432
1549
|
if (!data)
|
1433
1550
|
return false;
|
1434
1551
|
|
1552
|
+
var completions = this.completions;
|
1553
|
+
this.editor.startOperation({command: {name: "insertMatch"}});
|
1435
1554
|
if (data.completer && data.completer.insertMatch) {
|
1436
1555
|
data.completer.insertMatch(this.editor, data);
|
1437
1556
|
} else {
|
1438
|
-
if (
|
1557
|
+
if (completions.filterText) {
|
1439
1558
|
var ranges = this.editor.selection.getAllRanges();
|
1440
1559
|
for (var i = 0, range; range = ranges[i]; i++) {
|
1441
|
-
range.start.column -=
|
1560
|
+
range.start.column -= completions.filterText.length;
|
1442
1561
|
this.editor.session.remove(range);
|
1443
1562
|
}
|
1444
1563
|
}
|
@@ -1447,7 +1566,9 @@ var Autocomplete = function() {
|
|
1447
1566
|
else
|
1448
1567
|
this.editor.execCommand("insertstring", data.value || data);
|
1449
1568
|
}
|
1450
|
-
this.
|
1569
|
+
if (this.completions == completions)
|
1570
|
+
this.detach();
|
1571
|
+
this.editor.endOperation();
|
1451
1572
|
};
|
1452
1573
|
|
1453
1574
|
|
@@ -1497,7 +1618,7 @@ var Autocomplete = function() {
|
|
1497
1618
|
return true;
|
1498
1619
|
};
|
1499
1620
|
|
1500
|
-
this.showPopup = function(editor) {
|
1621
|
+
this.showPopup = function(editor, options) {
|
1501
1622
|
if (this.editor)
|
1502
1623
|
this.detach();
|
1503
1624
|
|
@@ -1515,10 +1636,10 @@ var Autocomplete = function() {
|
|
1515
1636
|
editor.on("mousedown", this.mousedownListener);
|
1516
1637
|
editor.on("mousewheel", this.mousewheelListener);
|
1517
1638
|
|
1518
|
-
this.updateCompletions();
|
1639
|
+
this.updateCompletions(false, options);
|
1519
1640
|
};
|
1520
1641
|
|
1521
|
-
this.updateCompletions = function(keepPopupPosition) {
|
1642
|
+
this.updateCompletions = function(keepPopupPosition, options) {
|
1522
1643
|
if (keepPopupPosition && this.base && this.completions) {
|
1523
1644
|
var pos = this.editor.getCursorPosition();
|
1524
1645
|
var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
|
@@ -1534,6 +1655,14 @@ var Autocomplete = function() {
|
|
1534
1655
|
this.openPopup(this.editor, prefix, keepPopupPosition);
|
1535
1656
|
return;
|
1536
1657
|
}
|
1658
|
+
|
1659
|
+
if (options && options.matches) {
|
1660
|
+
var pos = this.editor.getSelectionRange().start;
|
1661
|
+
this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
|
1662
|
+
this.base.$insertRight = true;
|
1663
|
+
this.completions = new FilteredList(options.matches);
|
1664
|
+
return this.openPopup(this.editor, "", keepPopupPosition);
|
1665
|
+
}
|
1537
1666
|
var _id = this.gatherCompletionsId;
|
1538
1667
|
this.gatherCompletions(this.editor, function(err, results) {
|
1539
1668
|
var detachIfFinished = function() {
|
@@ -1583,7 +1712,7 @@ var Autocomplete = function() {
|
|
1583
1712
|
doc = completer.getDocTooltip(selected);
|
1584
1713
|
return doc;
|
1585
1714
|
});
|
1586
|
-
if (!doc)
|
1715
|
+
if (!doc && typeof selected != "string")
|
1587
1716
|
doc = selected;
|
1588
1717
|
|
1589
1718
|
if (typeof doc == "string")
|
@@ -1618,14 +1747,28 @@ var Autocomplete = function() {
|
|
1618
1747
|
tooltipNode.style.top = popup.container.style.top;
|
1619
1748
|
tooltipNode.style.bottom = popup.container.style.bottom;
|
1620
1749
|
|
1750
|
+
tooltipNode.style.display = "block";
|
1621
1751
|
if (window.innerWidth - rect.right < 320) {
|
1622
|
-
|
1623
|
-
|
1752
|
+
if (rect.left < 320) {
|
1753
|
+
if(popup.isTopdown) {
|
1754
|
+
tooltipNode.style.top = rect.bottom + "px";
|
1755
|
+
tooltipNode.style.left = rect.left + "px";
|
1756
|
+
tooltipNode.style.right = "";
|
1757
|
+
tooltipNode.style.bottom = "";
|
1758
|
+
} else {
|
1759
|
+
tooltipNode.style.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
|
1760
|
+
tooltipNode.style.left = rect.left + "px";
|
1761
|
+
tooltipNode.style.right = "";
|
1762
|
+
tooltipNode.style.bottom = "";
|
1763
|
+
}
|
1764
|
+
} else {
|
1765
|
+
tooltipNode.style.right = window.innerWidth - rect.left + "px";
|
1766
|
+
tooltipNode.style.left = "";
|
1767
|
+
}
|
1624
1768
|
} else {
|
1625
1769
|
tooltipNode.style.left = (rect.right + 1) + "px";
|
1626
1770
|
tooltipNode.style.right = "";
|
1627
1771
|
}
|
1628
|
-
tooltipNode.style.display = "block";
|
1629
1772
|
};
|
1630
1773
|
|
1631
1774
|
this.hideDocTooltip = function() {
|
@@ -1649,19 +1792,49 @@ var Autocomplete = function() {
|
|
1649
1792
|
}
|
1650
1793
|
a = a.parentNode;
|
1651
1794
|
}
|
1652
|
-
}
|
1795
|
+
};
|
1796
|
+
|
1797
|
+
this.destroy = function() {
|
1798
|
+
this.detach();
|
1799
|
+
if (this.popup) {
|
1800
|
+
this.popup.destroy();
|
1801
|
+
var el = this.popup.container;
|
1802
|
+
if (el && el.parentNode)
|
1803
|
+
el.parentNode.removeChild(el);
|
1804
|
+
}
|
1805
|
+
if (this.editor && this.editor.completer == this)
|
1806
|
+
this.editor.completer == null;
|
1807
|
+
this.popup = null;
|
1808
|
+
};
|
1653
1809
|
|
1654
1810
|
}).call(Autocomplete.prototype);
|
1655
1811
|
|
1812
|
+
|
1813
|
+
Autocomplete.for = function(editor) {
|
1814
|
+
if (editor.completer) {
|
1815
|
+
return editor.completer;
|
1816
|
+
}
|
1817
|
+
if (config.get("sharedPopups")) {
|
1818
|
+
if (!Autocomplete.$shared)
|
1819
|
+
Autocomplete.$sharedInstance = new Autocomplete();
|
1820
|
+
editor.completer = Autocomplete.$sharedInstance;
|
1821
|
+
} else {
|
1822
|
+
editor.completer = new Autocomplete();
|
1823
|
+
editor.once("destroy", function(e, editor) {
|
1824
|
+
editor.completer.destroy();
|
1825
|
+
});
|
1826
|
+
}
|
1827
|
+
return editor.completer;
|
1828
|
+
};
|
1829
|
+
|
1656
1830
|
Autocomplete.startCommand = {
|
1657
1831
|
name: "startAutocomplete",
|
1658
|
-
exec: function(editor) {
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
editor.completer.cancelContextMenu();
|
1832
|
+
exec: function(editor, options) {
|
1833
|
+
var completer = Autocomplete.for(editor);
|
1834
|
+
completer.autoInsert = false;
|
1835
|
+
completer.autoSelect = true;
|
1836
|
+
completer.showPopup(editor, options);
|
1837
|
+
completer.cancelContextMenu();
|
1665
1838
|
},
|
1666
1839
|
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
|
1667
1840
|
};
|
@@ -1682,7 +1855,8 @@ var FilteredList = function(array, filterText) {
|
|
1682
1855
|
this.filterText = str;
|
1683
1856
|
matches = this.filterCompletions(matches, this.filterText);
|
1684
1857
|
matches = matches.sort(function(a, b) {
|
1685
|
-
return b.exactMatch - a.exactMatch || b
|
1858
|
+
return b.exactMatch - a.exactMatch || b.$score - a.$score
|
1859
|
+
|| (a.caption || a.value).localeCompare(b.caption || b.value);
|
1686
1860
|
});
|
1687
1861
|
var prev = null;
|
1688
1862
|
matches = matches.filter(function(item){
|
@@ -1699,7 +1873,7 @@ var FilteredList = function(array, filterText) {
|
|
1699
1873
|
var upper = needle.toUpperCase();
|
1700
1874
|
var lower = needle.toLowerCase();
|
1701
1875
|
loop: for (var i = 0, item; item = items[i]; i++) {
|
1702
|
-
var caption = item.
|
1876
|
+
var caption = item.caption || item.value || item.snippet;
|
1703
1877
|
if (!caption) continue;
|
1704
1878
|
var lastIndex = -1;
|
1705
1879
|
var matchMask = 0;
|
@@ -1709,26 +1883,31 @@ var FilteredList = function(array, filterText) {
|
|
1709
1883
|
if (this.exactMatch) {
|
1710
1884
|
if (needle !== caption.substr(0, needle.length))
|
1711
1885
|
continue loop;
|
1712
|
-
}else{
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
if (
|
1722
|
-
|
1723
|
-
|
1886
|
+
} else {
|
1887
|
+
var fullMatchIndex = caption.toLowerCase().indexOf(lower);
|
1888
|
+
if (fullMatchIndex > -1) {
|
1889
|
+
penalty = fullMatchIndex;
|
1890
|
+
} else {
|
1891
|
+
for (var j = 0; j < needle.length; j++) {
|
1892
|
+
var i1 = caption.indexOf(lower[j], lastIndex + 1);
|
1893
|
+
var i2 = caption.indexOf(upper[j], lastIndex + 1);
|
1894
|
+
index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
|
1895
|
+
if (index < 0)
|
1896
|
+
continue loop;
|
1897
|
+
distance = index - lastIndex - 1;
|
1898
|
+
if (distance > 0) {
|
1899
|
+
if (lastIndex === -1)
|
1900
|
+
penalty += 10;
|
1901
|
+
penalty += distance;
|
1902
|
+
matchMask = matchMask | (1 << j);
|
1903
|
+
}
|
1904
|
+
lastIndex = index;
|
1724
1905
|
}
|
1725
|
-
matchMask = matchMask | (1 << index);
|
1726
|
-
lastIndex = index;
|
1727
1906
|
}
|
1728
1907
|
}
|
1729
1908
|
item.matchMask = matchMask;
|
1730
1909
|
item.exactMatch = penalty ? 0 : 1;
|
1731
|
-
item
|
1910
|
+
item.$score = (item.score || 0) - penalty;
|
1732
1911
|
results.push(item);
|
1733
1912
|
}
|
1734
1913
|
return results;
|
@@ -1771,7 +1950,7 @@ define("ace/autocomplete/text_completer",["require","exports","module","ace/rang
|
|
1771
1950
|
}
|
1772
1951
|
|
1773
1952
|
exports.getCompletions = function(editor, session, pos, prefix, callback) {
|
1774
|
-
var wordScore = wordDistance(session, pos
|
1953
|
+
var wordScore = wordDistance(session, pos);
|
1775
1954
|
var wordList = Object.keys(wordScore);
|
1776
1955
|
callback(null, wordList.map(function(word) {
|
1777
1956
|
return {
|
@@ -1807,9 +1986,16 @@ var keyWordCompleter = {
|
|
1807
1986
|
|
1808
1987
|
var snippetCompleter = {
|
1809
1988
|
getCompletions: function(editor, session, pos, prefix, callback) {
|
1989
|
+
var scopes = [];
|
1990
|
+
var token = session.getTokenAt(pos.row, pos.column);
|
1991
|
+
if (token && token.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
|
1992
|
+
scopes.push('html-tag');
|
1993
|
+
else
|
1994
|
+
scopes = snippetManager.getActiveScopes(editor);
|
1995
|
+
|
1810
1996
|
var snippetMap = snippetManager.snippetMap;
|
1811
1997
|
var completions = [];
|
1812
|
-
|
1998
|
+
scopes.forEach(function(scope) {
|
1813
1999
|
var snippets = snippetMap[scope] || [];
|
1814
2000
|
for (var i = snippets.length; i--;) {
|
1815
2001
|
var s = snippets[i];
|
@@ -1861,31 +2047,33 @@ var onChangeMode = function(e, editor) {
|
|
1861
2047
|
};
|
1862
2048
|
|
1863
2049
|
var loadSnippetsForMode = function(mode) {
|
1864
|
-
|
2050
|
+
if (typeof mode == "string")
|
2051
|
+
mode = config.$modes[mode];
|
2052
|
+
if (!mode)
|
2053
|
+
return;
|
1865
2054
|
if (!snippetManager.files)
|
1866
2055
|
snippetManager.files = {};
|
1867
|
-
|
2056
|
+
|
2057
|
+
loadSnippetFile(mode.$id, mode.snippetFileId);
|
1868
2058
|
if (mode.modes)
|
1869
2059
|
mode.modes.forEach(loadSnippetsForMode);
|
1870
2060
|
};
|
1871
2061
|
|
1872
|
-
var loadSnippetFile = function(id) {
|
1873
|
-
if (!id || snippetManager.files[id])
|
2062
|
+
var loadSnippetFile = function(id, snippetFilePath) {
|
2063
|
+
if (!snippetFilePath || !id || snippetManager.files[id])
|
1874
2064
|
return;
|
1875
|
-
var snippetFilePath = id.replace("mode", "snippets");
|
1876
2065
|
snippetManager.files[id] = {};
|
1877
2066
|
config.loadModule(snippetFilePath, function(m) {
|
1878
|
-
if (m)
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
}
|
2067
|
+
if (!m) return;
|
2068
|
+
snippetManager.files[id] = m;
|
2069
|
+
if (!m.snippets && m.snippetText)
|
2070
|
+
m.snippets = snippetManager.parseSnippetFile(m.snippetText);
|
2071
|
+
snippetManager.register(m.snippets || [], m.scope);
|
2072
|
+
if (m.includeScopes) {
|
2073
|
+
snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
|
2074
|
+
m.includeScopes.forEach(function(x) {
|
2075
|
+
loadSnippetsForMode("ace/mode/" + x);
|
2076
|
+
});
|
1889
2077
|
}
|
1890
2078
|
});
|
1891
2079
|
};
|
@@ -1900,11 +2088,9 @@ var doLiveAutocomplete = function(e) {
|
|
1900
2088
|
else if (e.command.name === "insertstring") {
|
1901
2089
|
var prefix = util.getCompletionPrefix(editor);
|
1902
2090
|
if (prefix && !hasCompleter) {
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
editor.completer.autoInsert = false;
|
1907
|
-
editor.completer.showPopup(editor);
|
2091
|
+
var completer = Autocomplete.for(editor);
|
2092
|
+
completer.autoInsert = false;
|
2093
|
+
completer.showPopup(editor);
|
1908
2094
|
}
|
1909
2095
|
}
|
1910
2096
|
};
|
@@ -1949,8 +2135,11 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
|
1949
2135
|
value: false
|
1950
2136
|
}
|
1951
2137
|
});
|
1952
|
-
});
|
1953
|
-
|
1954
|
-
|
2138
|
+
}); (function() {
|
2139
|
+
window.require(["ace/ext/language_tools"], function(m) {
|
2140
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
2141
|
+
module.exports = m;
|
2142
|
+
}
|
2143
|
+
});
|
1955
2144
|
})();
|
1956
2145
|
|