ace-oqc 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -0
- package/src-noconflict/ace.js +21402 -0
- package/src-noconflict/ext-beautify.js +331 -0
- package/src-noconflict/ext-elastic_tabstops_lite.js +277 -0
- package/src-noconflict/ext-emmet.js +1331 -0
- package/src-noconflict/ext-error_marker.js +9 -0
- package/src-noconflict/ext-keybinding_menu.js +193 -0
- package/src-noconflict/ext-language_tools.js +2166 -0
- package/src-noconflict/ext-linking.js +64 -0
- package/src-noconflict/ext-modelist.js +248 -0
- package/src-noconflict/ext-options.js +799 -0
- package/src-noconflict/ext-prompt.js +2806 -0
- package/src-noconflict/ext-rtl.js +122 -0
- package/src-noconflict/ext-searchbox.js +514 -0
- package/src-noconflict/ext-settings_menu.js +820 -0
- package/src-noconflict/ext-spellcheck.js +73 -0
- package/src-noconflict/ext-split.js +207 -0
- package/src-noconflict/ext-static_highlight.js +229 -0
- package/src-noconflict/ext-statusbar.js +56 -0
- package/src-noconflict/ext-textarea.js +430 -0
- package/src-noconflict/ext-themelist.js +67 -0
- package/src-noconflict/ext-whitespace.js +213 -0
- package/src-noconflict/keybinding-emacs.js +1169 -0
- package/src-noconflict/keybinding-sublime.js +422 -0
- package/src-noconflict/keybinding-vim.js +6198 -0
- package/src-noconflict/mode-abap.js +221 -0
- package/src-noconflict/mode-abc.js +271 -0
- package/src-noconflict/mode-actionscript.js +275 -0
- package/src-noconflict/mode-ada.js +137 -0
- package/src-noconflict/mode-apache_conf.js +363 -0
- package/src-noconflict/mode-apex.js +457 -0
- package/src-noconflict/mode-applescript.js +278 -0
- package/src-noconflict/mode-aql.js +102 -0
- package/src-noconflict/mode-asciidoc.js +349 -0
- package/src-noconflict/mode-asl.js +422 -0
- package/src-noconflict/mode-assembly_x86.js +193 -0
- package/src-noconflict/mode-autohotkey.js +244 -0
- package/src-noconflict/mode-batchfile.js +230 -0
- package/src-noconflict/mode-c9search.js +293 -0
- package/src-noconflict/mode-c_cpp.js +503 -0
- package/src-noconflict/mode-cirru.js +210 -0
- package/src-noconflict/mode-clojure.js +315 -0
- package/src-noconflict/mode-cobol.js +101 -0
- package/src-noconflict/mode-coffee.js +400 -0
- package/src-noconflict/mode-coldfusion.js +2596 -0
- package/src-noconflict/mode-crystal.js +642 -0
- package/src-noconflict/mode-csharp.js +502 -0
- package/src-noconflict/mode-csound_document.js +4105 -0
- package/src-noconflict/mode-csound_orchestra.js +3035 -0
- package/src-noconflict/mode-csound_score.js +462 -0
- package/src-noconflict/mode-csp.js +59 -0
- package/src-noconflict/mode-css.js +720 -0
- package/src-noconflict/mode-curly.js +2564 -0
- package/src-noconflict/mode-d.js +520 -0
- package/src-noconflict/mode-dart.js +715 -0
- package/src-noconflict/mode-diff.js +147 -0
- package/src-noconflict/mode-django.js +2595 -0
- package/src-noconflict/mode-dockerfile.js +500 -0
- package/src-noconflict/mode-dot.js +417 -0
- package/src-noconflict/mode-drools.js +498 -0
- package/src-noconflict/mode-edifact.js +166 -0
- package/src-noconflict/mode-eiffel.js +135 -0
- package/src-noconflict/mode-ejs.js +3533 -0
- package/src-noconflict/mode-elixir.js +501 -0
- package/src-noconflict/mode-elm.js +306 -0
- package/src-noconflict/mode-erlang.js +1010 -0
- package/src-noconflict/mode-forth.js +297 -0
- package/src-noconflict/mode-fortran.js +430 -0
- package/src-noconflict/mode-fsharp.js +316 -0
- package/src-noconflict/mode-fsl.js +259 -0
- package/src-noconflict/mode-ftl.js +1193 -0
- package/src-noconflict/mode-gcode.js +93 -0
- package/src-noconflict/mode-gherkin.js +168 -0
- package/src-noconflict/mode-gitignore.js +59 -0
- package/src-noconflict/mode-glsl.js +580 -0
- package/src-noconflict/mode-gobstones.js +1090 -0
- package/src-noconflict/mode-golang.js +413 -0
- package/src-noconflict/mode-graphqlschema.js +214 -0
- package/src-noconflict/mode-groovy.js +989 -0
- package/src-noconflict/mode-haml.js +1873 -0
- package/src-noconflict/mode-handlebars.js +2622 -0
- package/src-noconflict/mode-haskell.js +380 -0
- package/src-noconflict/mode-haskell_cabal.js +141 -0
- package/src-noconflict/mode-haxe.js +386 -0
- package/src-noconflict/mode-hjson.js +353 -0
- package/src-noconflict/mode-html.js +2509 -0
- package/src-noconflict/mode-html_elixir.js +3088 -0
- package/src-noconflict/mode-html_ruby.js +3550 -0
- package/src-noconflict/mode-ini.js +162 -0
- package/src-noconflict/mode-io.js +248 -0
- package/src-noconflict/mode-jack.js +346 -0
- package/src-noconflict/mode-jade.js +2025 -0
- package/src-noconflict/mode-java.js +1038 -0
- package/src-noconflict/mode-javascript.js +798 -0
- package/src-noconflict/mode-json.js +329 -0
- package/src-noconflict/mode-jsoniq.js +2632 -0
- package/src-noconflict/mode-jsp.js +1433 -0
- package/src-noconflict/mode-jssm.js +325 -0
- package/src-noconflict/mode-jsx.js +411 -0
- package/src-noconflict/mode-julia.js +303 -0
- package/src-noconflict/mode-kotlin.js +797 -0
- package/src-noconflict/mode-latex.js +296 -0
- package/src-noconflict/mode-less.js +839 -0
- package/src-noconflict/mode-liquid.js +2742 -0
- package/src-noconflict/mode-lisp.js +112 -0
- package/src-noconflict/mode-livescript.js +279 -0
- package/src-noconflict/mode-logiql.js +317 -0
- package/src-noconflict/mode-logtalk.js +352 -0
- package/src-noconflict/mode-lsl.js +343 -0
- package/src-noconflict/mode-lua.js +452 -0
- package/src-noconflict/mode-luapage.js +3028 -0
- package/src-noconflict/mode-lucene.js +154 -0
- package/src-noconflict/mode-makefile.js +412 -0
- package/src-noconflict/mode-markdown.js +3194 -0
- package/src-noconflict/mode-mask.js +1803 -0
- package/src-noconflict/mode-matlab.js +263 -0
- package/src-noconflict/mode-maze.js +292 -0
- package/src-noconflict/mode-mel.js +263 -0
- package/src-noconflict/mode-mixal.js +122 -0
- package/src-noconflict/mode-mushcode.js +681 -0
- package/src-noconflict/mode-mysql.js +167 -0
- package/src-noconflict/mode-nginx.js +298 -0
- package/src-noconflict/mode-nim.js +363 -0
- package/src-noconflict/mode-nix.js +647 -0
- package/src-noconflict/mode-nsis.js +312 -0
- package/src-noconflict/mode-objectivec.js +740 -0
- package/src-noconflict/mode-ocaml.js +421 -0
- package/src-noconflict/mode-pascal.js +223 -0
- package/src-noconflict/mode-perl.js +381 -0
- package/src-noconflict/mode-pgsql.js +1743 -0
- package/src-noconflict/mode-php.js +13110 -0
- package/src-noconflict/mode-php_laravel_blade.js +13311 -0
- package/src-noconflict/mode-pig.js +310 -0
- package/src-noconflict/mode-plain_text.js +32 -0
- package/src-noconflict/mode-powershell.js +418 -0
- package/src-noconflict/mode-praat.js +478 -0
- package/src-noconflict/mode-prolog.js +371 -0
- package/src-noconflict/mode-properties.js +80 -0
- package/src-noconflict/mode-protobuf.js +593 -0
- package/src-noconflict/mode-puppet.js +368 -0
- package/src-noconflict/mode-python.js +508 -0
- package/src-noconflict/mode-r.js +312 -0
- package/src-noconflict/mode-razor.js +2875 -0
- package/src-noconflict/mode-rdoc.js +243 -0
- package/src-noconflict/mode-red.js +450 -0
- package/src-noconflict/mode-redshift.js +360 -0
- package/src-noconflict/mode-rhtml.js +2808 -0
- package/src-noconflict/mode-rst.js +257 -0
- package/src-noconflict/mode-ruby.js +1003 -0
- package/src-noconflict/mode-rust.js +282 -0
- package/src-noconflict/mode-sass.js +529 -0
- package/src-noconflict/mode-scad.js +414 -0
- package/src-noconflict/mode-scala.js +984 -0
- package/src-noconflict/mode-scheme.js +232 -0
- package/src-noconflict/mode-scss.js +873 -0
- package/src-noconflict/mode-sh.js +449 -0
- package/src-noconflict/mode-sjs.js +1015 -0
- package/src-noconflict/mode-slim.js +5240 -0
- package/src-noconflict/mode-smarty.js +2635 -0
- package/src-noconflict/mode-snippets.js +207 -0
- package/src-noconflict/mode-soy_template.js +2848 -0
- package/src-noconflict/mode-space.js +167 -0
- package/src-noconflict/mode-sparql.js +320 -0
- package/src-noconflict/mode-sql.js +271 -0
- package/src-noconflict/mode-sqlserver.js +445 -0
- package/src-noconflict/mode-stylus.js +472 -0
- package/src-noconflict/mode-svg.js +1582 -0
- package/src-noconflict/mode-swift.js +395 -0
- package/src-noconflict/mode-tcl.js +387 -0
- package/src-noconflict/mode-terraform.js +400 -0
- package/src-noconflict/mode-tex.js +160 -0
- package/src-noconflict/mode-text.js +9 -0
- package/src-noconflict/mode-textile.js +150 -0
- package/src-noconflict/mode-toml.js +153 -0
- package/src-noconflict/mode-tsx.js +888 -0
- package/src-noconflict/mode-turtle.js +296 -0
- package/src-noconflict/mode-twig.js +2693 -0
- package/src-noconflict/mode-typescript.js +869 -0
- package/src-noconflict/mode-vala.js +677 -0
- package/src-noconflict/mode-vbscript.js +635 -0
- package/src-noconflict/mode-velocity.js +2792 -0
- package/src-noconflict/mode-verilog.js +118 -0
- package/src-noconflict/mode-vhdl.js +116 -0
- package/src-noconflict/mode-visualforce.js +2640 -0
- package/src-noconflict/mode-wollok.js +914 -0
- package/src-noconflict/mode-xml.js +676 -0
- package/src-noconflict/mode-xquery.js +2644 -0
- package/src-noconflict/mode-yaml.js +330 -0
- package/src-noconflict/mode-zeek.js +539 -0
- package/src-noconflict/qurator-mode.js +120 -0
- package/src-noconflict/qurator-worker.js +91 -0
- package/src-noconflict/snippets/abap.js +9 -0
- package/src-noconflict/snippets/abc.js +45 -0
- package/src-noconflict/snippets/actionscript.js +171 -0
- package/src-noconflict/snippets/ada.js +9 -0
- package/src-noconflict/snippets/apache_conf.js +9 -0
- package/src-noconflict/snippets/apex.js +9 -0
- package/src-noconflict/snippets/applescript.js +9 -0
- package/src-noconflict/snippets/aql.js +9 -0
- package/src-noconflict/snippets/asciidoc.js +9 -0
- package/src-noconflict/snippets/asl.js +9 -0
- package/src-noconflict/snippets/assembly_x86.js +9 -0
- package/src-noconflict/snippets/autohotkey.js +9 -0
- package/src-noconflict/snippets/batchfile.js +9 -0
- package/src-noconflict/snippets/c9search.js +9 -0
- package/src-noconflict/snippets/c_cpp.js +145 -0
- package/src-noconflict/snippets/cirru.js +9 -0
- package/src-noconflict/snippets/clojure.js +104 -0
- package/src-noconflict/snippets/cobol.js +9 -0
- package/src-noconflict/snippets/coffee.js +109 -0
- package/src-noconflict/snippets/coldfusion.js +9 -0
- package/src-noconflict/snippets/crystal.js +9 -0
- package/src-noconflict/snippets/csharp.js +9 -0
- package/src-noconflict/snippets/csound_document.js +24 -0
- package/src-noconflict/snippets/csound_orchestra.js +61 -0
- package/src-noconflict/snippets/csound_score.js +9 -0
- package/src-noconflict/snippets/csp.js +9 -0
- package/src-noconflict/snippets/css.js +981 -0
- package/src-noconflict/snippets/curly.js +9 -0
- package/src-noconflict/snippets/d.js +9 -0
- package/src-noconflict/snippets/dart.js +97 -0
- package/src-noconflict/snippets/diff.js +25 -0
- package/src-noconflict/snippets/django.js +122 -0
- package/src-noconflict/snippets/dockerfile.js +9 -0
- package/src-noconflict/snippets/dot.js +9 -0
- package/src-noconflict/snippets/drools.js +33 -0
- package/src-noconflict/snippets/edifact.js +254 -0
- package/src-noconflict/snippets/eiffel.js +9 -0
- package/src-noconflict/snippets/ejs.js +9 -0
- package/src-noconflict/snippets/elixir.js +9 -0
- package/src-noconflict/snippets/elm.js +9 -0
- package/src-noconflict/snippets/erlang.js +174 -0
- package/src-noconflict/snippets/forth.js +9 -0
- package/src-noconflict/snippets/fortran.js +9 -0
- package/src-noconflict/snippets/fsharp.js +9 -0
- package/src-noconflict/snippets/fsl.js +14 -0
- package/src-noconflict/snippets/ftl.js +9 -0
- package/src-noconflict/snippets/gcode.js +9 -0
- package/src-noconflict/snippets/gherkin.js +9 -0
- package/src-noconflict/snippets/gitignore.js +9 -0
- package/src-noconflict/snippets/glsl.js +9 -0
- package/src-noconflict/snippets/gobstones.js +1718 -0
- package/src-noconflict/snippets/golang.js +9 -0
- package/src-noconflict/snippets/graphqlschema.js +46 -0
- package/src-noconflict/snippets/groovy.js +9 -0
- package/src-noconflict/snippets/haml.js +34 -0
- package/src-noconflict/snippets/handlebars.js +9 -0
- package/src-noconflict/snippets/haskell.js +96 -0
- package/src-noconflict/snippets/haskell_cabal.js +9 -0
- package/src-noconflict/snippets/haxe.js +9 -0
- package/src-noconflict/snippets/hjson.js +9 -0
- package/src-noconflict/snippets/html.js +867 -0
- package/src-noconflict/snippets/html_elixir.js +9 -0
- package/src-noconflict/snippets/html_ruby.js +9 -0
- package/src-noconflict/snippets/ini.js +9 -0
- package/src-noconflict/snippets/io.js +76 -0
- package/src-noconflict/snippets/jack.js +9 -0
- package/src-noconflict/snippets/jade.js +9 -0
- package/src-noconflict/snippets/java.js +254 -0
- package/src-noconflict/snippets/javascript.js +209 -0
- package/src-noconflict/snippets/json.js +9 -0
- package/src-noconflict/snippets/jsoniq.js +75 -0
- package/src-noconflict/snippets/jsp.js +113 -0
- package/src-noconflict/snippets/jssm.js +9 -0
- package/src-noconflict/snippets/jsx.js +9 -0
- package/src-noconflict/snippets/julia.js +9 -0
- package/src-noconflict/snippets/kotlin.js +9 -0
- package/src-noconflict/snippets/latex.js +9 -0
- package/src-noconflict/snippets/less.js +9 -0
- package/src-noconflict/snippets/liquid.js +895 -0
- package/src-noconflict/snippets/lisp.js +9 -0
- package/src-noconflict/snippets/livescript.js +9 -0
- package/src-noconflict/snippets/logiql.js +9 -0
- package/src-noconflict/snippets/logtalk.js +9 -0
- package/src-noconflict/snippets/lsl.js +1246 -0
- package/src-noconflict/snippets/lua.js +35 -0
- package/src-noconflict/snippets/luapage.js +9 -0
- package/src-noconflict/snippets/lucene.js +9 -0
- package/src-noconflict/snippets/makefile.js +18 -0
- package/src-noconflict/snippets/markdown.js +102 -0
- package/src-noconflict/snippets/mask.js +9 -0
- package/src-noconflict/snippets/matlab.js +9 -0
- package/src-noconflict/snippets/maze.js +23 -0
- package/src-noconflict/snippets/mel.js +9 -0
- package/src-noconflict/snippets/mixal.js +9 -0
- package/src-noconflict/snippets/mushcode.js +9 -0
- package/src-noconflict/snippets/mysql.js +9 -0
- package/src-noconflict/snippets/nginx.js +9 -0
- package/src-noconflict/snippets/nim.js +9 -0
- package/src-noconflict/snippets/nix.js +9 -0
- package/src-noconflict/snippets/nsis.js +9 -0
- package/src-noconflict/snippets/objectivec.js +9 -0
- package/src-noconflict/snippets/ocaml.js +9 -0
- package/src-noconflict/snippets/pascal.js +9 -0
- package/src-noconflict/snippets/perl.js +361 -0
- package/src-noconflict/snippets/pgsql.js +9 -0
- package/src-noconflict/snippets/php.js +397 -0
- package/src-noconflict/snippets/php_laravel_blade.js +9 -0
- package/src-noconflict/snippets/pig.js +9 -0
- package/src-noconflict/snippets/plain_text.js +9 -0
- package/src-noconflict/snippets/powershell.js +9 -0
- package/src-noconflict/snippets/praat.js +9 -0
- package/src-noconflict/snippets/prolog.js +9 -0
- package/src-noconflict/snippets/properties.js +9 -0
- package/src-noconflict/snippets/protobuf.js +9 -0
- package/src-noconflict/snippets/puppet.js +9 -0
- package/src-noconflict/snippets/python.js +172 -0
- package/src-noconflict/snippets/r.js +135 -0
- package/src-noconflict/snippets/razor.js +17 -0
- package/src-noconflict/snippets/rdoc.js +9 -0
- package/src-noconflict/snippets/red.js +9 -0
- package/src-noconflict/snippets/redshift.js +9 -0
- package/src-noconflict/snippets/rhtml.js +9 -0
- package/src-noconflict/snippets/rst.js +36 -0
- package/src-noconflict/snippets/ruby.js +942 -0
- package/src-noconflict/snippets/rust.js +9 -0
- package/src-noconflict/snippets/sass.js +9 -0
- package/src-noconflict/snippets/scad.js +9 -0
- package/src-noconflict/snippets/scala.js +9 -0
- package/src-noconflict/snippets/scheme.js +9 -0
- package/src-noconflict/snippets/scss.js +9 -0
- package/src-noconflict/snippets/sh.js +97 -0
- package/src-noconflict/snippets/sjs.js +9 -0
- package/src-noconflict/snippets/slim.js +9 -0
- package/src-noconflict/snippets/smarty.js +9 -0
- package/src-noconflict/snippets/snippets.js +23 -0
- package/src-noconflict/snippets/soy_template.js +9 -0
- package/src-noconflict/snippets/space.js +9 -0
- package/src-noconflict/snippets/sparql.js +9 -0
- package/src-noconflict/snippets/sql.js +40 -0
- package/src-noconflict/snippets/sqlserver.js +83 -0
- package/src-noconflict/snippets/stylus.js +9 -0
- package/src-noconflict/snippets/svg.js +9 -0
- package/src-noconflict/snippets/swift.js +9 -0
- package/src-noconflict/snippets/tcl.js +106 -0
- package/src-noconflict/snippets/terraform.js +9 -0
- package/src-noconflict/snippets/tex.js +204 -0
- package/src-noconflict/snippets/text.js +9 -0
- package/src-noconflict/snippets/textile.js +44 -0
- package/src-noconflict/snippets/toml.js +9 -0
- package/src-noconflict/snippets/tsx.js +9 -0
- package/src-noconflict/snippets/turtle.js +9 -0
- package/src-noconflict/snippets/twig.js +9 -0
- package/src-noconflict/snippets/typescript.js +9 -0
- package/src-noconflict/snippets/vala.js +200 -0
- package/src-noconflict/snippets/vbscript.js +9 -0
- package/src-noconflict/snippets/velocity.js +43 -0
- package/src-noconflict/snippets/verilog.js +9 -0
- package/src-noconflict/snippets/vhdl.js +9 -0
- package/src-noconflict/snippets/visualforce.js +9 -0
- package/src-noconflict/snippets/wollok.js +98 -0
- package/src-noconflict/snippets/xml.js +9 -0
- package/src-noconflict/snippets/xquery.js +75 -0
- package/src-noconflict/snippets/yaml.js +9 -0
- package/src-noconflict/snippets/zeek.js +9 -0
- package/src-noconflict/theme-ambiance.js +185 -0
- package/src-noconflict/theme-chaos.js +163 -0
- package/src-noconflict/theme-chrome.js +135 -0
- package/src-noconflict/theme-clouds.js +102 -0
- package/src-noconflict/theme-clouds_midnight.js +103 -0
- package/src-noconflict/theme-cobalt.js +120 -0
- package/src-noconflict/theme-crimson_editor.js +125 -0
- package/src-noconflict/theme-dawn.js +115 -0
- package/src-noconflict/theme-dracula.js +135 -0
- package/src-noconflict/theme-dreamweaver.js +148 -0
- package/src-noconflict/theme-eclipse.js +105 -0
- package/src-noconflict/theme-github.js +110 -0
- package/src-noconflict/theme-gob.js +119 -0
- package/src-noconflict/theme-gruvbox.js +89 -0
- package/src-noconflict/theme-idle_fingers.js +103 -0
- package/src-noconflict/theme-iplastic.js +128 -0
- package/src-noconflict/theme-katzenmilch.js +128 -0
- package/src-noconflict/theme-kr_theme.js +111 -0
- package/src-noconflict/theme-kuroir.js +68 -0
- package/src-noconflict/theme-merbivore.js +102 -0
- package/src-noconflict/theme-merbivore_soft.js +103 -0
- package/src-noconflict/theme-mono_industrial.js +114 -0
- package/src-noconflict/theme-monokai.js +112 -0
- package/src-noconflict/theme-pastel_on_dark.js +115 -0
- package/src-noconflict/theme-solarized_dark.js +95 -0
- package/src-noconflict/theme-solarized_light.js +98 -0
- package/src-noconflict/theme-sqlserver.js +145 -0
- package/src-noconflict/theme-terminal.js +121 -0
- package/src-noconflict/theme-textmate.js +137 -0
- package/src-noconflict/theme-tomorrow.js +115 -0
- package/src-noconflict/theme-tomorrow_night.js +115 -0
- package/src-noconflict/theme-tomorrow_night_blue.js +113 -0
- package/src-noconflict/theme-tomorrow_night_bright.js +128 -0
- package/src-noconflict/theme-tomorrow_night_eighties.js +115 -0
- package/src-noconflict/theme-twilight.js +116 -0
- package/src-noconflict/theme-vibrant_ink.js +101 -0
- package/src-noconflict/theme-xcode.js +95 -0
- package/src-noconflict/worker-coffee.js +1470 -0
- package/src-noconflict/worker-css.js +9000 -0
- package/src-noconflict/worker-html.js +10922 -0
- package/src-noconflict/worker-javascript.js +15001 -0
- package/src-noconflict/worker-json.js +1715 -0
- package/src-noconflict/worker-lua.js +3608 -0
- package/src-noconflict/worker-php.js +3687 -0
- package/src-noconflict/worker-xml.js +3208 -0
- package/src-noconflict/worker-xquery.js +57668 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
|
|
2
|
+
"use strict";
|
|
3
|
+
var TokenIterator = require("../token_iterator").TokenIterator;
|
|
4
|
+
|
|
5
|
+
function is(token, type) {
|
|
6
|
+
return token.type.lastIndexOf(type + ".xml") > -1;
|
|
7
|
+
}
|
|
8
|
+
exports.singletonTags = ["area", "base", "br", "col", "command", "embed", "hr", "html", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
9
|
+
exports.blockTags = ["article", "aside", "blockquote", "body", "div", "dl", "fieldset", "footer", "form", "head", "header", "html", "nav", "ol", "p", "script", "section", "style", "table", "tbody", "tfoot", "thead", "ul"];
|
|
10
|
+
|
|
11
|
+
exports.beautify = function(session) {
|
|
12
|
+
var iterator = new TokenIterator(session, 0, 0);
|
|
13
|
+
var token = iterator.getCurrentToken();
|
|
14
|
+
var tabString = session.getTabString();
|
|
15
|
+
var singletonTags = exports.singletonTags;
|
|
16
|
+
var blockTags = exports.blockTags;
|
|
17
|
+
var nextToken;
|
|
18
|
+
var breakBefore = false;
|
|
19
|
+
var spaceBefore = false;
|
|
20
|
+
var spaceAfter = false;
|
|
21
|
+
var code = "";
|
|
22
|
+
var value = "";
|
|
23
|
+
var tagName = "";
|
|
24
|
+
var depth = 0;
|
|
25
|
+
var lastDepth = 0;
|
|
26
|
+
var lastIndent = 0;
|
|
27
|
+
var indent = 0;
|
|
28
|
+
var unindent = 0;
|
|
29
|
+
var roundDepth = 0;
|
|
30
|
+
var curlyDepth = 0;
|
|
31
|
+
var row;
|
|
32
|
+
var curRow = 0;
|
|
33
|
+
var rowsToAdd = 0;
|
|
34
|
+
var rowTokens = [];
|
|
35
|
+
var abort = false;
|
|
36
|
+
var i;
|
|
37
|
+
var indentNextLine = false;
|
|
38
|
+
var inTag = false;
|
|
39
|
+
var inCSS = false;
|
|
40
|
+
var inBlock = false;
|
|
41
|
+
var levels = {0: 0};
|
|
42
|
+
var parents = [];
|
|
43
|
+
var caseBody = false;
|
|
44
|
+
|
|
45
|
+
var trimNext = function() {
|
|
46
|
+
if (nextToken && nextToken.value && nextToken.type !== 'string.regexp')
|
|
47
|
+
nextToken.value = nextToken.value.replace(/^\s*/, "");
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var trimLine = function() {
|
|
51
|
+
code = code.replace(/ +$/, "");
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var trimCode = function() {
|
|
55
|
+
code = code.trimRight();
|
|
56
|
+
breakBefore = false;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
while (token !== null) {
|
|
60
|
+
curRow = iterator.getCurrentTokenRow();
|
|
61
|
+
rowTokens = iterator.$rowTokens;
|
|
62
|
+
nextToken = iterator.stepForward();
|
|
63
|
+
|
|
64
|
+
if (typeof token !== "undefined") {
|
|
65
|
+
value = token.value;
|
|
66
|
+
unindent = 0;
|
|
67
|
+
inCSS = (tagName === "style" || session.$modeId === "ace/mode/css");
|
|
68
|
+
if (is(token, "tag-open")) {
|
|
69
|
+
inTag = true;
|
|
70
|
+
if (nextToken)
|
|
71
|
+
inBlock = (blockTags.indexOf(nextToken.value) !== -1);
|
|
72
|
+
if (value === "</") {
|
|
73
|
+
if (inBlock && !breakBefore && rowsToAdd < 1)
|
|
74
|
+
rowsToAdd++;
|
|
75
|
+
|
|
76
|
+
if (inCSS)
|
|
77
|
+
rowsToAdd = 1;
|
|
78
|
+
|
|
79
|
+
unindent = 1;
|
|
80
|
+
inBlock = false;
|
|
81
|
+
}
|
|
82
|
+
} else if (is(token, "tag-close")) {
|
|
83
|
+
inTag = false;
|
|
84
|
+
} else if (is(token, "comment.start")) {
|
|
85
|
+
inBlock = true;
|
|
86
|
+
} else if (is(token, "comment.end")) {
|
|
87
|
+
inBlock = false;
|
|
88
|
+
}
|
|
89
|
+
if (!inTag && !rowsToAdd && token.type === "paren.rparen" && token.value.substr(0, 1) === "}") {
|
|
90
|
+
rowsToAdd++;
|
|
91
|
+
}
|
|
92
|
+
if (curRow !== row) {
|
|
93
|
+
rowsToAdd = curRow;
|
|
94
|
+
|
|
95
|
+
if (row)
|
|
96
|
+
rowsToAdd -= row;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (rowsToAdd) {
|
|
100
|
+
trimCode();
|
|
101
|
+
for (; rowsToAdd > 0; rowsToAdd--)
|
|
102
|
+
code += "\n";
|
|
103
|
+
|
|
104
|
+
breakBefore = true;
|
|
105
|
+
if (!is(token, "comment") && !token.type.match(/^(comment|string)$/))
|
|
106
|
+
value = value.trimLeft();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (value) {
|
|
110
|
+
if (token.type === "keyword" && value.match(/^(if|else|elseif|for|foreach|while|switch)$/)) {
|
|
111
|
+
parents[depth] = value;
|
|
112
|
+
|
|
113
|
+
trimNext();
|
|
114
|
+
spaceAfter = true;
|
|
115
|
+
if (value.match(/^(else|elseif)$/)) {
|
|
116
|
+
if (code.match(/\}[\s]*$/)) {
|
|
117
|
+
trimCode();
|
|
118
|
+
spaceBefore = true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} else if (token.type === "paren.lparen") {
|
|
122
|
+
trimNext();
|
|
123
|
+
if (value.substr(-1) === "{") {
|
|
124
|
+
spaceAfter = true;
|
|
125
|
+
indentNextLine = false;
|
|
126
|
+
|
|
127
|
+
if(!inTag)
|
|
128
|
+
rowsToAdd = 1;
|
|
129
|
+
}
|
|
130
|
+
if (value.substr(0, 1) === "{") {
|
|
131
|
+
spaceBefore = true;
|
|
132
|
+
if (code.substr(-1) !== '[' && code.trimRight().substr(-1) === '[') {
|
|
133
|
+
trimCode();
|
|
134
|
+
spaceBefore = false;
|
|
135
|
+
} else if (code.trimRight().substr(-1) === ')') {
|
|
136
|
+
trimCode();
|
|
137
|
+
} else {
|
|
138
|
+
trimLine();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
} else if (token.type === "paren.rparen") {
|
|
142
|
+
unindent = 1;
|
|
143
|
+
if (value.substr(0, 1) === "}") {
|
|
144
|
+
if (parents[depth-1] === 'case')
|
|
145
|
+
unindent++;
|
|
146
|
+
|
|
147
|
+
if (code.trimRight().substr(-1) === '{') {
|
|
148
|
+
trimCode();
|
|
149
|
+
} else {
|
|
150
|
+
spaceBefore = true;
|
|
151
|
+
|
|
152
|
+
if (inCSS)
|
|
153
|
+
rowsToAdd+=2;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (value.substr(0, 1) === "]") {
|
|
157
|
+
if (code.substr(-1) !== '}' && code.trimRight().substr(-1) === '}') {
|
|
158
|
+
spaceBefore = false;
|
|
159
|
+
indent++;
|
|
160
|
+
trimCode();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (value.substr(0, 1) === ")") {
|
|
164
|
+
if (code.substr(-1) !== '(' && code.trimRight().substr(-1) === '(') {
|
|
165
|
+
spaceBefore = false;
|
|
166
|
+
indent++;
|
|
167
|
+
trimCode();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
trimLine();
|
|
172
|
+
} else if ((token.type === "keyword.operator" || token.type === "keyword") && value.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)) {
|
|
173
|
+
trimCode();
|
|
174
|
+
trimNext();
|
|
175
|
+
spaceBefore = true;
|
|
176
|
+
spaceAfter = true;
|
|
177
|
+
} else if (token.type === "punctuation.operator" && value === ';') {
|
|
178
|
+
trimCode();
|
|
179
|
+
trimNext();
|
|
180
|
+
spaceAfter = true;
|
|
181
|
+
|
|
182
|
+
if (inCSS)
|
|
183
|
+
rowsToAdd++;
|
|
184
|
+
} else if (token.type === "punctuation.operator" && value.match(/^(:|,)$/)) {
|
|
185
|
+
trimCode();
|
|
186
|
+
trimNext();
|
|
187
|
+
if (value.match(/^(,)$/) && curlyDepth>0 && roundDepth===0) {
|
|
188
|
+
rowsToAdd++;
|
|
189
|
+
} else {
|
|
190
|
+
spaceAfter = true;
|
|
191
|
+
breakBefore = false;
|
|
192
|
+
}
|
|
193
|
+
} else if (token.type === "support.php_tag" && value === "?>" && !breakBefore) {
|
|
194
|
+
trimCode();
|
|
195
|
+
spaceBefore = true;
|
|
196
|
+
} else if (is(token, "attribute-name") && code.substr(-1).match(/^\s$/)) {
|
|
197
|
+
spaceBefore = true;
|
|
198
|
+
} else if (is(token, "attribute-equals")) {
|
|
199
|
+
trimLine();
|
|
200
|
+
trimNext();
|
|
201
|
+
} else if (is(token, "tag-close")) {
|
|
202
|
+
trimLine();
|
|
203
|
+
if(value === "/>")
|
|
204
|
+
spaceBefore = true;
|
|
205
|
+
} else if (token.type === "keyword" && value.match(/^(case|default)$/)) {
|
|
206
|
+
if (caseBody)
|
|
207
|
+
unindent = 1;
|
|
208
|
+
}
|
|
209
|
+
if (breakBefore && !(token.type.match(/^(comment)$/) && !value.substr(0, 1).match(/^[/#]$/)) && !(token.type.match(/^(string)$/) && !value.substr(0, 1).match(/^['"]$/))) {
|
|
210
|
+
|
|
211
|
+
indent = lastIndent;
|
|
212
|
+
|
|
213
|
+
if(depth > lastDepth) {
|
|
214
|
+
indent++;
|
|
215
|
+
|
|
216
|
+
for (i=depth; i > lastDepth; i--)
|
|
217
|
+
levels[i] = indent;
|
|
218
|
+
} else if(depth < lastDepth)
|
|
219
|
+
indent = levels[depth];
|
|
220
|
+
|
|
221
|
+
lastDepth = depth;
|
|
222
|
+
lastIndent = indent;
|
|
223
|
+
|
|
224
|
+
if(unindent)
|
|
225
|
+
indent -= unindent;
|
|
226
|
+
|
|
227
|
+
if (indentNextLine && !roundDepth) {
|
|
228
|
+
indent++;
|
|
229
|
+
indentNextLine = false;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
for (i = 0; i < indent; i++)
|
|
233
|
+
code += tabString;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (token.type === "keyword" && value.match(/^(case|default)$/)) {
|
|
237
|
+
if (caseBody === false) {
|
|
238
|
+
parents[depth] = value;
|
|
239
|
+
depth++;
|
|
240
|
+
caseBody = true;
|
|
241
|
+
}
|
|
242
|
+
} else if (token.type === "keyword" && value.match(/^(break)$/)) {
|
|
243
|
+
if(parents[depth-1] && parents[depth-1].match(/^(case|default)$/)) {
|
|
244
|
+
depth--;
|
|
245
|
+
caseBody = false;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (token.type === "paren.lparen") {
|
|
249
|
+
roundDepth += (value.match(/\(/g) || []).length;
|
|
250
|
+
curlyDepth += (value.match(/\{/g) || []).length;
|
|
251
|
+
depth += value.length;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (token.type === "keyword" && value.match(/^(if|else|elseif|for|while)$/)) {
|
|
255
|
+
indentNextLine = true;
|
|
256
|
+
roundDepth = 0;
|
|
257
|
+
} else if (!roundDepth && value.trim() && token.type !== "comment")
|
|
258
|
+
indentNextLine = false;
|
|
259
|
+
|
|
260
|
+
if (token.type === "paren.rparen") {
|
|
261
|
+
roundDepth -= (value.match(/\)/g) || []).length;
|
|
262
|
+
curlyDepth -= (value.match(/\}/g) || []).length;
|
|
263
|
+
|
|
264
|
+
for (i = 0; i < value.length; i++) {
|
|
265
|
+
depth--;
|
|
266
|
+
if(value.substr(i, 1)==='}' && parents[depth]==='case') {
|
|
267
|
+
depth--;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (token.type == "text")
|
|
273
|
+
value = value.replace(/\s+$/, " ");
|
|
274
|
+
if (spaceBefore && !breakBefore) {
|
|
275
|
+
trimLine();
|
|
276
|
+
if (code.substr(-1) !== "\n")
|
|
277
|
+
code += " ";
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
code += value;
|
|
281
|
+
|
|
282
|
+
if (spaceAfter)
|
|
283
|
+
code += " ";
|
|
284
|
+
|
|
285
|
+
breakBefore = false;
|
|
286
|
+
spaceBefore = false;
|
|
287
|
+
spaceAfter = false;
|
|
288
|
+
if ((is(token, "tag-close") && (inBlock || blockTags.indexOf(tagName) !== -1)) || (is(token, "doctype") && value === ">")) {
|
|
289
|
+
if (inBlock && nextToken && nextToken.value === "</")
|
|
290
|
+
rowsToAdd = -1;
|
|
291
|
+
else
|
|
292
|
+
rowsToAdd = 1;
|
|
293
|
+
}
|
|
294
|
+
if (is(token, "tag-open") && value === "</") {
|
|
295
|
+
depth--;
|
|
296
|
+
} else if (is(token, "tag-open") && value === "<" && singletonTags.indexOf(nextToken.value) === -1) {
|
|
297
|
+
depth++;
|
|
298
|
+
} else if (is(token, "tag-name")) {
|
|
299
|
+
tagName = value;
|
|
300
|
+
} else if (is(token, "tag-close") && value === "/>" && singletonTags.indexOf(tagName) === -1){
|
|
301
|
+
depth--;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
row = curRow;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
token = nextToken;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
code = code.trim();
|
|
312
|
+
session.doc.setValue(code);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
exports.commands = [{
|
|
316
|
+
name: "beautify",
|
|
317
|
+
description: "Format selection (Beautify)",
|
|
318
|
+
exec: function(editor) {
|
|
319
|
+
exports.beautify(editor.session);
|
|
320
|
+
},
|
|
321
|
+
bindKey: "Ctrl-Shift-B"
|
|
322
|
+
}];
|
|
323
|
+
|
|
324
|
+
}); (function() {
|
|
325
|
+
ace.require(["ace/ext/beautify"], function(m) {
|
|
326
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
|
327
|
+
module.exports = m;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
})();
|
|
331
|
+
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
ace.define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var ElasticTabstopsLite = function(editor) {
|
|
5
|
+
this.$editor = editor;
|
|
6
|
+
var self = this;
|
|
7
|
+
var changedRows = [];
|
|
8
|
+
var recordChanges = false;
|
|
9
|
+
this.onAfterExec = function() {
|
|
10
|
+
recordChanges = false;
|
|
11
|
+
self.processRows(changedRows);
|
|
12
|
+
changedRows = [];
|
|
13
|
+
};
|
|
14
|
+
this.onExec = function() {
|
|
15
|
+
recordChanges = true;
|
|
16
|
+
};
|
|
17
|
+
this.onChange = function(delta) {
|
|
18
|
+
if (recordChanges) {
|
|
19
|
+
if (changedRows.indexOf(delta.start.row) == -1)
|
|
20
|
+
changedRows.push(delta.start.row);
|
|
21
|
+
if (delta.end.row != delta.start.row)
|
|
22
|
+
changedRows.push(delta.end.row);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
(function() {
|
|
28
|
+
this.processRows = function(rows) {
|
|
29
|
+
this.$inChange = true;
|
|
30
|
+
var checkedRows = [];
|
|
31
|
+
|
|
32
|
+
for (var r = 0, rowCount = rows.length; r < rowCount; r++) {
|
|
33
|
+
var row = rows[r];
|
|
34
|
+
|
|
35
|
+
if (checkedRows.indexOf(row) > -1)
|
|
36
|
+
continue;
|
|
37
|
+
|
|
38
|
+
var cellWidthObj = this.$findCellWidthsForBlock(row);
|
|
39
|
+
var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);
|
|
40
|
+
var rowIndex = cellWidthObj.firstRow;
|
|
41
|
+
|
|
42
|
+
for (var w = 0, l = cellWidths.length; w < l; w++) {
|
|
43
|
+
var widths = cellWidths[w];
|
|
44
|
+
checkedRows.push(rowIndex);
|
|
45
|
+
this.$adjustRow(rowIndex, widths);
|
|
46
|
+
rowIndex++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
this.$inChange = false;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
this.$findCellWidthsForBlock = function(row) {
|
|
53
|
+
var cellWidths = [], widths;
|
|
54
|
+
var rowIter = row;
|
|
55
|
+
while (rowIter >= 0) {
|
|
56
|
+
widths = this.$cellWidthsForRow(rowIter);
|
|
57
|
+
if (widths.length == 0)
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
cellWidths.unshift(widths);
|
|
61
|
+
rowIter--;
|
|
62
|
+
}
|
|
63
|
+
var firstRow = rowIter + 1;
|
|
64
|
+
rowIter = row;
|
|
65
|
+
var numRows = this.$editor.session.getLength();
|
|
66
|
+
|
|
67
|
+
while (rowIter < numRows - 1) {
|
|
68
|
+
rowIter++;
|
|
69
|
+
|
|
70
|
+
widths = this.$cellWidthsForRow(rowIter);
|
|
71
|
+
if (widths.length == 0)
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
cellWidths.push(widths);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return { cellWidths: cellWidths, firstRow: firstRow };
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
this.$cellWidthsForRow = function(row) {
|
|
81
|
+
var selectionColumns = this.$selectionColumnsForRow(row);
|
|
82
|
+
|
|
83
|
+
var tabs = [-1].concat(this.$tabsForRow(row));
|
|
84
|
+
var widths = tabs.map(function(el) { return 0; } ).slice(1);
|
|
85
|
+
var line = this.$editor.session.getLine(row);
|
|
86
|
+
|
|
87
|
+
for (var i = 0, len = tabs.length - 1; i < len; i++) {
|
|
88
|
+
var leftEdge = tabs[i]+1;
|
|
89
|
+
var rightEdge = tabs[i+1];
|
|
90
|
+
|
|
91
|
+
var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge);
|
|
92
|
+
var cell = line.substring(leftEdge, rightEdge);
|
|
93
|
+
widths[i] = Math.max(cell.replace(/\s+$/g,'').length, rightmostSelection - leftEdge);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return widths;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
this.$selectionColumnsForRow = function(row) {
|
|
100
|
+
var selections = [], cursor = this.$editor.getCursorPosition();
|
|
101
|
+
if (this.$editor.session.getSelection().isEmpty()) {
|
|
102
|
+
if (row == cursor.row)
|
|
103
|
+
selections.push(cursor.column);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return selections;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
this.$setBlockCellWidthsToMax = function(cellWidths) {
|
|
110
|
+
var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth;
|
|
111
|
+
var columnInfo = this.$izip_longest(cellWidths);
|
|
112
|
+
|
|
113
|
+
for (var c = 0, l = columnInfo.length; c < l; c++) {
|
|
114
|
+
var column = columnInfo[c];
|
|
115
|
+
if (!column.push) {
|
|
116
|
+
console.error(column);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
column.push(NaN);
|
|
120
|
+
|
|
121
|
+
for (var r = 0, s = column.length; r < s; r++) {
|
|
122
|
+
var width = column[r];
|
|
123
|
+
if (startingNewBlock) {
|
|
124
|
+
blockStartRow = r;
|
|
125
|
+
maxWidth = 0;
|
|
126
|
+
startingNewBlock = false;
|
|
127
|
+
}
|
|
128
|
+
if (isNaN(width)) {
|
|
129
|
+
blockEndRow = r;
|
|
130
|
+
|
|
131
|
+
for (var j = blockStartRow; j < blockEndRow; j++) {
|
|
132
|
+
cellWidths[j][c] = maxWidth;
|
|
133
|
+
}
|
|
134
|
+
startingNewBlock = true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
maxWidth = Math.max(maxWidth, width);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return cellWidths;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
this.$rightmostSelectionInCell = function(selectionColumns, cellRightEdge) {
|
|
145
|
+
var rightmost = 0;
|
|
146
|
+
|
|
147
|
+
if (selectionColumns.length) {
|
|
148
|
+
var lengths = [];
|
|
149
|
+
for (var s = 0, length = selectionColumns.length; s < length; s++) {
|
|
150
|
+
if (selectionColumns[s] <= cellRightEdge)
|
|
151
|
+
lengths.push(s);
|
|
152
|
+
else
|
|
153
|
+
lengths.push(0);
|
|
154
|
+
}
|
|
155
|
+
rightmost = Math.max.apply(Math, lengths);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return rightmost;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
this.$tabsForRow = function(row) {
|
|
162
|
+
var rowTabs = [], line = this.$editor.session.getLine(row),
|
|
163
|
+
re = /\t/g, match;
|
|
164
|
+
|
|
165
|
+
while ((match = re.exec(line)) != null) {
|
|
166
|
+
rowTabs.push(match.index);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return rowTabs;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
this.$adjustRow = function(row, widths) {
|
|
173
|
+
var rowTabs = this.$tabsForRow(row);
|
|
174
|
+
|
|
175
|
+
if (rowTabs.length == 0)
|
|
176
|
+
return;
|
|
177
|
+
|
|
178
|
+
var bias = 0, location = -1;
|
|
179
|
+
var expandedSet = this.$izip(widths, rowTabs);
|
|
180
|
+
|
|
181
|
+
for (var i = 0, l = expandedSet.length; i < l; i++) {
|
|
182
|
+
var w = expandedSet[i][0], it = expandedSet[i][1];
|
|
183
|
+
location += 1 + w;
|
|
184
|
+
it += bias;
|
|
185
|
+
var difference = location - it;
|
|
186
|
+
|
|
187
|
+
if (difference == 0)
|
|
188
|
+
continue;
|
|
189
|
+
|
|
190
|
+
var partialLine = this.$editor.session.getLine(row).substr(0, it );
|
|
191
|
+
var strippedPartialLine = partialLine.replace(/\s*$/g, "");
|
|
192
|
+
var ispaces = partialLine.length - strippedPartialLine.length;
|
|
193
|
+
|
|
194
|
+
if (difference > 0) {
|
|
195
|
+
this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t");
|
|
196
|
+
this.$editor.session.getDocument().removeInLine(row, it, it + 1);
|
|
197
|
+
|
|
198
|
+
bias += difference;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (difference < 0 && ispaces >= -difference) {
|
|
202
|
+
this.$editor.session.getDocument().removeInLine(row, it + difference, it);
|
|
203
|
+
bias += difference;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
this.$izip_longest = function(iterables) {
|
|
208
|
+
if (!iterables[0])
|
|
209
|
+
return [];
|
|
210
|
+
var longest = iterables[0].length;
|
|
211
|
+
var iterablesLength = iterables.length;
|
|
212
|
+
|
|
213
|
+
for (var i = 1; i < iterablesLength; i++) {
|
|
214
|
+
var iLength = iterables[i].length;
|
|
215
|
+
if (iLength > longest)
|
|
216
|
+
longest = iLength;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
var expandedSet = [];
|
|
220
|
+
|
|
221
|
+
for (var l = 0; l < longest; l++) {
|
|
222
|
+
var set = [];
|
|
223
|
+
for (var i = 0; i < iterablesLength; i++) {
|
|
224
|
+
if (iterables[i][l] === "")
|
|
225
|
+
set.push(NaN);
|
|
226
|
+
else
|
|
227
|
+
set.push(iterables[i][l]);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
expandedSet.push(set);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
return expandedSet;
|
|
235
|
+
};
|
|
236
|
+
this.$izip = function(widths, tabs) {
|
|
237
|
+
var size = widths.length >= tabs.length ? tabs.length : widths.length;
|
|
238
|
+
|
|
239
|
+
var expandedSet = [];
|
|
240
|
+
for (var i = 0; i < size; i++) {
|
|
241
|
+
var set = [ widths[i], tabs[i] ];
|
|
242
|
+
expandedSet.push(set);
|
|
243
|
+
}
|
|
244
|
+
return expandedSet;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
}).call(ElasticTabstopsLite.prototype);
|
|
248
|
+
|
|
249
|
+
exports.ElasticTabstopsLite = ElasticTabstopsLite;
|
|
250
|
+
|
|
251
|
+
var Editor = require("../editor").Editor;
|
|
252
|
+
require("../config").defineOptions(Editor.prototype, "editor", {
|
|
253
|
+
useElasticTabstops: {
|
|
254
|
+
set: function(val) {
|
|
255
|
+
if (val) {
|
|
256
|
+
if (!this.elasticTabstops)
|
|
257
|
+
this.elasticTabstops = new ElasticTabstopsLite(this);
|
|
258
|
+
this.commands.on("afterExec", this.elasticTabstops.onAfterExec);
|
|
259
|
+
this.commands.on("exec", this.elasticTabstops.onExec);
|
|
260
|
+
this.on("change", this.elasticTabstops.onChange);
|
|
261
|
+
} else if (this.elasticTabstops) {
|
|
262
|
+
this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec);
|
|
263
|
+
this.commands.removeListener("exec", this.elasticTabstops.onExec);
|
|
264
|
+
this.removeListener("change", this.elasticTabstops.onChange);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
}); (function() {
|
|
271
|
+
ace.require(["ace/ext/elastic_tabstops_lite"], function(m) {
|
|
272
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
|
273
|
+
module.exports = m;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
})();
|
|
277
|
+
|