@openui5/sap.ui.codeeditor 1.120.7 → 1.121.0
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/.reuse/dep5 +23 -21
- package/THIRDPARTY.txt +6 -43
- package/package.json +2 -2
- package/src/sap/ui/codeeditor/.library +2 -2
- package/src/sap/ui/codeeditor/CodeEditor.js +41 -27
- package/src/sap/ui/codeeditor/js/ace/ace.js +16262 -16597
- package/src/sap/ui/codeeditor/js/ace/css/ace.css +358 -86
- package/src/sap/ui/codeeditor/js/ace/css/ambiance-3.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/chrome-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cloud9_day-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cloud9_day-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cloud9_night-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cloud9_night-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cloud9_night_low_color-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cloud9_night_low_color-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/clouds-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/clouds_midnight-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cobalt-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/crimson_editor-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/dawn-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/dracula-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/dreamweaver-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/eclipse-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/github-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/github_dark-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/github_dark-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/gob-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/gruvbox-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/gruvbox_dark_hard-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/gruvbox_light_hard-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/gruvbox_light_hard-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/idle_fingers-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/iplastic-3.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/katzenmilch-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/katzenmilch-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/kr_theme-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/kuroir-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/kuroir-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-10.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-11.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-12.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-13.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-14.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-15.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-16.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-17.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-18.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-19.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-20.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-21.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-22.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-22.svg +1 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-23.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-5.svg +7 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-6.svg +7 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-7.svg +9 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-8.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-8.svg +4 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-9.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-9.svg +4 -0
- package/src/sap/ui/codeeditor/js/ace/css/merbivore-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/merbivore_soft-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/mono_industrial-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/monokai-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/one_dark-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/pastel_on_dark-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/solarized_dark-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/solarized_light-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/sqlserver-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/terminal-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/textmate-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/ambiance.css +120 -68
- package/src/sap/ui/codeeditor/js/ace/css/theme/chaos.css +79 -66
- package/src/sap/ui/codeeditor/js/ace/css/theme/chrome.css +82 -43
- package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_day.css +160 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_night.css +146 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_night_low_color.css +134 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/clouds.css +59 -31
- package/src/sap/ui/codeeditor/js/ace/css/theme/clouds_midnight.css +60 -32
- package/src/sap/ui/codeeditor/js/ace/css/theme/cobalt.css +71 -38
- package/src/sap/ui/codeeditor/js/ace/css/theme/crimson_editor.css +79 -42
- package/src/sap/ui/codeeditor/js/ace/css/theme/dawn.css +70 -40
- package/src/sap/ui/codeeditor/js/ace/css/theme/dracula.css +95 -49
- package/src/sap/ui/codeeditor/js/ace/css/theme/dreamweaver.css +95 -49
- package/src/sap/ui/codeeditor/js/ace/css/theme/eclipse.css +62 -33
- package/src/sap/ui/codeeditor/js/ace/css/theme/github.css +71 -38
- package/src/sap/ui/codeeditor/js/ace/css/theme/github_dark.css +134 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/gob.css +68 -38
- package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox.css +54 -28
- package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox_dark_hard.css +163 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox_light_hard.css +167 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/idle_fingers.css +62 -34
- package/src/sap/ui/codeeditor/js/ace/css/theme/iplastic.css +76 -45
- package/src/sap/ui/codeeditor/js/ace/css/theme/katzenmilch.css +91 -53
- package/src/sap/ui/codeeditor/js/ace/css/theme/kr_theme.css +67 -36
- package/src/sap/ui/codeeditor/js/ace/css/theme/kuroir.css +43 -17
- package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore.css +57 -31
- package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore_soft.css +57 -31
- package/src/sap/ui/codeeditor/js/ace/css/theme/mono_industrial.css +66 -36
- package/src/sap/ui/codeeditor/js/ace/css/theme/monokai.css +63 -35
- package/src/sap/ui/codeeditor/js/ace/css/theme/nord_dark.css +55 -29
- package/src/sap/ui/codeeditor/js/ace/css/theme/one_dark.css +88 -47
- package/src/sap/ui/codeeditor/js/ace/css/theme/pastel_on_dark.css +70 -38
- package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_dark.css +52 -28
- package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_light.css +55 -29
- package/src/sap/ui/codeeditor/js/ace/css/theme/sqlserver.css +90 -48
- package/src/sap/ui/codeeditor/js/ace/css/theme/terminal.css +64 -34
- package/src/sap/ui/codeeditor/js/ace/css/theme/textmate.css +82 -43
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow.css +61 -33
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night.css +61 -33
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_blue.css +59 -32
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_bright.css +71 -40
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_eighties.css +61 -33
- package/src/sap/ui/codeeditor/js/ace/css/theme/twilight.css +66 -36
- package/src/sap/ui/codeeditor/js/ace/css/theme/vibrant_ink.css +59 -32
- package/src/sap/ui/codeeditor/js/ace/css/theme/xcode.css +54 -28
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_blue-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_bright-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_eighties-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/twilight-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/vibrant_ink-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/xcode-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/ext-beautify.js +90 -91
- package/src/sap/ui/codeeditor/js/ace/ext-code_lens.js +39 -75
- package/src/sap/ui/codeeditor/js/ace/ext-command_bar.js +457 -0
- package/src/sap/ui/codeeditor/js/ace/ext-elastic_tabstops_lite.js +47 -97
- package/src/sap/ui/codeeditor/js/ace/ext-emmet.js +496 -552
- package/src/sap/ui/codeeditor/js/ace/ext-hardwrap.js +47 -16
- package/src/sap/ui/codeeditor/js/ace/ext-inline_autocomplete.js +3269 -0
- package/src/sap/ui/codeeditor/js/ace/ext-keybinding_menu.js +45 -105
- package/src/sap/ui/codeeditor/js/ace/ext-language_tools.js +1438 -1128
- package/src/sap/ui/codeeditor/js/ace/ext-linking.js +8 -16
- package/src/sap/ui/codeeditor/js/ace/ext-modelist.js +198 -185
- package/src/sap/ui/codeeditor/js/ace/ext-options.js +405 -443
- package/src/sap/ui/codeeditor/js/ace/ext-prompt.js +1682 -1508
- package/src/sap/ui/codeeditor/js/ace/ext-rtl.js +26 -28
- package/src/sap/ui/codeeditor/js/ace/ext-searchbox.js +160 -332
- package/src/sap/ui/codeeditor/js/ace/ext-settings_menu.js +409 -446
- package/src/sap/ui/codeeditor/js/ace/ext-simple_tokenizer.js +45 -0
- package/src/sap/ui/codeeditor/js/ace/ext-spellcheck.js +4 -10
- package/src/sap/ui/codeeditor/js/ace/ext-split.js +41 -63
- package/src/sap/ui/codeeditor/js/ace/ext-statusbar.js +19 -27
- package/src/sap/ui/codeeditor/js/ace/ext-themelist.js +45 -41
- package/src/sap/ui/codeeditor/js/ace/ext-whitespace.js +62 -83
- package/src/sap/ui/codeeditor/js/ace/keybinding-emacs.js +442 -551
- package/src/sap/ui/codeeditor/js/ace/keybinding-sublime.js +338 -351
- package/src/sap/ui/codeeditor/js/ace/keybinding-vim.js +5242 -4758
- package/src/sap/ui/codeeditor/js/ace/keybinding-vscode.js +228 -235
- package/src/sap/ui/codeeditor/js/ace/mode-abap.js +72 -93
- package/src/sap/ui/codeeditor/js/ace/mode-abc.js +136 -164
- package/src/sap/ui/codeeditor/js/ace/mode-actionscript.js +109 -150
- package/src/sap/ui/codeeditor/js/ace/mode-ada.js +45 -74
- package/src/sap/ui/codeeditor/js/ace/mode-alda.js +77 -109
- package/src/sap/ui/codeeditor/js/ace/mode-apache_conf.js +196 -241
- package/src/sap/ui/codeeditor/js/ace/mode-apex.js +192 -247
- package/src/sap/ui/codeeditor/js/ace/mode-applescript.js +56 -102
- package/src/sap/ui/codeeditor/js/ace/mode-aql.js +85 -95
- package/src/sap/ui/codeeditor/js/ace/mode-asciidoc.js +120 -158
- package/src/sap/ui/codeeditor/js/ace/mode-asl.js +233 -298
- package/src/sap/ui/codeeditor/js/ace/mode-assembly_x86.js +78 -101
- package/src/sap/ui/codeeditor/js/ace/mode-astro.js +2414 -0
- package/src/sap/ui/codeeditor/js/ace/mode-autohotkey.js +80 -116
- package/src/sap/ui/codeeditor/js/ace/mode-batchfile.js +74 -105
- package/src/sap/ui/codeeditor/js/ace/mode-bibtex.js +318 -0
- package/src/sap/ui/codeeditor/js/ace/mode-c9search.js +72 -115
- package/src/sap/ui/codeeditor/js/ace/mode-c_cpp.js +171 -257
- package/src/sap/ui/codeeditor/js/ace/mode-cirru.js +97 -115
- package/src/sap/ui/codeeditor/js/ace/mode-clojure.js +126 -119
- package/src/sap/ui/codeeditor/js/ace/mode-cobol.js +48 -67
- package/src/sap/ui/codeeditor/js/ace/mode-coffee.js +203 -268
- package/src/sap/ui/codeeditor/js/ace/mode-coldfusion.js +1029 -1276
- package/src/sap/ui/codeeditor/js/ace/mode-crystal.js +337 -393
- package/src/sap/ui/codeeditor/js/ace/mode-csharp.js +127 -216
- package/src/sap/ui/codeeditor/js/ace/mode-csound_document.js +1539 -1569
- package/src/sap/ui/codeeditor/js/ace/mode-csound_orchestra.js +786 -898
- package/src/sap/ui/codeeditor/js/ace/mode-csound_score.js +184 -237
- package/src/sap/ui/codeeditor/js/ace/mode-csp.js +37 -37
- package/src/sap/ui/codeeditor/js/ace/mode-css.js +293 -384
- package/src/sap/ui/codeeditor/js/ace/mode-curly.js +1019 -1262
- package/src/sap/ui/codeeditor/js/ace/mode-cuttlefish.js +56 -0
- package/src/sap/ui/codeeditor/js/ace/mode-d.js +163 -233
- package/src/sap/ui/codeeditor/js/ace/mode-dart.js +330 -427
- package/src/sap/ui/codeeditor/js/ace/mode-diff.js +20 -38
- package/src/sap/ui/codeeditor/js/ace/mode-django.js +1032 -1271
- package/src/sap/ui/codeeditor/js/ace/mode-dockerfile.js +211 -284
- package/src/sap/ui/codeeditor/js/ace/mode-dot.js +131 -200
- package/src/sap/ui/codeeditor/js/ace/mode-drools.js +408 -349
- package/src/sap/ui/codeeditor/js/ace/mode-edifact.js +89 -125
- package/src/sap/ui/codeeditor/js/ace/mode-eiffel.js +47 -62
- package/src/sap/ui/codeeditor/js/ace/mode-ejs.js +1350 -1666
- package/src/sap/ui/codeeditor/js/ace/mode-elixir.js +349 -407
- package/src/sap/ui/codeeditor/js/ace/mode-elm.js +136 -168
- package/src/sap/ui/codeeditor/js/ace/mode-erlang.js +707 -881
- package/src/sap/ui/codeeditor/js/ace/mode-flix.js +164 -0
- package/src/sap/ui/codeeditor/js/ace/mode-forth.js +128 -172
- package/src/sap/ui/codeeditor/js/ace/mode-fortran.js +177 -246
- package/src/sap/ui/codeeditor/js/ace/mode-fsharp.js +92 -131
- package/src/sap/ui/codeeditor/js/ace/mode-fsl.js +91 -124
- package/src/sap/ui/codeeditor/js/ace/mode-ftl.js +813 -748
- package/src/sap/ui/codeeditor/js/ace/mode-gcode.js +52 -71
- package/src/sap/ui/codeeditor/js/ace/mode-gherkin.js +105 -119
- package/src/sap/ui/codeeditor/js/ace/mode-gitignore.js +12 -22
- package/src/sap/ui/codeeditor/js/ace/mode-glsl.js +184 -289
- package/src/sap/ui/codeeditor/js/ace/mode-gobstones.js +686 -623
- package/src/sap/ui/codeeditor/js/ace/mode-golang.js +167 -239
- package/src/sap/ui/codeeditor/js/ace/mode-graphqlschema.js +48 -88
- package/src/sap/ui/codeeditor/js/ace/mode-groovy.js +577 -471
- package/src/sap/ui/codeeditor/js/ace/mode-haml.js +1062 -1026
- package/src/sap/ui/codeeditor/js/ace/mode-handlebars.js +1061 -1305
- package/src/sap/ui/codeeditor/js/ace/mode-haskell.js +199 -255
- package/src/sap/ui/codeeditor/js/ace/mode-haskell_cabal.js +81 -87
- package/src/sap/ui/codeeditor/js/ace/mode-haxe.js +111 -184
- package/src/sap/ui/codeeditor/js/ace/mode-hjson.js +164 -199
- package/src/sap/ui/codeeditor/js/ace/mode-html.js +1009 -1239
- package/src/sap/ui/codeeditor/js/ace/mode-html_elixir.js +1402 -1705
- package/src/sap/ui/codeeditor/js/ace/mode-html_ruby.js +1390 -1706
- package/src/sap/ui/codeeditor/js/ace/mode-ini.js +58 -82
- package/src/sap/ui/codeeditor/js/ace/mode-io.js +85 -123
- package/src/sap/ui/codeeditor/js/ace/mode-ion.js +477 -0
- package/src/sap/ui/codeeditor/js/ace/mode-jack.js +109 -162
- package/src/sap/ui/codeeditor/js/ace/mode-jade.js +1339 -1344
- package/src/sap/ui/codeeditor/js/ace/mode-java.js +710 -498
- package/src/sap/ui/codeeditor/js/ace/mode-javascript.js +441 -354
- package/src/sap/ui/codeeditor/js/ace/mode-jexl.js +270 -0
- package/src/sap/ui/codeeditor/js/ace/mode-json.js +93 -147
- package/src/sap/ui/codeeditor/js/ace/mode-json5.js +128 -180
- package/src/sap/ui/codeeditor/js/ace/mode-jsoniq.js +58 -112
- package/src/sap/ui/codeeditor/js/ace/mode-jsp.js +1045 -865
- package/src/sap/ui/codeeditor/js/ace/mode-jssm.js +158 -190
- package/src/sap/ui/codeeditor/js/ace/mode-jsx.js +121 -194
- package/src/sap/ui/codeeditor/js/ace/mode-julia.js +128 -177
- package/src/sap/ui/codeeditor/js/ace/mode-kotlin.js +262 -614
- package/src/sap/ui/codeeditor/js/ace/mode-latex.js +94 -138
- package/src/sap/ui/codeeditor/js/ace/mode-latte.js +1120 -1366
- package/src/sap/ui/codeeditor/js/ace/mode-less.js +342 -442
- package/src/sap/ui/codeeditor/js/ace/mode-liquid.js +1353 -1414
- package/src/sap/ui/codeeditor/js/ace/mode-lisp.js +65 -73
- package/src/sap/ui/codeeditor/js/ace/mode-livescript.js +217 -224
- package/src/sap/ui/codeeditor/js/ace/mode-logiql.js +97 -142
- package/src/sap/ui/codeeditor/js/ace/mode-logtalk.js +187 -227
- package/src/sap/ui/codeeditor/js/ace/mode-lsl.js +99 -155
- package/src/sap/ui/codeeditor/js/ace/mode-lua.js +152 -211
- package/src/sap/ui/codeeditor/js/ace/mode-luapage.js +1167 -1470
- package/src/sap/ui/codeeditor/js/ace/mode-lucene.js +25 -34
- package/src/sap/ui/codeeditor/js/ace/mode-makefile.js +244 -282
- package/src/sap/ui/codeeditor/js/ace/mode-markdown.js +1858 -2177
- package/src/sap/ui/codeeditor/js/ace/mode-mask.js +964 -1007
- package/src/sap/ui/codeeditor/js/ace/mode-matlab.js +197 -221
- package/src/sap/ui/codeeditor/js/ace/mode-maze.js +127 -163
- package/src/sap/ui/codeeditor/js/ace/mode-mediawiki.js +464 -476
- package/src/sap/ui/codeeditor/js/ace/mode-mel.js +90 -140
- package/src/sap/ui/codeeditor/js/ace/mode-mips.js +101 -134
- package/src/sap/ui/codeeditor/js/ace/mode-mixal.js +63 -75
- package/src/sap/ui/codeeditor/js/ace/mode-mushcode.js +537 -576
- package/src/sap/ui/codeeditor/js/ace/mode-mysql.js +85 -102
- package/src/sap/ui/codeeditor/js/ace/mode-nasal.js +513 -0
- package/src/sap/ui/codeeditor/js/ace/mode-nginx.js +119 -155
- package/src/sap/ui/codeeditor/js/ace/mode-nim.js +159 -197
- package/src/sap/ui/codeeditor/js/ace/mode-nix.js +283 -375
- package/src/sap/ui/codeeditor/js/ace/mode-nsis.js +139 -172
- package/src/sap/ui/codeeditor/js/ace/mode-nunjucks.js +1138 -1378
- package/src/sap/ui/codeeditor/js/ace/mode-objectivec.js +400 -514
- package/src/sap/ui/codeeditor/js/ace/mode-ocaml.js +77 -120
- package/src/sap/ui/codeeditor/js/ace/mode-odin.js +449 -0
- package/src/sap/ui/codeeditor/js/ace/mode-partiql.js +750 -0
- package/src/sap/ui/codeeditor/js/ace/mode-pascal.js +28 -47
- package/src/sap/ui/codeeditor/js/ace/mode-perl.js +122 -185
- package/src/sap/ui/codeeditor/js/ace/mode-pgsql.js +974 -851
- package/src/sap/ui/codeeditor/js/ace/mode-php.js +2282 -1502
- package/src/sap/ui/codeeditor/js/ace/mode-php_laravel_blade.js +2463 -1696
- package/src/sap/ui/codeeditor/js/ace/mode-pig.js +133 -165
- package/src/sap/ui/codeeditor/js/ace/mode-plain_text.js +5 -10
- package/src/sap/ui/codeeditor/js/ace/mode-plsql.js +268 -0
- package/src/sap/ui/codeeditor/js/ace/mode-powershell.js +332 -183
- package/src/sap/ui/codeeditor/js/ace/mode-praat.js +168 -234
- package/src/sap/ui/codeeditor/js/ace/mode-prisma.js +292 -324
- package/src/sap/ui/codeeditor/js/ace/mode-prolog.js +180 -246
- package/src/sap/ui/codeeditor/js/ace/mode-properties.js +26 -37
- package/src/sap/ui/codeeditor/js/ace/mode-protobuf.js +232 -327
- package/src/sap/ui/codeeditor/js/ace/mode-prql.js +320 -0
- package/src/sap/ui/codeeditor/js/ace/mode-puppet.js +68 -120
- package/src/sap/ui/codeeditor/js/ace/mode-python.js +338 -370
- package/src/sap/ui/codeeditor/js/ace/mode-qml.js +244 -279
- package/src/sap/ui/codeeditor/js/ace/mode-r.js +295 -220
- package/src/sap/ui/codeeditor/js/ace/mode-raku.js +356 -433
- package/src/sap/ui/codeeditor/js/ace/mode-razor.js +1130 -1374
- package/src/sap/ui/codeeditor/js/ace/mode-rdoc.js +214 -171
- package/src/sap/ui/codeeditor/js/ace/mode-red.js +212 -274
- package/src/sap/ui/codeeditor/js/ace/mode-redshift.js +181 -220
- package/src/sap/ui/codeeditor/js/ace/mode-rhtml.js +1325 -1443
- package/src/sap/ui/codeeditor/js/ace/mode-robot.js +168 -0
- package/src/sap/ui/codeeditor/js/ace/mode-rst.js +217 -229
- package/src/sap/ui/codeeditor/js/ace/mode-ruby.js +338 -420
- package/src/sap/ui/codeeditor/js/ace/mode-rust.js +258 -155
- package/src/sap/ui/codeeditor/js/ace/mode-sac.js +349 -0
- package/src/sap/ui/codeeditor/js/ace/mode-sass.js +257 -309
- package/src/sap/ui/codeeditor/js/ace/mode-scad.js +127 -191
- package/src/sap/ui/codeeditor/js/ace/mode-scala.js +572 -468
- package/src/sap/ui/codeeditor/js/ace/mode-scheme.js +104 -126
- package/src/sap/ui/codeeditor/js/ace/mode-scrypt.js +181 -228
- package/src/sap/ui/codeeditor/js/ace/mode-scss.js +364 -472
- package/src/sap/ui/codeeditor/js/ace/mode-sh.js +204 -266
- package/src/sap/ui/codeeditor/js/ace/mode-sjs.js +477 -405
- package/src/sap/ui/codeeditor/js/ace/mode-slim.js +2631 -3161
- package/src/sap/ui/codeeditor/js/ace/mode-smarty.js +1075 -1334
- package/src/sap/ui/codeeditor/js/ace/mode-smithy.js +276 -327
- package/src/sap/ui/codeeditor/js/ace/mode-snippets.js +78 -102
- package/src/sap/ui/codeeditor/js/ace/mode-soy_template.js +1251 -1548
- package/src/sap/ui/codeeditor/js/ace/mode-space.js +47 -63
- package/src/sap/ui/codeeditor/js/ace/mode-sparql.js +139 -171
- package/src/sap/ui/codeeditor/js/ace/mode-sql.js +77 -133
- package/src/sap/ui/codeeditor/js/ace/mode-sqlserver.js +138 -192
- package/src/sap/ui/codeeditor/js/ace/mode-stylus.js +306 -338
- package/src/sap/ui/codeeditor/js/ace/mode-svg.js +642 -794
- package/src/sap/ui/codeeditor/js/ace/mode-swift.js +96 -150
- package/src/sap/ui/codeeditor/js/ace/mode-tcl.js +151 -200
- package/src/sap/ui/codeeditor/js/ace/mode-terraform.js +78 -132
- package/src/sap/ui/codeeditor/js/ace/mode-tex.js +148 -96
- package/src/sap/ui/codeeditor/js/ace/mode-textile.js +45 -70
- package/src/sap/ui/codeeditor/js/ace/mode-toml.js +63 -87
- package/src/sap/ui/codeeditor/js/ace/mode-tsx.js +462 -384
- package/src/sap/ui/codeeditor/js/ace/mode-turtle.js +119 -151
- package/src/sap/ui/codeeditor/js/ace/mode-twig.js +1099 -1350
- package/src/sap/ui/codeeditor/js/ace/mode-typescript.js +455 -376
- package/src/sap/ui/codeeditor/js/ace/mode-vala.js +382 -505
- package/src/sap/ui/codeeditor/js/ace/mode-vbscript.js +231 -264
- package/src/sap/ui/codeeditor/js/ace/mode-velocity.js +1116 -1388
- package/src/sap/ui/codeeditor/js/ace/mode-verilog.js +61 -81
- package/src/sap/ui/codeeditor/js/ace/mode-vhdl.js +57 -79
- package/src/sap/ui/codeeditor/js/ace/mode-visualforce.js +1046 -1292
- package/src/sap/ui/codeeditor/js/ace/mode-wollok.js +525 -417
- package/src/sap/ui/codeeditor/js/ace/mode-xml.js +182 -389
- package/src/sap/ui/codeeditor/js/ace/mode-xquery.js +58 -112
- package/src/sap/ui/codeeditor/js/ace/mode-yaml.js +202 -137
- package/src/sap/ui/codeeditor/js/ace/mode-zeek.js +237 -274
- package/src/sap/ui/codeeditor/js/ace/snippets/abc.js +5 -34
- package/src/sap/ui/codeeditor/js/ace/snippets/actionscript.js +5 -160
- package/src/sap/ui/codeeditor/js/ace/snippets/astro.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/bibtex.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/c_cpp.js +5 -134
- package/src/sap/ui/codeeditor/js/ace/snippets/clojure.js +5 -93
- package/src/sap/ui/codeeditor/js/ace/snippets/coffee.js +5 -98
- package/src/sap/ui/codeeditor/js/ace/snippets/csound_document.js +5 -13
- package/src/sap/ui/codeeditor/js/ace/snippets/csound_orchestra.js +5 -50
- package/src/sap/ui/codeeditor/js/ace/snippets/css.js +5 -970
- package/src/sap/ui/codeeditor/js/ace/snippets/cuttlefish.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/dart.js +5 -86
- package/src/sap/ui/codeeditor/js/ace/snippets/diff.js +5 -14
- package/src/sap/ui/codeeditor/js/ace/snippets/django.js +5 -111
- package/src/sap/ui/codeeditor/js/ace/snippets/drools.js +5 -22
- package/src/sap/ui/codeeditor/js/ace/snippets/edifact.js +8 -246
- package/src/sap/ui/codeeditor/js/ace/snippets/erlang.js +5 -163
- package/src/sap/ui/codeeditor/js/ace/snippets/flix.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/fsl.js +6 -4
- package/src/sap/ui/codeeditor/js/ace/snippets/gobstones.js +5 -1707
- package/src/sap/ui/codeeditor/js/ace/snippets/graphqlschema.js +5 -35
- package/src/sap/ui/codeeditor/js/ace/snippets/haml.js +5 -23
- package/src/sap/ui/codeeditor/js/ace/snippets/haskell.js +5 -85
- package/src/sap/ui/codeeditor/js/ace/snippets/html.js +5 -856
- package/src/sap/ui/codeeditor/js/ace/snippets/io.js +1 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/ion.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/java.js +5 -243
- package/src/sap/ui/codeeditor/js/ace/snippets/javascript.js +5 -198
- package/src/sap/ui/codeeditor/js/ace/snippets/jexl.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/jsoniq.js +44 -41
- package/src/sap/ui/codeeditor/js/ace/snippets/jsp.js +5 -102
- package/src/sap/ui/codeeditor/js/ace/snippets/liquid.js +5 -884
- package/src/sap/ui/codeeditor/js/ace/snippets/lsl.js +5 -1235
- package/src/sap/ui/codeeditor/js/ace/snippets/lua.js +5 -24
- package/src/sap/ui/codeeditor/js/ace/snippets/makefile.js +5 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/markdown.js +5 -91
- package/src/sap/ui/codeeditor/js/ace/snippets/maze.js +5 -12
- package/src/sap/ui/codeeditor/js/ace/snippets/nasal.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/odin.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/partiql.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/perl.js +5 -350
- package/src/sap/ui/codeeditor/js/ace/snippets/php.js +5 -386
- package/src/sap/ui/codeeditor/js/ace/snippets/plsql.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/prql.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/python.js +5 -161
- package/src/sap/ui/codeeditor/js/ace/snippets/r.js +5 -124
- package/src/sap/ui/codeeditor/js/ace/snippets/razor.js +5 -6
- package/src/sap/ui/codeeditor/js/ace/snippets/robot.js +16 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/rst.js +5 -25
- package/src/sap/ui/codeeditor/js/ace/snippets/ruby.js +5 -931
- package/src/sap/ui/codeeditor/js/ace/snippets/sac.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/sh.js +5 -86
- package/src/sap/ui/codeeditor/js/ace/snippets/snippets.js +5 -12
- package/src/sap/ui/codeeditor/js/ace/snippets/sql.js +5 -29
- package/src/sap/ui/codeeditor/js/ace/snippets/sqlserver.js +5 -72
- package/src/sap/ui/codeeditor/js/ace/snippets/tcl.js +5 -95
- package/src/sap/ui/codeeditor/js/ace/snippets/tex.js +5 -193
- package/src/sap/ui/codeeditor/js/ace/snippets/textile.js +5 -33
- package/src/sap/ui/codeeditor/js/ace/snippets/vala.js +1 -2
- package/src/sap/ui/codeeditor/js/ace/snippets/velocity.js +5 -31
- package/src/sap/ui/codeeditor/js/ace/snippets/wollok.js +5 -87
- package/src/sap/ui/codeeditor/js/ace/snippets/xquery.js +44 -41
- package/src/sap/ui/codeeditor/js/ace/theme-ambiance.js +5 -172
- package/src/sap/ui/codeeditor/js/ace/theme-chaos.js +5 -150
- package/src/sap/ui/codeeditor/js/ace/theme-chrome.js +6 -123
- package/src/sap/ui/codeeditor/js/ace/theme-cloud9_day.js +19 -0
- package/src/sap/ui/codeeditor/js/ace/theme-cloud9_night.js +18 -0
- package/src/sap/ui/codeeditor/js/ace/theme-cloud9_night_low_color.js +18 -0
- package/src/sap/ui/codeeditor/js/ace/theme-clouds.js +6 -90
- package/src/sap/ui/codeeditor/js/ace/theme-clouds_midnight.js +6 -91
- package/src/sap/ui/codeeditor/js/ace/theme-cobalt.js +6 -108
- package/src/sap/ui/codeeditor/js/ace/theme-crimson_editor.js +6 -113
- package/src/sap/ui/codeeditor/js/ace/theme-dawn.js +6 -103
- package/src/sap/ui/codeeditor/js/ace/theme-dracula.js +6 -122
- package/src/sap/ui/codeeditor/js/ace/theme-dreamweaver.js +7 -137
- package/src/sap/ui/codeeditor/js/ace/theme-eclipse.js +6 -92
- package/src/sap/ui/codeeditor/js/ace/theme-github.js +7 -99
- package/src/sap/ui/codeeditor/js/ace/theme-github_dark.js +18 -0
- package/src/sap/ui/codeeditor/js/ace/theme-gob.js +6 -107
- package/src/sap/ui/codeeditor/js/ace/theme-gruvbox.js +5 -76
- package/src/sap/ui/codeeditor/js/ace/theme-gruvbox_dark_hard.js +18 -0
- package/src/sap/ui/codeeditor/js/ace/theme-gruvbox_light_hard.js +18 -0
- package/src/sap/ui/codeeditor/js/ace/theme-idle_fingers.js +6 -91
- package/src/sap/ui/codeeditor/js/ace/theme-iplastic.js +6 -116
- package/src/sap/ui/codeeditor/js/ace/theme-katzenmilch.js +6 -116
- package/src/sap/ui/codeeditor/js/ace/theme-kr_theme.js +6 -99
- package/src/sap/ui/codeeditor/js/ace/theme-kuroir.js +6 -56
- package/src/sap/ui/codeeditor/js/ace/theme-merbivore.js +6 -90
- package/src/sap/ui/codeeditor/js/ace/theme-merbivore_soft.js +6 -91
- package/src/sap/ui/codeeditor/js/ace/theme-mono_industrial.js +6 -102
- package/src/sap/ui/codeeditor/js/ace/theme-monokai.js +6 -100
- package/src/sap/ui/codeeditor/js/ace/theme-nord_dark.js +6 -89
- package/src/sap/ui/codeeditor/js/ace/theme-one_dark.js +10 -131
- package/src/sap/ui/codeeditor/js/ace/theme-pastel_on_dark.js +6 -103
- package/src/sap/ui/codeeditor/js/ace/theme-solarized_dark.js +6 -83
- package/src/sap/ui/codeeditor/js/ace/theme-solarized_light.js +6 -86
- package/src/sap/ui/codeeditor/js/ace/theme-sqlserver.js +6 -133
- package/src/sap/ui/codeeditor/js/ace/theme-terminal.js +6 -109
- package/src/sap/ui/codeeditor/js/ace/theme-textmate.js +3 -124
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow.js +6 -103
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night.js +6 -103
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_blue.js +6 -101
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_bright.js +6 -116
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_eighties.js +6 -103
- package/src/sap/ui/codeeditor/js/ace/theme-twilight.js +6 -104
- package/src/sap/ui/codeeditor/js/ace/theme-vibrant_ink.js +6 -89
- package/src/sap/ui/codeeditor/js/ace/theme-xcode.js +6 -83
- package/src/sap/ui/codeeditor/js/ace/worker-base.js +516 -595
- package/src/sap/ui/codeeditor/js/ace/worker-coffee.js +496 -575
- package/src/sap/ui/codeeditor/js/ace/worker-css.js +501 -578
- package/src/sap/ui/codeeditor/js/ace/worker-html.js +515 -584
- package/src/sap/ui/codeeditor/js/ace/worker-javascript.js +2964 -2551
- package/src/sap/ui/codeeditor/js/ace/worker-json.js +496 -575
- package/src/sap/ui/codeeditor/js/ace/worker-lua.js +497 -576
- package/src/sap/ui/codeeditor/js/ace/worker-php.js +2906 -2795
- package/src/sap/ui/codeeditor/js/ace/worker-xml.js +496 -575
- package/src/sap/ui/codeeditor/js/ace/worker-xquery.js +496 -575
- package/src/sap/ui/codeeditor/js/ace/worker-yaml.js +5851 -0
- package/src/sap/ui/codeeditor/library.js +6 -5
- package/LICENSES/BSD-2-Clause.txt +0 -22
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
ace.define("ace/snippets",[], function(require, exports, module)
|
|
2
|
-
"use strict";
|
|
1
|
+
ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module){"use strict";
|
|
3
2
|
var dom = require("./lib/dom");
|
|
4
3
|
var oop = require("./lib/oop");
|
|
5
4
|
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|
@@ -9,107 +8,100 @@ var RangeList = require("./range_list").RangeList;
|
|
|
9
8
|
var HashHandler = require("./keyboard/hash_handler").HashHandler;
|
|
10
9
|
var Tokenizer = require("./tokenizer").Tokenizer;
|
|
11
10
|
var clipboard = require("./clipboard");
|
|
12
|
-
|
|
13
11
|
var VARIABLES = {
|
|
14
|
-
CURRENT_WORD: function(editor) {
|
|
12
|
+
CURRENT_WORD: function (editor) {
|
|
15
13
|
return editor.session.getTextRange(editor.session.getWordRange());
|
|
16
14
|
},
|
|
17
|
-
SELECTION: function(editor, name, indentation) {
|
|
15
|
+
SELECTION: function (editor, name, indentation) {
|
|
18
16
|
var text = editor.session.getTextRange();
|
|
19
17
|
if (indentation)
|
|
20
18
|
return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
|
|
21
19
|
return text;
|
|
22
20
|
},
|
|
23
|
-
CURRENT_LINE: function(editor) {
|
|
21
|
+
CURRENT_LINE: function (editor) {
|
|
24
22
|
return editor.session.getLine(editor.getCursorPosition().row);
|
|
25
23
|
},
|
|
26
|
-
PREV_LINE: function(editor) {
|
|
24
|
+
PREV_LINE: function (editor) {
|
|
27
25
|
return editor.session.getLine(editor.getCursorPosition().row - 1);
|
|
28
26
|
},
|
|
29
|
-
LINE_INDEX: function(editor) {
|
|
27
|
+
LINE_INDEX: function (editor) {
|
|
30
28
|
return editor.getCursorPosition().row;
|
|
31
29
|
},
|
|
32
|
-
LINE_NUMBER: function(editor) {
|
|
30
|
+
LINE_NUMBER: function (editor) {
|
|
33
31
|
return editor.getCursorPosition().row + 1;
|
|
34
32
|
},
|
|
35
|
-
SOFT_TABS: function(editor) {
|
|
33
|
+
SOFT_TABS: function (editor) {
|
|
36
34
|
return editor.session.getUseSoftTabs() ? "YES" : "NO";
|
|
37
35
|
},
|
|
38
|
-
TAB_SIZE: function(editor) {
|
|
36
|
+
TAB_SIZE: function (editor) {
|
|
39
37
|
return editor.session.getTabSize();
|
|
40
38
|
},
|
|
41
|
-
CLIPBOARD: function(editor) {
|
|
39
|
+
CLIPBOARD: function (editor) {
|
|
42
40
|
return clipboard.getText && clipboard.getText();
|
|
43
41
|
},
|
|
44
|
-
FILENAME: function(editor) {
|
|
42
|
+
FILENAME: function (editor) {
|
|
45
43
|
return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
|
|
46
44
|
},
|
|
47
|
-
FILENAME_BASE: function(editor) {
|
|
45
|
+
FILENAME_BASE: function (editor) {
|
|
48
46
|
return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
|
|
49
47
|
},
|
|
50
|
-
DIRECTORY: function(editor) {
|
|
48
|
+
DIRECTORY: function (editor) {
|
|
51
49
|
return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
|
|
52
50
|
},
|
|
53
|
-
FILEPATH: function(editor) { return "/not implemented.txt"; },
|
|
54
|
-
WORKSPACE_NAME: function() { return "Unknown"; },
|
|
55
|
-
FULLNAME: function() { return "Unknown"; },
|
|
56
|
-
BLOCK_COMMENT_START: function(editor) {
|
|
51
|
+
FILEPATH: function (editor) { return "/not implemented.txt"; },
|
|
52
|
+
WORKSPACE_NAME: function () { return "Unknown"; },
|
|
53
|
+
FULLNAME: function () { return "Unknown"; },
|
|
54
|
+
BLOCK_COMMENT_START: function (editor) {
|
|
57
55
|
var mode = editor.session.$mode || {};
|
|
58
56
|
return mode.blockComment && mode.blockComment.start || "";
|
|
59
57
|
},
|
|
60
|
-
BLOCK_COMMENT_END: function(editor) {
|
|
58
|
+
BLOCK_COMMENT_END: function (editor) {
|
|
61
59
|
var mode = editor.session.$mode || {};
|
|
62
60
|
return mode.blockComment && mode.blockComment.end || "";
|
|
63
61
|
},
|
|
64
|
-
LINE_COMMENT: function(editor) {
|
|
62
|
+
LINE_COMMENT: function (editor) {
|
|
65
63
|
var mode = editor.session.$mode || {};
|
|
66
64
|
return mode.lineCommentStart || "";
|
|
67
65
|
},
|
|
68
|
-
CURRENT_YEAR: date.bind(null, {year: "numeric"}),
|
|
69
|
-
CURRENT_YEAR_SHORT: date.bind(null, {year: "2-digit"}),
|
|
70
|
-
CURRENT_MONTH: date.bind(null, {month: "numeric"}),
|
|
71
|
-
CURRENT_MONTH_NAME: date.bind(null, {month: "long"}),
|
|
72
|
-
CURRENT_MONTH_NAME_SHORT: date.bind(null, {month: "short"}),
|
|
73
|
-
CURRENT_DATE: date.bind(null, {day: "2-digit"}),
|
|
74
|
-
CURRENT_DAY_NAME: date.bind(null, {weekday: "long"}),
|
|
75
|
-
CURRENT_DAY_NAME_SHORT: date.bind(null, {weekday: "short"}),
|
|
76
|
-
CURRENT_HOUR: date.bind(null, {hour: "2-digit", hour12: false}),
|
|
77
|
-
CURRENT_MINUTE: date.bind(null, {minute: "2-digit"}),
|
|
78
|
-
CURRENT_SECOND: date.bind(null, {second: "2-digit"})
|
|
66
|
+
CURRENT_YEAR: date.bind(null, { year: "numeric" }),
|
|
67
|
+
CURRENT_YEAR_SHORT: date.bind(null, { year: "2-digit" }),
|
|
68
|
+
CURRENT_MONTH: date.bind(null, { month: "numeric" }),
|
|
69
|
+
CURRENT_MONTH_NAME: date.bind(null, { month: "long" }),
|
|
70
|
+
CURRENT_MONTH_NAME_SHORT: date.bind(null, { month: "short" }),
|
|
71
|
+
CURRENT_DATE: date.bind(null, { day: "2-digit" }),
|
|
72
|
+
CURRENT_DAY_NAME: date.bind(null, { weekday: "long" }),
|
|
73
|
+
CURRENT_DAY_NAME_SHORT: date.bind(null, { weekday: "short" }),
|
|
74
|
+
CURRENT_HOUR: date.bind(null, { hour: "2-digit", hour12: false }),
|
|
75
|
+
CURRENT_MINUTE: date.bind(null, { minute: "2-digit" }),
|
|
76
|
+
CURRENT_SECOND: date.bind(null, { second: "2-digit" })
|
|
79
77
|
};
|
|
80
|
-
|
|
81
78
|
VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
|
|
82
|
-
|
|
83
79
|
function date(dateFormat) {
|
|
84
80
|
var str = new Date().toLocaleString("en-us", dateFormat);
|
|
85
81
|
return str.length == 1 ? "0" + str : str;
|
|
86
82
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
oop.implement(this, EventEmitter);
|
|
95
|
-
|
|
96
|
-
this.getTokenizer = function() {
|
|
83
|
+
var SnippetManager = /** @class */ (function () {
|
|
84
|
+
function SnippetManager() {
|
|
85
|
+
this.snippetMap = {};
|
|
86
|
+
this.snippetNameMap = {};
|
|
87
|
+
this.variables = VARIABLES;
|
|
88
|
+
}
|
|
89
|
+
SnippetManager.prototype.getTokenizer = function () {
|
|
97
90
|
return SnippetManager.$tokenizer || this.createTokenizer();
|
|
98
91
|
};
|
|
99
|
-
|
|
100
|
-
this.createTokenizer = function() {
|
|
92
|
+
SnippetManager.prototype.createTokenizer = function () {
|
|
101
93
|
function TabstopToken(str) {
|
|
102
94
|
str = str.substr(1);
|
|
103
95
|
if (/^\d+$/.test(str))
|
|
104
|
-
return [{tabstopId: parseInt(str, 10)}];
|
|
105
|
-
return [{text: str}];
|
|
96
|
+
return [{ tabstopId: parseInt(str, 10) }];
|
|
97
|
+
return [{ text: str }];
|
|
106
98
|
}
|
|
107
99
|
function escape(ch) {
|
|
108
100
|
return "(?:[^\\\\" + ch + "]|\\\\.)";
|
|
109
101
|
}
|
|
110
102
|
var formatMatcher = {
|
|
111
|
-
regex: "/(" + escape("/") + "+)/",
|
|
112
|
-
onMatch: function(val, state, stack) {
|
|
103
|
+
regex: "/(" + escape("/") + "+)/",
|
|
104
|
+
onMatch: function (val, state, stack) {
|
|
113
105
|
var ts = stack[0];
|
|
114
106
|
ts.fmtString = true;
|
|
115
107
|
ts.guard = val.slice(1, -1);
|
|
@@ -118,118 +110,115 @@ var SnippetManager = function() {
|
|
|
118
110
|
},
|
|
119
111
|
next: "formatString"
|
|
120
112
|
};
|
|
121
|
-
|
|
122
113
|
SnippetManager.$tokenizer = new Tokenizer({
|
|
123
114
|
start: [
|
|
124
|
-
{regex: /\\./, onMatch: function(val, state, stack) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
{regex:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
115
|
+
{ regex: /\\./, onMatch: function (val, state, stack) {
|
|
116
|
+
var ch = val[1];
|
|
117
|
+
if (ch == "}" && stack.length) {
|
|
118
|
+
val = ch;
|
|
119
|
+
}
|
|
120
|
+
else if ("`$\\".indexOf(ch) != -1) {
|
|
121
|
+
val = ch;
|
|
122
|
+
}
|
|
123
|
+
return [val];
|
|
124
|
+
} },
|
|
125
|
+
{ regex: /}/, onMatch: function (val, state, stack) {
|
|
126
|
+
return [stack.length ? stack.shift() : val];
|
|
127
|
+
} },
|
|
128
|
+
{ regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
|
|
129
|
+
{ regex: /\$\{[\dA-Z_a-z]+/, onMatch: function (str, state, stack) {
|
|
130
|
+
var t = TabstopToken(str.substr(1));
|
|
131
|
+
stack.unshift(t[0]);
|
|
132
|
+
return t;
|
|
133
|
+
}, next: "snippetVar" },
|
|
134
|
+
{ regex: /\n/, token: "newline", merge: false }
|
|
143
135
|
],
|
|
144
136
|
snippetVar: [
|
|
145
|
-
{regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
137
|
+
{ regex: "\\|" + escape("\\|") + "*\\|", onMatch: function (val, state, stack) {
|
|
138
|
+
var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function (operator) {
|
|
139
|
+
return operator.length == 2 ? operator[1] : "\x00";
|
|
140
|
+
}).split("\x00").map(function (value) {
|
|
141
|
+
return { value: value };
|
|
142
|
+
});
|
|
143
|
+
stack[0].choices = choices;
|
|
144
|
+
return [choices[0]];
|
|
145
|
+
}, next: "start" },
|
|
154
146
|
formatMatcher,
|
|
155
|
-
{regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
|
|
147
|
+
{ regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
|
|
156
148
|
],
|
|
157
149
|
formatString: [
|
|
158
|
-
{regex: /:/, onMatch: function(val, state, stack) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{regex: /\\./, onMatch: function(val, state, stack) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
{regex: "/\\w*}", onMatch: function(val, state, stack) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
{regex: /\$(?:\d+|\w+)/, onMatch: function(val, state, stack) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
{regex: /\${\w+/, onMatch: function(val, state, stack) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
{regex: /\n/, token: "newline", merge: false},
|
|
196
|
-
{regex: /}/, onMatch: function(val, state, stack) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
150
|
+
{ regex: /:/, onMatch: function (val, state, stack) {
|
|
151
|
+
if (stack.length && stack[0].expectElse) {
|
|
152
|
+
stack[0].expectElse = false;
|
|
153
|
+
stack[0].ifEnd = { elseEnd: stack[0] };
|
|
154
|
+
return [stack[0].ifEnd];
|
|
155
|
+
}
|
|
156
|
+
return ":";
|
|
157
|
+
} },
|
|
158
|
+
{ regex: /\\./, onMatch: function (val, state, stack) {
|
|
159
|
+
var ch = val[1];
|
|
160
|
+
if (ch == "}" && stack.length)
|
|
161
|
+
val = ch;
|
|
162
|
+
else if ("`$\\".indexOf(ch) != -1)
|
|
163
|
+
val = ch;
|
|
164
|
+
else if (ch == "n")
|
|
165
|
+
val = "\n";
|
|
166
|
+
else if (ch == "t")
|
|
167
|
+
val = "\t";
|
|
168
|
+
else if ("ulULE".indexOf(ch) != -1)
|
|
169
|
+
val = { changeCase: ch, local: ch > "a" };
|
|
170
|
+
return [val];
|
|
171
|
+
} },
|
|
172
|
+
{ regex: "/\\w*}", onMatch: function (val, state, stack) {
|
|
173
|
+
var next = stack.shift();
|
|
174
|
+
if (next)
|
|
175
|
+
next.flag = val.slice(1, -1);
|
|
176
|
+
this.next = next && next.tabstopId ? "start" : "";
|
|
177
|
+
return [next || val];
|
|
178
|
+
}, next: "start" },
|
|
179
|
+
{ regex: /\$(?:\d+|\w+)/, onMatch: function (val, state, stack) {
|
|
180
|
+
return [{ text: val.slice(1) }];
|
|
181
|
+
} },
|
|
182
|
+
{ regex: /\${\w+/, onMatch: function (val, state, stack) {
|
|
183
|
+
var token = { text: val.slice(2) };
|
|
184
|
+
stack.unshift(token);
|
|
185
|
+
return [token];
|
|
186
|
+
}, next: "formatStringVar" },
|
|
187
|
+
{ regex: /\n/, token: "newline", merge: false },
|
|
188
|
+
{ regex: /}/, onMatch: function (val, state, stack) {
|
|
189
|
+
var next = stack.shift();
|
|
190
|
+
this.next = next && next.tabstopId ? "start" : "";
|
|
191
|
+
return [next || val];
|
|
192
|
+
}, next: "start" }
|
|
201
193
|
],
|
|
202
194
|
formatStringVar: [
|
|
203
|
-
{regex: /:\/\w+}/, onMatch: function(val, state, stack) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
195
|
+
{ regex: /:\/\w+}/, onMatch: function (val, state, stack) {
|
|
196
|
+
var ts = stack[0];
|
|
197
|
+
ts.formatFunction = val.slice(2, -1);
|
|
198
|
+
return [stack.shift()];
|
|
199
|
+
}, next: "formatString" },
|
|
208
200
|
formatMatcher,
|
|
209
|
-
{regex: /:[\?\-+]?/, onMatch: function(val, state, stack) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
{regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString"}
|
|
201
|
+
{ regex: /:[\?\-+]?/, onMatch: function (val, state, stack) {
|
|
202
|
+
if (val[1] == "+")
|
|
203
|
+
stack[0].ifEnd = stack[0];
|
|
204
|
+
if (val[1] == "?")
|
|
205
|
+
stack[0].expectElse = true;
|
|
206
|
+
}, next: "formatString" },
|
|
207
|
+
{ regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
|
|
216
208
|
]
|
|
217
209
|
});
|
|
218
210
|
return SnippetManager.$tokenizer;
|
|
219
211
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {
|
|
212
|
+
SnippetManager.prototype.tokenizeTmSnippet = function (str, startState) {
|
|
213
|
+
return this.getTokenizer().getLineTokens(str, startState).tokens.map(function (x) {
|
|
223
214
|
return x.value || x;
|
|
224
215
|
});
|
|
225
216
|
};
|
|
226
|
-
|
|
227
|
-
this.getVariableValue = function(editor, name, indentation) {
|
|
217
|
+
SnippetManager.prototype.getVariableValue = function (editor, name, indentation) {
|
|
228
218
|
if (/^\d+$/.test(name))
|
|
229
219
|
return (this.variables.__ || {})[name] || "";
|
|
230
220
|
if (/^[A-Z]\d+$/.test(name))
|
|
231
221
|
return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
|
|
232
|
-
|
|
233
222
|
name = name.replace(/^TM_/, "");
|
|
234
223
|
if (!this.variables.hasOwnProperty(name))
|
|
235
224
|
return "";
|
|
@@ -238,21 +227,20 @@ var SnippetManager = function() {
|
|
|
238
227
|
value = this.variables[name](editor, name, indentation);
|
|
239
228
|
return value == null ? "" : value;
|
|
240
229
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (!ch.fmt) return str;
|
|
230
|
+
SnippetManager.prototype.tmStrFormat = function (str, ch, editor) {
|
|
231
|
+
if (!ch.fmt)
|
|
232
|
+
return str;
|
|
245
233
|
var flag = ch.flag || "";
|
|
246
234
|
var re = ch.guard;
|
|
247
235
|
re = new RegExp(re, flag.replace(/[^gim]/g, ""));
|
|
248
236
|
var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
|
|
249
237
|
var _self = this;
|
|
250
|
-
var formatted = str.replace(re, function() {
|
|
238
|
+
var formatted = str.replace(re, function () {
|
|
251
239
|
var oldArgs = _self.variables.__;
|
|
252
240
|
_self.variables.__ = [].slice.call(arguments);
|
|
253
241
|
var fmtParts = _self.resolveVariables(fmtTokens, editor);
|
|
254
242
|
var gChangeCase = "E";
|
|
255
|
-
for (var i
|
|
243
|
+
for (var i = 0; i < fmtParts.length; i++) {
|
|
256
244
|
var ch = fmtParts[i];
|
|
257
245
|
if (typeof ch == "object") {
|
|
258
246
|
fmtParts[i] = "";
|
|
@@ -265,12 +253,15 @@ var SnippetManager = function() {
|
|
|
265
253
|
fmtParts[i] = next[0].toLowerCase();
|
|
266
254
|
fmtParts[i + 1] = next.substr(1);
|
|
267
255
|
}
|
|
268
|
-
}
|
|
256
|
+
}
|
|
257
|
+
else if (ch.changeCase) {
|
|
269
258
|
gChangeCase = ch.changeCase;
|
|
270
259
|
}
|
|
271
|
-
}
|
|
260
|
+
}
|
|
261
|
+
else if (gChangeCase == "U") {
|
|
272
262
|
fmtParts[i] = ch.toUpperCase();
|
|
273
|
-
}
|
|
263
|
+
}
|
|
264
|
+
else if (gChangeCase == "L") {
|
|
274
265
|
fmtParts[i] = ch.toLowerCase();
|
|
275
266
|
}
|
|
276
267
|
}
|
|
@@ -279,16 +270,14 @@ var SnippetManager = function() {
|
|
|
279
270
|
});
|
|
280
271
|
return formatted;
|
|
281
272
|
};
|
|
282
|
-
|
|
283
|
-
this.tmFormatFunction = function(str, ch, editor) {
|
|
273
|
+
SnippetManager.prototype.tmFormatFunction = function (str, ch, editor) {
|
|
284
274
|
if (ch.formatFunction == "upcase")
|
|
285
275
|
return str.toUpperCase();
|
|
286
276
|
if (ch.formatFunction == "downcase")
|
|
287
277
|
return str.toLowerCase();
|
|
288
278
|
return str;
|
|
289
279
|
};
|
|
290
|
-
|
|
291
|
-
this.resolveVariables = function(snippet, editor) {
|
|
280
|
+
SnippetManager.prototype.resolveVariables = function (snippet, editor) {
|
|
292
281
|
var result = [];
|
|
293
282
|
var indentation = "";
|
|
294
283
|
var afterNewLine = true;
|
|
@@ -306,34 +295,37 @@ var SnippetManager = function() {
|
|
|
306
295
|
}
|
|
307
296
|
continue;
|
|
308
297
|
}
|
|
309
|
-
if (!ch)
|
|
298
|
+
if (!ch)
|
|
299
|
+
continue;
|
|
310
300
|
afterNewLine = false;
|
|
311
|
-
|
|
312
301
|
if (ch.fmtString) {
|
|
313
302
|
var j = snippet.indexOf(ch, i + 1);
|
|
314
|
-
if (j == -1)
|
|
303
|
+
if (j == -1)
|
|
304
|
+
j = snippet.length;
|
|
315
305
|
ch.fmt = snippet.slice(i + 1, j);
|
|
316
306
|
i = j;
|
|
317
307
|
}
|
|
318
|
-
|
|
319
308
|
if (ch.text) {
|
|
320
309
|
var value = this.getVariableValue(editor, ch.text, indentation) + "";
|
|
321
310
|
if (ch.fmtString)
|
|
322
311
|
value = this.tmStrFormat(value, ch, editor);
|
|
323
312
|
if (ch.formatFunction)
|
|
324
313
|
value = this.tmFormatFunction(value, ch, editor);
|
|
325
|
-
|
|
326
314
|
if (value && !ch.ifEnd) {
|
|
327
315
|
result.push(value);
|
|
328
316
|
gotoNext(ch);
|
|
329
|
-
}
|
|
317
|
+
}
|
|
318
|
+
else if (!value && ch.ifEnd) {
|
|
330
319
|
gotoNext(ch.ifEnd);
|
|
331
320
|
}
|
|
332
|
-
}
|
|
321
|
+
}
|
|
322
|
+
else if (ch.elseEnd) {
|
|
333
323
|
gotoNext(ch.elseEnd);
|
|
334
|
-
}
|
|
324
|
+
}
|
|
325
|
+
else if (ch.tabstopId != null) {
|
|
335
326
|
result.push(ch);
|
|
336
|
-
}
|
|
327
|
+
}
|
|
328
|
+
else if (ch.changeCase != null) {
|
|
337
329
|
result.push(ch);
|
|
338
330
|
}
|
|
339
331
|
}
|
|
@@ -344,142 +336,35 @@ var SnippetManager = function() {
|
|
|
344
336
|
}
|
|
345
337
|
return result;
|
|
346
338
|
};
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (cursor.column < indentString.length)
|
|
355
|
-
indentString = indentString.slice(0, cursor.column);
|
|
356
|
-
|
|
357
|
-
snippetText = snippetText.replace(/\r/g, "");
|
|
358
|
-
var tokens = this.tokenizeTmSnippet(snippetText);
|
|
359
|
-
tokens = this.resolveVariables(tokens, editor);
|
|
360
|
-
tokens = tokens.map(function(x) {
|
|
361
|
-
if (x == "\n")
|
|
362
|
-
return x + indentString;
|
|
363
|
-
if (typeof x == "string")
|
|
364
|
-
return x.replace(/\t/g, tabString);
|
|
365
|
-
return x;
|
|
366
|
-
});
|
|
367
|
-
var tabstops = [];
|
|
368
|
-
tokens.forEach(function(p, i) {
|
|
369
|
-
if (typeof p != "object")
|
|
370
|
-
return;
|
|
371
|
-
var id = p.tabstopId;
|
|
372
|
-
var ts = tabstops[id];
|
|
373
|
-
if (!ts) {
|
|
374
|
-
ts = tabstops[id] = [];
|
|
375
|
-
ts.index = id;
|
|
376
|
-
ts.value = "";
|
|
377
|
-
ts.parents = {};
|
|
378
|
-
}
|
|
379
|
-
if (ts.indexOf(p) !== -1)
|
|
380
|
-
return;
|
|
381
|
-
if (p.choices && !ts.choices)
|
|
382
|
-
ts.choices = p.choices;
|
|
383
|
-
ts.push(p);
|
|
384
|
-
var i1 = tokens.indexOf(p, i + 1);
|
|
385
|
-
if (i1 === -1)
|
|
386
|
-
return;
|
|
387
|
-
|
|
388
|
-
var value = tokens.slice(i + 1, i1);
|
|
389
|
-
var isNested = value.some(function(t) {return typeof t === "object";});
|
|
390
|
-
if (isNested && !ts.value) {
|
|
391
|
-
ts.value = value;
|
|
392
|
-
} else if (value.length && (!ts.value || typeof ts.value !== "string")) {
|
|
393
|
-
ts.value = value.join("");
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
tabstops.forEach(function(ts) {ts.length = 0;});
|
|
397
|
-
var expanding = {};
|
|
398
|
-
function copyValue(val) {
|
|
399
|
-
var copy = [];
|
|
400
|
-
for (var i = 0; i < val.length; i++) {
|
|
401
|
-
var p = val[i];
|
|
402
|
-
if (typeof p == "object") {
|
|
403
|
-
if (expanding[p.tabstopId])
|
|
404
|
-
continue;
|
|
405
|
-
var j = val.lastIndexOf(p, i - 1);
|
|
406
|
-
p = copy[j] || {tabstopId: p.tabstopId};
|
|
407
|
-
}
|
|
408
|
-
copy[i] = p;
|
|
409
|
-
}
|
|
410
|
-
return copy;
|
|
411
|
-
}
|
|
412
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
413
|
-
var p = tokens[i];
|
|
414
|
-
if (typeof p != "object")
|
|
415
|
-
continue;
|
|
416
|
-
var id = p.tabstopId;
|
|
417
|
-
var ts = tabstops[id];
|
|
418
|
-
var i1 = tokens.indexOf(p, i + 1);
|
|
419
|
-
if (expanding[id]) {
|
|
420
|
-
if (expanding[id] === p) {
|
|
421
|
-
delete expanding[id];
|
|
422
|
-
Object.keys(expanding).forEach(function(parentId) {
|
|
423
|
-
ts.parents[parentId] = true;
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
continue;
|
|
427
|
-
}
|
|
428
|
-
expanding[id] = p;
|
|
429
|
-
var value = ts.value;
|
|
430
|
-
if (typeof value !== "string")
|
|
431
|
-
value = copyValue(value);
|
|
432
|
-
else if (p.fmt)
|
|
433
|
-
value = this.tmStrFormat(value, p, editor);
|
|
434
|
-
tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
|
|
435
|
-
|
|
436
|
-
if (ts.indexOf(p) === -1)
|
|
437
|
-
ts.push(p);
|
|
438
|
-
}
|
|
439
|
-
var row = 0, column = 0;
|
|
440
|
-
var text = "";
|
|
441
|
-
tokens.forEach(function(t) {
|
|
442
|
-
if (typeof t === "string") {
|
|
443
|
-
var lines = t.split("\n");
|
|
444
|
-
if (lines.length > 1){
|
|
445
|
-
column = lines[lines.length - 1].length;
|
|
446
|
-
row += lines.length - 1;
|
|
447
|
-
} else
|
|
448
|
-
column += t.length;
|
|
449
|
-
text += t;
|
|
450
|
-
} else if (t) {
|
|
451
|
-
if (!t.start)
|
|
452
|
-
t.start = {row: row, column: column};
|
|
453
|
-
else
|
|
454
|
-
t.end = {row: row, column: column};
|
|
455
|
-
}
|
|
456
|
-
});
|
|
339
|
+
SnippetManager.prototype.getDisplayTextForSnippet = function (editor, snippetText) {
|
|
340
|
+
var processedSnippet = processSnippetText.call(this, editor, snippetText);
|
|
341
|
+
return processedSnippet.text;
|
|
342
|
+
};
|
|
343
|
+
SnippetManager.prototype.insertSnippetForSelection = function (editor, snippetText, options) {
|
|
344
|
+
if (options === void 0) { options = {}; }
|
|
345
|
+
var processedSnippet = processSnippetText.call(this, editor, snippetText, options);
|
|
457
346
|
var range = editor.getSelectionRange();
|
|
458
|
-
var end = editor.session.replace(range, text);
|
|
459
|
-
|
|
347
|
+
var end = editor.session.replace(range, processedSnippet.text);
|
|
460
348
|
var tabstopManager = new TabstopManager(editor);
|
|
461
349
|
var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
|
|
462
|
-
tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
|
|
350
|
+
tabstopManager.addTabstops(processedSnippet.tabstops, range.start, end, selectionId);
|
|
463
351
|
};
|
|
464
|
-
|
|
465
|
-
|
|
352
|
+
SnippetManager.prototype.insertSnippet = function (editor, snippetText, options) {
|
|
353
|
+
if (options === void 0) { options = {}; }
|
|
466
354
|
var self = this;
|
|
467
355
|
if (editor.inVirtualSelectionMode)
|
|
468
|
-
return self.insertSnippetForSelection(editor, snippetText);
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}, null, {keepOrder: true});
|
|
473
|
-
|
|
356
|
+
return self.insertSnippetForSelection(editor, snippetText, options);
|
|
357
|
+
editor.forEachSelection(function () {
|
|
358
|
+
self.insertSnippetForSelection(editor, snippetText, options);
|
|
359
|
+
}, null, { keepOrder: true });
|
|
474
360
|
if (editor.tabstopManager)
|
|
475
361
|
editor.tabstopManager.tabNext();
|
|
476
362
|
};
|
|
477
|
-
|
|
478
|
-
this.$getScope = function(editor) {
|
|
363
|
+
SnippetManager.prototype.$getScope = function (editor) {
|
|
479
364
|
var scope = editor.session.$mode.$id || "";
|
|
480
365
|
scope = scope.split("/").pop();
|
|
481
366
|
if (scope === "html" || scope === "php") {
|
|
482
|
-
if (scope === "php" && !editor.session.$mode.inlinePhp)
|
|
367
|
+
if (scope === "php" && !editor.session.$mode.inlinePhp)
|
|
483
368
|
scope = "html";
|
|
484
369
|
var c = editor.getCursorPosition();
|
|
485
370
|
var state = editor.session.getState(c.row);
|
|
@@ -495,11 +380,9 @@ var SnippetManager = function() {
|
|
|
495
380
|
scope = "php";
|
|
496
381
|
}
|
|
497
382
|
}
|
|
498
|
-
|
|
499
383
|
return scope;
|
|
500
384
|
};
|
|
501
|
-
|
|
502
|
-
this.getActiveScopes = function(editor) {
|
|
385
|
+
SnippetManager.prototype.getActiveScopes = function (editor) {
|
|
503
386
|
var scope = this.$getScope(editor);
|
|
504
387
|
var scopes = [scope];
|
|
505
388
|
var snippetMap = this.snippetMap;
|
|
@@ -509,26 +392,23 @@ var SnippetManager = function() {
|
|
|
509
392
|
scopes.push("_");
|
|
510
393
|
return scopes;
|
|
511
394
|
};
|
|
512
|
-
|
|
513
|
-
this.expandWithTab = function(editor, options) {
|
|
395
|
+
SnippetManager.prototype.expandWithTab = function (editor, options) {
|
|
514
396
|
var self = this;
|
|
515
|
-
var result = editor.forEachSelection(function() {
|
|
397
|
+
var result = editor.forEachSelection(function () {
|
|
516
398
|
return self.expandSnippetForSelection(editor, options);
|
|
517
|
-
}, null, {keepOrder: true});
|
|
399
|
+
}, null, { keepOrder: true });
|
|
518
400
|
if (result && editor.tabstopManager)
|
|
519
401
|
editor.tabstopManager.tabNext();
|
|
520
402
|
return result;
|
|
521
403
|
};
|
|
522
|
-
|
|
523
|
-
this.expandSnippetForSelection = function(editor, options) {
|
|
404
|
+
SnippetManager.prototype.expandSnippetForSelection = function (editor, options) {
|
|
524
405
|
var cursor = editor.getCursorPosition();
|
|
525
406
|
var line = editor.session.getLine(cursor.row);
|
|
526
407
|
var before = line.substring(0, cursor.column);
|
|
527
408
|
var after = line.substr(cursor.column);
|
|
528
|
-
|
|
529
409
|
var snippetMap = this.snippetMap;
|
|
530
410
|
var snippet;
|
|
531
|
-
this.getActiveScopes(editor).some(function(scope) {
|
|
411
|
+
this.getActiveScopes(editor).some(function (scope) {
|
|
532
412
|
var snippets = snippetMap[scope];
|
|
533
413
|
if (snippets)
|
|
534
414
|
snippet = this.findMatchingSnippet(snippets, before, after);
|
|
@@ -538,20 +418,14 @@ var SnippetManager = function() {
|
|
|
538
418
|
return false;
|
|
539
419
|
if (options && options.dryRun)
|
|
540
420
|
return true;
|
|
541
|
-
editor.session.doc.removeInLine(cursor.row,
|
|
542
|
-
cursor.column - snippet.replaceBefore.length,
|
|
543
|
-
cursor.column + snippet.replaceAfter.length
|
|
544
|
-
);
|
|
545
|
-
|
|
421
|
+
editor.session.doc.removeInLine(cursor.row, cursor.column - snippet.replaceBefore.length, cursor.column + snippet.replaceAfter.length);
|
|
546
422
|
this.variables.M__ = snippet.matchBefore;
|
|
547
423
|
this.variables.T__ = snippet.matchAfter;
|
|
548
424
|
this.insertSnippetForSelection(editor, snippet.content);
|
|
549
|
-
|
|
550
425
|
this.variables.M__ = this.variables.T__ = null;
|
|
551
426
|
return true;
|
|
552
427
|
};
|
|
553
|
-
|
|
554
|
-
this.findMatchingSnippet = function(snippetList, before, after) {
|
|
428
|
+
SnippetManager.prototype.findMatchingSnippet = function (snippetList, before, after) {
|
|
555
429
|
for (var i = snippetList.length; i--;) {
|
|
556
430
|
var s = snippetList[i];
|
|
557
431
|
if (s.startRe && !s.startRe.test(before))
|
|
@@ -560,7 +434,6 @@ var SnippetManager = function() {
|
|
|
560
434
|
continue;
|
|
561
435
|
if (!s.startRe && !s.endRe)
|
|
562
436
|
continue;
|
|
563
|
-
|
|
564
437
|
s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
|
|
565
438
|
s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
|
|
566
439
|
s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
|
|
@@ -568,21 +441,15 @@ var SnippetManager = function() {
|
|
|
568
441
|
return s;
|
|
569
442
|
}
|
|
570
443
|
};
|
|
571
|
-
|
|
572
|
-
this.snippetMap = {};
|
|
573
|
-
this.snippetNameMap = {};
|
|
574
|
-
this.register = function(snippets, scope) {
|
|
444
|
+
SnippetManager.prototype.register = function (snippets, scope) {
|
|
575
445
|
var snippetMap = this.snippetMap;
|
|
576
446
|
var snippetNameMap = this.snippetNameMap;
|
|
577
447
|
var self = this;
|
|
578
|
-
|
|
579
|
-
if (!snippets)
|
|
448
|
+
if (!snippets)
|
|
580
449
|
snippets = [];
|
|
581
|
-
|
|
582
450
|
function wrapRegexp(src) {
|
|
583
451
|
if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
|
|
584
452
|
src = "(?:" + src + ")";
|
|
585
|
-
|
|
586
453
|
return src || "";
|
|
587
454
|
}
|
|
588
455
|
function guardedRegexp(re, guard, opening) {
|
|
@@ -592,14 +459,14 @@ var SnippetManager = function() {
|
|
|
592
459
|
re = guard + re;
|
|
593
460
|
if (re && re[re.length - 1] != "$")
|
|
594
461
|
re = re + "$";
|
|
595
|
-
}
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
596
464
|
re = re + guard;
|
|
597
465
|
if (re && re[0] != "^")
|
|
598
466
|
re = "^" + re;
|
|
599
467
|
}
|
|
600
468
|
return new RegExp(re);
|
|
601
469
|
}
|
|
602
|
-
|
|
603
470
|
function addSnippet(s) {
|
|
604
471
|
if (!s.scope)
|
|
605
472
|
s.scope = scope || "_";
|
|
@@ -608,7 +475,6 @@ var SnippetManager = function() {
|
|
|
608
475
|
snippetMap[scope] = [];
|
|
609
476
|
snippetNameMap[scope] = {};
|
|
610
477
|
}
|
|
611
|
-
|
|
612
478
|
var map = snippetNameMap[scope];
|
|
613
479
|
if (s.name) {
|
|
614
480
|
var old = map[s.name];
|
|
@@ -617,48 +483,40 @@ var SnippetManager = function() {
|
|
|
617
483
|
map[s.name] = s;
|
|
618
484
|
}
|
|
619
485
|
snippetMap[scope].push(s);
|
|
620
|
-
|
|
621
486
|
if (s.prefix)
|
|
622
487
|
s.tabTrigger = s.prefix;
|
|
623
|
-
|
|
624
488
|
if (!s.content && s.body)
|
|
625
489
|
s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
|
|
626
|
-
|
|
627
490
|
if (s.tabTrigger && !s.trigger) {
|
|
628
491
|
if (!s.guard && /^\w/.test(s.tabTrigger))
|
|
629
492
|
s.guard = "\\b";
|
|
630
493
|
s.trigger = lang.escapeRegExp(s.tabTrigger);
|
|
631
494
|
}
|
|
632
|
-
|
|
633
495
|
if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
|
|
634
496
|
return;
|
|
635
|
-
|
|
636
497
|
s.startRe = guardedRegexp(s.trigger, s.guard, true);
|
|
637
498
|
s.triggerRe = new RegExp(s.trigger);
|
|
638
|
-
|
|
639
499
|
s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
|
|
640
500
|
s.endTriggerRe = new RegExp(s.endTrigger);
|
|
641
501
|
}
|
|
642
|
-
|
|
643
502
|
if (Array.isArray(snippets)) {
|
|
644
503
|
snippets.forEach(addSnippet);
|
|
645
|
-
}
|
|
646
|
-
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
Object.keys(snippets).forEach(function (key) {
|
|
647
507
|
addSnippet(snippets[key]);
|
|
648
508
|
});
|
|
649
509
|
}
|
|
650
|
-
|
|
651
|
-
this._signal("registerSnippets", {scope: scope});
|
|
510
|
+
this._signal("registerSnippets", { scope: scope });
|
|
652
511
|
};
|
|
653
|
-
|
|
512
|
+
SnippetManager.prototype.unregister = function (snippets, scope) {
|
|
654
513
|
var snippetMap = this.snippetMap;
|
|
655
514
|
var snippetNameMap = this.snippetNameMap;
|
|
656
|
-
|
|
657
515
|
function removeSnippet(s) {
|
|
658
|
-
var nameMap = snippetNameMap[s.scope||scope];
|
|
516
|
+
var nameMap = snippetNameMap[s.scope || scope];
|
|
659
517
|
if (nameMap && nameMap[s.name]) {
|
|
660
518
|
delete nameMap[s.name];
|
|
661
|
-
var map = snippetMap[s.scope||scope];
|
|
519
|
+
var map = snippetMap[s.scope || scope];
|
|
662
520
|
var i = map && map.indexOf(s);
|
|
663
521
|
if (i >= 0)
|
|
664
522
|
map.splice(i, 1);
|
|
@@ -669,7 +527,7 @@ var SnippetManager = function() {
|
|
|
669
527
|
else if (Array.isArray(snippets))
|
|
670
528
|
snippets.forEach(removeSnippet);
|
|
671
529
|
};
|
|
672
|
-
|
|
530
|
+
SnippetManager.prototype.parseSnippetFile = function (str) {
|
|
673
531
|
str = str.replace(/\r/g, "");
|
|
674
532
|
var list = [], snippet = {};
|
|
675
533
|
var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
|
|
@@ -679,12 +537,15 @@ var SnippetManager = function() {
|
|
|
679
537
|
try {
|
|
680
538
|
snippet = JSON.parse(m[1]);
|
|
681
539
|
list.push(snippet);
|
|
682
|
-
}
|
|
683
|
-
|
|
540
|
+
}
|
|
541
|
+
catch (e) { }
|
|
542
|
+
}
|
|
543
|
+
if (m[4]) {
|
|
684
544
|
snippet.content = m[4].replace(/^\t/gm, "");
|
|
685
545
|
list.push(snippet);
|
|
686
546
|
snippet = {};
|
|
687
|
-
}
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
688
549
|
var key = m[2], val = m[3];
|
|
689
550
|
if (key == "regex") {
|
|
690
551
|
var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
|
|
@@ -692,21 +553,23 @@ var SnippetManager = function() {
|
|
|
692
553
|
snippet.trigger = guardRe.exec(val)[1];
|
|
693
554
|
snippet.endTrigger = guardRe.exec(val)[1];
|
|
694
555
|
snippet.endGuard = guardRe.exec(val)[1];
|
|
695
|
-
}
|
|
556
|
+
}
|
|
557
|
+
else if (key == "snippet") {
|
|
696
558
|
snippet.tabTrigger = val.match(/^\S*/)[0];
|
|
697
559
|
if (!snippet.name)
|
|
698
560
|
snippet.name = val;
|
|
699
|
-
}
|
|
561
|
+
}
|
|
562
|
+
else if (key) {
|
|
700
563
|
snippet[key] = val;
|
|
701
564
|
}
|
|
702
565
|
}
|
|
703
566
|
}
|
|
704
567
|
return list;
|
|
705
568
|
};
|
|
706
|
-
|
|
569
|
+
SnippetManager.prototype.getSnippetByName = function (name, editor) {
|
|
707
570
|
var snippetMap = this.snippetNameMap;
|
|
708
571
|
var snippet;
|
|
709
|
-
this.getActiveScopes(editor).some(function(scope) {
|
|
572
|
+
this.getActiveScopes(editor).some(function (scope) {
|
|
710
573
|
var snippets = snippetMap[scope];
|
|
711
574
|
if (snippets)
|
|
712
575
|
snippet = snippets[name];
|
|
@@ -714,59 +577,172 @@ var SnippetManager = function() {
|
|
|
714
577
|
}, this);
|
|
715
578
|
return snippet;
|
|
716
579
|
};
|
|
717
|
-
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
this.
|
|
580
|
+
return SnippetManager;
|
|
581
|
+
}());
|
|
582
|
+
oop.implement(SnippetManager.prototype, EventEmitter);
|
|
583
|
+
var processSnippetText = function (editor, snippetText, options) {
|
|
584
|
+
if (options === void 0) { options = {}; }
|
|
585
|
+
var cursor = editor.getCursorPosition();
|
|
586
|
+
var line = editor.session.getLine(cursor.row);
|
|
587
|
+
var tabString = editor.session.getTabString();
|
|
588
|
+
var indentString = line.match(/^\s*/)[0];
|
|
589
|
+
if (cursor.column < indentString.length)
|
|
590
|
+
indentString = indentString.slice(0, cursor.column);
|
|
591
|
+
snippetText = snippetText.replace(/\r/g, "");
|
|
592
|
+
var tokens = this.tokenizeTmSnippet(snippetText);
|
|
593
|
+
tokens = this.resolveVariables(tokens, editor);
|
|
594
|
+
tokens = tokens.map(function (x) {
|
|
595
|
+
if (x == "\n" && !options.excludeExtraIndent)
|
|
596
|
+
return x + indentString;
|
|
597
|
+
if (typeof x == "string")
|
|
598
|
+
return x.replace(/\t/g, tabString);
|
|
599
|
+
return x;
|
|
600
|
+
});
|
|
601
|
+
var tabstops = [];
|
|
602
|
+
tokens.forEach(function (p, i) {
|
|
603
|
+
if (typeof p != "object")
|
|
604
|
+
return;
|
|
605
|
+
var id = p.tabstopId;
|
|
606
|
+
var ts = tabstops[id];
|
|
607
|
+
if (!ts) {
|
|
608
|
+
ts = tabstops[id] = [];
|
|
609
|
+
ts.index = id;
|
|
610
|
+
ts.value = "";
|
|
611
|
+
ts.parents = {};
|
|
612
|
+
}
|
|
613
|
+
if (ts.indexOf(p) !== -1)
|
|
614
|
+
return;
|
|
615
|
+
if (p.choices && !ts.choices)
|
|
616
|
+
ts.choices = p.choices;
|
|
617
|
+
ts.push(p);
|
|
618
|
+
var i1 = tokens.indexOf(p, i + 1);
|
|
619
|
+
if (i1 === -1)
|
|
620
|
+
return;
|
|
621
|
+
var value = tokens.slice(i + 1, i1);
|
|
622
|
+
var isNested = value.some(function (t) { return typeof t === "object"; });
|
|
623
|
+
if (isNested && !ts.value) {
|
|
624
|
+
ts.value = value;
|
|
625
|
+
}
|
|
626
|
+
else if (value.length && (!ts.value || typeof ts.value !== "string")) {
|
|
627
|
+
ts.value = value.join("");
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
tabstops.forEach(function (ts) { ts.length = 0; });
|
|
631
|
+
var expanding = {};
|
|
632
|
+
function copyValue(val) {
|
|
633
|
+
var copy = [];
|
|
634
|
+
for (var i = 0; i < val.length; i++) {
|
|
635
|
+
var p = val[i];
|
|
636
|
+
if (typeof p == "object") {
|
|
637
|
+
if (expanding[p.tabstopId])
|
|
638
|
+
continue;
|
|
639
|
+
var j = val.lastIndexOf(p, i - 1);
|
|
640
|
+
p = copy[j] || { tabstopId: p.tabstopId };
|
|
641
|
+
}
|
|
642
|
+
copy[i] = p;
|
|
643
|
+
}
|
|
644
|
+
return copy;
|
|
645
|
+
}
|
|
646
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
647
|
+
var p = tokens[i];
|
|
648
|
+
if (typeof p != "object")
|
|
649
|
+
continue;
|
|
650
|
+
var id = p.tabstopId;
|
|
651
|
+
var ts = tabstops[id];
|
|
652
|
+
var i1 = tokens.indexOf(p, i + 1);
|
|
653
|
+
if (expanding[id]) {
|
|
654
|
+
if (expanding[id] === p) {
|
|
655
|
+
delete expanding[id];
|
|
656
|
+
Object.keys(expanding).forEach(function (parentId) {
|
|
657
|
+
ts.parents[parentId] = true;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
expanding[id] = p;
|
|
663
|
+
var value = ts.value;
|
|
664
|
+
if (typeof value !== "string")
|
|
665
|
+
value = copyValue(value);
|
|
666
|
+
else if (p.fmt)
|
|
667
|
+
value = this.tmStrFormat(value, p, editor);
|
|
668
|
+
tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
|
|
669
|
+
if (ts.indexOf(p) === -1)
|
|
670
|
+
ts.push(p);
|
|
671
|
+
}
|
|
672
|
+
var row = 0, column = 0;
|
|
673
|
+
var text = "";
|
|
674
|
+
tokens.forEach(function (t) {
|
|
675
|
+
if (typeof t === "string") {
|
|
676
|
+
var lines = t.split("\n");
|
|
677
|
+
if (lines.length > 1) {
|
|
678
|
+
column = lines[lines.length - 1].length;
|
|
679
|
+
row += lines.length - 1;
|
|
680
|
+
}
|
|
681
|
+
else
|
|
682
|
+
column += t.length;
|
|
683
|
+
text += t;
|
|
684
|
+
}
|
|
685
|
+
else if (t) {
|
|
686
|
+
if (!t.start)
|
|
687
|
+
t.start = { row: row, column: column };
|
|
688
|
+
else
|
|
689
|
+
t.end = { row: row, column: column };
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
return {
|
|
693
|
+
text: text,
|
|
694
|
+
tabstops: tabstops,
|
|
695
|
+
tokens: tokens
|
|
696
|
+
};
|
|
730
697
|
};
|
|
731
|
-
(function() {
|
|
732
|
-
|
|
698
|
+
var TabstopManager = /** @class */ (function () {
|
|
699
|
+
function TabstopManager(editor) {
|
|
733
700
|
this.index = 0;
|
|
734
701
|
this.ranges = [];
|
|
735
702
|
this.tabstops = [];
|
|
703
|
+
if (editor.tabstopManager)
|
|
704
|
+
return editor.tabstopManager;
|
|
705
|
+
editor.tabstopManager = this;
|
|
706
|
+
this.$onChange = this.onChange.bind(this);
|
|
707
|
+
this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
|
|
708
|
+
this.$onChangeSession = this.onChangeSession.bind(this);
|
|
709
|
+
this.$onAfterExec = this.onAfterExec.bind(this);
|
|
710
|
+
this.attach(editor);
|
|
711
|
+
}
|
|
712
|
+
TabstopManager.prototype.attach = function (editor) {
|
|
736
713
|
this.$openTabstops = null;
|
|
737
714
|
this.selectedTabstop = null;
|
|
738
|
-
|
|
739
715
|
this.editor = editor;
|
|
716
|
+
this.session = editor.session;
|
|
740
717
|
this.editor.on("change", this.$onChange);
|
|
741
718
|
this.editor.on("changeSelection", this.$onChangeSelection);
|
|
742
719
|
this.editor.on("changeSession", this.$onChangeSession);
|
|
743
720
|
this.editor.commands.on("afterExec", this.$onAfterExec);
|
|
744
721
|
this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
|
745
722
|
};
|
|
746
|
-
|
|
723
|
+
TabstopManager.prototype.detach = function () {
|
|
747
724
|
this.tabstops.forEach(this.removeTabstopMarkers, this);
|
|
748
|
-
this.ranges =
|
|
749
|
-
this.tabstops =
|
|
725
|
+
this.ranges.length = 0;
|
|
726
|
+
this.tabstops.length = 0;
|
|
750
727
|
this.selectedTabstop = null;
|
|
751
|
-
this.editor.
|
|
752
|
-
this.editor.
|
|
753
|
-
this.editor.
|
|
754
|
-
this.editor.commands.
|
|
728
|
+
this.editor.off("change", this.$onChange);
|
|
729
|
+
this.editor.off("changeSelection", this.$onChangeSelection);
|
|
730
|
+
this.editor.off("changeSession", this.$onChangeSession);
|
|
731
|
+
this.editor.commands.off("afterExec", this.$onAfterExec);
|
|
755
732
|
this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
|
|
756
733
|
this.editor.tabstopManager = null;
|
|
734
|
+
this.session = null;
|
|
757
735
|
this.editor = null;
|
|
758
736
|
};
|
|
759
|
-
|
|
760
|
-
this.onChange = function(delta) {
|
|
737
|
+
TabstopManager.prototype.onChange = function (delta) {
|
|
761
738
|
var isRemove = delta.action[0] == "r";
|
|
762
739
|
var selectedTabstop = this.selectedTabstop || {};
|
|
763
740
|
var parents = selectedTabstop.parents || {};
|
|
764
|
-
var tabstops =
|
|
741
|
+
var tabstops = this.tabstops.slice();
|
|
765
742
|
for (var i = 0; i < tabstops.length; i++) {
|
|
766
743
|
var ts = tabstops[i];
|
|
767
744
|
var active = ts == selectedTabstop || parents[ts.index];
|
|
768
745
|
ts.rangeList.$bias = active ? 0 : 1;
|
|
769
|
-
|
|
770
746
|
if (delta.action == "remove" && ts !== selectedTabstop) {
|
|
771
747
|
var parentActive = ts.parents && ts.parents[selectedTabstop.index];
|
|
772
748
|
var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
|
|
@@ -779,16 +755,16 @@ var TabstopManager = function(editor) {
|
|
|
779
755
|
}
|
|
780
756
|
ts.rangeList.$onChange(delta);
|
|
781
757
|
}
|
|
782
|
-
var session = this.
|
|
758
|
+
var session = this.session;
|
|
783
759
|
if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
|
|
784
760
|
this.detach();
|
|
785
761
|
};
|
|
786
|
-
|
|
762
|
+
TabstopManager.prototype.updateLinkedFields = function () {
|
|
787
763
|
var ts = this.selectedTabstop;
|
|
788
764
|
if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
|
|
789
765
|
return;
|
|
790
766
|
this.$inChange = true;
|
|
791
|
-
var session = this.
|
|
767
|
+
var session = this.session;
|
|
792
768
|
var text = session.getTextRange(ts.firstNonLinked);
|
|
793
769
|
for (var i = 0; i < ts.length; i++) {
|
|
794
770
|
var range = ts[i];
|
|
@@ -800,11 +776,11 @@ var TabstopManager = function(editor) {
|
|
|
800
776
|
}
|
|
801
777
|
this.$inChange = false;
|
|
802
778
|
};
|
|
803
|
-
|
|
779
|
+
TabstopManager.prototype.onAfterExec = function (e) {
|
|
804
780
|
if (e.command && !e.command.readOnly)
|
|
805
781
|
this.updateLinkedFields();
|
|
806
782
|
};
|
|
807
|
-
|
|
783
|
+
TabstopManager.prototype.onChangeSelection = function () {
|
|
808
784
|
if (!this.editor)
|
|
809
785
|
return;
|
|
810
786
|
var lead = this.editor.selection.lead;
|
|
@@ -820,10 +796,10 @@ var TabstopManager = function(editor) {
|
|
|
820
796
|
}
|
|
821
797
|
this.detach();
|
|
822
798
|
};
|
|
823
|
-
|
|
799
|
+
TabstopManager.prototype.onChangeSession = function () {
|
|
824
800
|
this.detach();
|
|
825
801
|
};
|
|
826
|
-
|
|
802
|
+
TabstopManager.prototype.tabNext = function (dir) {
|
|
827
803
|
var max = this.tabstops.length;
|
|
828
804
|
var index = this.index + (dir || 1);
|
|
829
805
|
index = Math.min(Math.max(index, 1), max);
|
|
@@ -833,7 +809,7 @@ var TabstopManager = function(editor) {
|
|
|
833
809
|
if (index === 0)
|
|
834
810
|
this.detach();
|
|
835
811
|
};
|
|
836
|
-
|
|
812
|
+
TabstopManager.prototype.selectTabstop = function (index) {
|
|
837
813
|
this.$openTabstops = null;
|
|
838
814
|
var ts = this.tabstops[this.index];
|
|
839
815
|
if (ts)
|
|
@@ -842,10 +818,10 @@ var TabstopManager = function(editor) {
|
|
|
842
818
|
ts = this.tabstops[this.index];
|
|
843
819
|
if (!ts || !ts.length)
|
|
844
820
|
return;
|
|
845
|
-
|
|
846
821
|
this.selectedTabstop = ts;
|
|
847
822
|
var range = ts.firstNonLinked || ts;
|
|
848
|
-
if (ts.choices)
|
|
823
|
+
if (ts.choices)
|
|
824
|
+
range.cursor = range.start;
|
|
849
825
|
if (!this.editor.inVirtualSelectionMode) {
|
|
850
826
|
var sel = this.editor.multiSelect;
|
|
851
827
|
sel.toSingleRange(range);
|
|
@@ -854,17 +830,16 @@ var TabstopManager = function(editor) {
|
|
|
854
830
|
continue;
|
|
855
831
|
sel.addRange(ts[i].clone(), true);
|
|
856
832
|
}
|
|
857
|
-
}
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
858
835
|
this.editor.selection.fromOrientedRange(range);
|
|
859
836
|
}
|
|
860
|
-
|
|
861
837
|
this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
|
862
838
|
if (this.selectedTabstop && this.selectedTabstop.choices)
|
|
863
|
-
this.editor.execCommand("startAutocomplete", {matches: this.selectedTabstop.choices});
|
|
839
|
+
this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
|
|
864
840
|
};
|
|
865
|
-
|
|
841
|
+
TabstopManager.prototype.addTabstops = function (tabstops, start, end) {
|
|
866
842
|
var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
|
|
867
|
-
|
|
868
843
|
if (!this.$openTabstops)
|
|
869
844
|
this.$openTabstops = [];
|
|
870
845
|
if (!tabstops[0]) {
|
|
@@ -874,13 +849,11 @@ var TabstopManager = function(editor) {
|
|
|
874
849
|
tabstops[0] = [p];
|
|
875
850
|
tabstops[0].index = 0;
|
|
876
851
|
}
|
|
877
|
-
|
|
878
852
|
var i = this.index;
|
|
879
853
|
var arg = [i + 1, 0];
|
|
880
854
|
var ranges = this.ranges;
|
|
881
|
-
tabstops.forEach(function(ts, index) {
|
|
855
|
+
tabstops.forEach(function (ts, index) {
|
|
882
856
|
var dest = this.$openTabstops[index] || ts;
|
|
883
|
-
|
|
884
857
|
for (var i = 0; i < ts.length; i++) {
|
|
885
858
|
var p = ts[i];
|
|
886
859
|
var range = Range.fromPoints(p.start, p.end || p.start);
|
|
@@ -896,7 +869,8 @@ var TabstopManager = function(editor) {
|
|
|
896
869
|
if (p.fmtString || (dest.firstNonLinked && useLink)) {
|
|
897
870
|
range.linked = true;
|
|
898
871
|
dest.hasLinkedRanges = true;
|
|
899
|
-
}
|
|
872
|
+
}
|
|
873
|
+
else if (!dest.firstNonLinked)
|
|
900
874
|
dest.firstNonLinked = range;
|
|
901
875
|
}
|
|
902
876
|
if (!dest.firstNonLinked)
|
|
@@ -910,36 +884,37 @@ var TabstopManager = function(editor) {
|
|
|
910
884
|
dest.rangeList.$bias = 0;
|
|
911
885
|
dest.rangeList.addList(dest);
|
|
912
886
|
}, this);
|
|
913
|
-
|
|
914
887
|
if (arg.length > 2) {
|
|
915
888
|
if (this.tabstops.length)
|
|
916
889
|
arg.push(arg.splice(2, 1)[0]);
|
|
917
890
|
this.tabstops.splice.apply(this.tabstops, arg);
|
|
918
891
|
}
|
|
919
892
|
};
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
if (!range.markerId)
|
|
893
|
+
TabstopManager.prototype.addTabstopMarkers = function (ts) {
|
|
894
|
+
var session = this.session;
|
|
895
|
+
ts.forEach(function (range) {
|
|
896
|
+
if (!range.markerId)
|
|
925
897
|
range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
|
|
926
898
|
});
|
|
927
899
|
};
|
|
928
|
-
|
|
929
|
-
var session = this.
|
|
930
|
-
ts.forEach(function(range) {
|
|
900
|
+
TabstopManager.prototype.removeTabstopMarkers = function (ts) {
|
|
901
|
+
var session = this.session;
|
|
902
|
+
ts.forEach(function (range) {
|
|
931
903
|
session.removeMarker(range.markerId);
|
|
932
904
|
range.markerId = null;
|
|
933
905
|
});
|
|
934
906
|
};
|
|
935
|
-
|
|
907
|
+
TabstopManager.prototype.removeRange = function (range) {
|
|
936
908
|
var i = range.tabstop.indexOf(range);
|
|
937
|
-
if (i != -1)
|
|
909
|
+
if (i != -1)
|
|
910
|
+
range.tabstop.splice(i, 1);
|
|
938
911
|
i = this.ranges.indexOf(range);
|
|
939
|
-
if (i != -1)
|
|
912
|
+
if (i != -1)
|
|
913
|
+
this.ranges.splice(i, 1);
|
|
940
914
|
i = range.tabstop.rangeList.ranges.indexOf(range);
|
|
941
|
-
if (i != -1)
|
|
942
|
-
|
|
915
|
+
if (i != -1)
|
|
916
|
+
range.tabstop.splice(i, 1);
|
|
917
|
+
this.session.removeMarker(range.markerId);
|
|
943
918
|
if (!range.tabstop.length) {
|
|
944
919
|
i = this.tabstops.indexOf(range.tabstop);
|
|
945
920
|
if (i != -1)
|
|
@@ -948,76 +923,59 @@ var TabstopManager = function(editor) {
|
|
|
948
923
|
this.detach();
|
|
949
924
|
}
|
|
950
925
|
};
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
}
|
|
968
|
-
})
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
var movePoint = function(point, diff) {
|
|
926
|
+
return TabstopManager;
|
|
927
|
+
}());
|
|
928
|
+
TabstopManager.prototype.keyboardHandler = new HashHandler();
|
|
929
|
+
TabstopManager.prototype.keyboardHandler.bindKeys({
|
|
930
|
+
"Tab": function (editor) {
|
|
931
|
+
if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
|
|
932
|
+
return;
|
|
933
|
+
editor.tabstopManager.tabNext(1);
|
|
934
|
+
editor.renderer.scrollCursorIntoView();
|
|
935
|
+
},
|
|
936
|
+
"Shift-Tab": function (editor) {
|
|
937
|
+
editor.tabstopManager.tabNext(-1);
|
|
938
|
+
editor.renderer.scrollCursorIntoView();
|
|
939
|
+
},
|
|
940
|
+
"Esc": function (editor) {
|
|
941
|
+
editor.tabstopManager.detach();
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
var movePoint = function (point, diff) {
|
|
973
945
|
if (point.row == 0)
|
|
974
946
|
point.column += diff.column;
|
|
975
947
|
point.row += diff.row;
|
|
976
948
|
};
|
|
977
|
-
|
|
978
|
-
var moveRelative = function(point, start) {
|
|
949
|
+
var moveRelative = function (point, start) {
|
|
979
950
|
if (point.row == start.row)
|
|
980
951
|
point.column -= start.column;
|
|
981
952
|
point.row -= start.row;
|
|
982
953
|
};
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
dom.importCssString("\
|
|
986
|
-
.ace_snippet-marker {\
|
|
987
|
-
-moz-box-sizing: border-box;\
|
|
988
|
-
box-sizing: border-box;\
|
|
989
|
-
background: rgba(194, 193, 208, 0.09);\
|
|
990
|
-
border: 1px dotted rgba(211, 208, 235, 0.62);\
|
|
991
|
-
position: absolute;\
|
|
992
|
-
}", "snippets.css", false);
|
|
993
|
-
|
|
954
|
+
dom.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}", "snippets.css", false);
|
|
994
955
|
exports.snippetManager = new SnippetManager();
|
|
995
|
-
|
|
996
|
-
|
|
997
956
|
var Editor = require("./editor").Editor;
|
|
998
|
-
(function() {
|
|
999
|
-
this.insertSnippet = function(content, options) {
|
|
957
|
+
(function () {
|
|
958
|
+
this.insertSnippet = function (content, options) {
|
|
1000
959
|
return exports.snippetManager.insertSnippet(this, content, options);
|
|
1001
960
|
};
|
|
1002
|
-
this.expandSnippet = function(options) {
|
|
961
|
+
this.expandSnippet = function (options) {
|
|
1003
962
|
return exports.snippetManager.expandWithTab(this, options);
|
|
1004
963
|
};
|
|
1005
964
|
}).call(Editor.prototype);
|
|
1006
965
|
|
|
1007
966
|
});
|
|
1008
967
|
|
|
1009
|
-
ace.define("ace/ext/emmet",[], function(require, exports, module)
|
|
1010
|
-
"use strict";
|
|
968
|
+
ace.define("ace/ext/emmet",["require","exports","module","ace/keyboard/hash_handler","ace/editor","ace/snippets","ace/range","ace/config","resources","resources","tabStops","resources","utils","actions"], function(require, exports, module){"use strict";
|
|
1011
969
|
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
|
1012
970
|
var Editor = require("../editor").Editor;
|
|
1013
971
|
var snippetManager = require("../snippets").snippetManager;
|
|
1014
972
|
var Range = require("../range").Range;
|
|
1015
973
|
var config = require("../config");
|
|
1016
974
|
var emmet, emmetPath;
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
setupContext
|
|
975
|
+
var AceEmmetEditor = /** @class */ (function () {
|
|
976
|
+
function AceEmmetEditor() {
|
|
977
|
+
}
|
|
978
|
+
AceEmmetEditor.prototype.setupContext = function (editor) {
|
|
1021
979
|
this.ace = editor;
|
|
1022
980
|
this.indentation = editor.session.getTabString();
|
|
1023
981
|
if (!emmet)
|
|
@@ -1026,64 +984,61 @@ AceEmmetEditor.prototype = {
|
|
|
1026
984
|
resources.setVariable("indentation", this.indentation);
|
|
1027
985
|
this.$syntax = null;
|
|
1028
986
|
this.$syntax = this.getSyntax();
|
|
1029
|
-
}
|
|
1030
|
-
getSelectionRange
|
|
987
|
+
};
|
|
988
|
+
AceEmmetEditor.prototype.getSelectionRange = function () {
|
|
1031
989
|
var range = this.ace.getSelectionRange();
|
|
1032
990
|
var doc = this.ace.session.doc;
|
|
1033
991
|
return {
|
|
1034
992
|
start: doc.positionToIndex(range.start),
|
|
1035
993
|
end: doc.positionToIndex(range.end)
|
|
1036
994
|
};
|
|
1037
|
-
}
|
|
1038
|
-
createSelection
|
|
995
|
+
};
|
|
996
|
+
AceEmmetEditor.prototype.createSelection = function (start, end) {
|
|
1039
997
|
var doc = this.ace.session.doc;
|
|
1040
998
|
this.ace.selection.setRange({
|
|
1041
999
|
start: doc.indexToPosition(start),
|
|
1042
1000
|
end: doc.indexToPosition(end)
|
|
1043
1001
|
});
|
|
1044
|
-
}
|
|
1045
|
-
getCurrentLineRange
|
|
1002
|
+
};
|
|
1003
|
+
AceEmmetEditor.prototype.getCurrentLineRange = function () {
|
|
1046
1004
|
var ace = this.ace;
|
|
1047
1005
|
var row = ace.getCursorPosition().row;
|
|
1048
1006
|
var lineLength = ace.session.getLine(row).length;
|
|
1049
|
-
var index = ace.session.doc.positionToIndex({row: row, column: 0});
|
|
1007
|
+
var index = ace.session.doc.positionToIndex({ row: row, column: 0 });
|
|
1050
1008
|
return {
|
|
1051
1009
|
start: index,
|
|
1052
1010
|
end: index + lineLength
|
|
1053
1011
|
};
|
|
1054
|
-
}
|
|
1055
|
-
getCaretPos
|
|
1012
|
+
};
|
|
1013
|
+
AceEmmetEditor.prototype.getCaretPos = function () {
|
|
1056
1014
|
var pos = this.ace.getCursorPosition();
|
|
1057
1015
|
return this.ace.session.doc.positionToIndex(pos);
|
|
1058
|
-
}
|
|
1059
|
-
setCaretPos
|
|
1016
|
+
};
|
|
1017
|
+
AceEmmetEditor.prototype.setCaretPos = function (index) {
|
|
1060
1018
|
var pos = this.ace.session.doc.indexToPosition(index);
|
|
1061
1019
|
this.ace.selection.moveToPosition(pos);
|
|
1062
|
-
}
|
|
1063
|
-
getCurrentLine
|
|
1020
|
+
};
|
|
1021
|
+
AceEmmetEditor.prototype.getCurrentLine = function () {
|
|
1064
1022
|
var row = this.ace.getCursorPosition().row;
|
|
1065
1023
|
return this.ace.session.getLine(row);
|
|
1066
|
-
}
|
|
1067
|
-
replaceContent
|
|
1024
|
+
};
|
|
1025
|
+
AceEmmetEditor.prototype.replaceContent = function (value, start, end, noIndent) {
|
|
1068
1026
|
if (end == null)
|
|
1069
1027
|
end = start == null ? this.getContent().length : start;
|
|
1070
1028
|
if (start == null)
|
|
1071
|
-
start = 0;
|
|
1072
|
-
|
|
1029
|
+
start = 0;
|
|
1073
1030
|
var editor = this.ace;
|
|
1074
1031
|
var doc = editor.session.doc;
|
|
1075
1032
|
var range = Range.fromPoints(doc.indexToPosition(start), doc.indexToPosition(end));
|
|
1076
1033
|
editor.session.remove(range);
|
|
1077
|
-
|
|
1078
1034
|
range.end = range.start;
|
|
1079
|
-
|
|
1080
1035
|
value = this.$updateTabstops(value);
|
|
1081
1036
|
snippetManager.insertSnippet(editor, value);
|
|
1082
|
-
}
|
|
1083
|
-
getContent
|
|
1037
|
+
};
|
|
1038
|
+
AceEmmetEditor.prototype.getContent = function () {
|
|
1084
1039
|
return this.ace.getValue();
|
|
1085
|
-
}
|
|
1086
|
-
getSyntax
|
|
1040
|
+
};
|
|
1041
|
+
AceEmmetEditor.prototype.getSyntax = function () {
|
|
1087
1042
|
if (this.$syntax)
|
|
1088
1043
|
return this.$syntax;
|
|
1089
1044
|
var syntax = this.ace.session.$modeId.split("/").pop();
|
|
@@ -1101,34 +1056,34 @@ AceEmmetEditor.prototype = {
|
|
|
1101
1056
|
}
|
|
1102
1057
|
}
|
|
1103
1058
|
return syntax;
|
|
1104
|
-
}
|
|
1105
|
-
getProfileName
|
|
1059
|
+
};
|
|
1060
|
+
AceEmmetEditor.prototype.getProfileName = function () {
|
|
1106
1061
|
var resources = emmet.resources || emmet.require("resources");
|
|
1107
1062
|
switch (this.getSyntax()) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1063
|
+
case "css": return "css";
|
|
1064
|
+
case "xml":
|
|
1065
|
+
case "xsl":
|
|
1066
|
+
return "xml";
|
|
1067
|
+
case "html":
|
|
1068
|
+
var profile = resources.getVariable("profile");
|
|
1069
|
+
if (!profile)
|
|
1070
|
+
profile = this.ace.session.getLines(0, 2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml" : "html";
|
|
1071
|
+
return profile;
|
|
1072
|
+
default:
|
|
1073
|
+
var mode = this.ace.session.$mode;
|
|
1074
|
+
return mode.emmetConfig && mode.emmetConfig.profile || "xhtml";
|
|
1120
1075
|
}
|
|
1121
|
-
}
|
|
1122
|
-
prompt
|
|
1076
|
+
};
|
|
1077
|
+
AceEmmetEditor.prototype.prompt = function (title) {
|
|
1123
1078
|
return prompt(title); // eslint-disable-line no-alert
|
|
1124
|
-
}
|
|
1125
|
-
getSelection
|
|
1079
|
+
};
|
|
1080
|
+
AceEmmetEditor.prototype.getSelection = function () {
|
|
1126
1081
|
return this.ace.session.getTextRange();
|
|
1127
|
-
}
|
|
1128
|
-
getFilePath
|
|
1082
|
+
};
|
|
1083
|
+
AceEmmetEditor.prototype.getFilePath = function () {
|
|
1129
1084
|
return "";
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1085
|
+
};
|
|
1086
|
+
AceEmmetEditor.prototype.$updateTabstops = function (value) {
|
|
1132
1087
|
var base = 1000;
|
|
1133
1088
|
var zeroBase = 0;
|
|
1134
1089
|
var lastZero = null;
|
|
@@ -1136,74 +1091,67 @@ AceEmmetEditor.prototype = {
|
|
|
1136
1091
|
var resources = emmet.resources || emmet.require("resources");
|
|
1137
1092
|
var settings = resources.getVocabulary("user");
|
|
1138
1093
|
var tabstopOptions = {
|
|
1139
|
-
tabstop: function(data) {
|
|
1094
|
+
tabstop: function (data) {
|
|
1140
1095
|
var group = parseInt(data.group, 10);
|
|
1141
1096
|
var isZero = group === 0;
|
|
1142
1097
|
if (isZero)
|
|
1143
1098
|
group = ++zeroBase;
|
|
1144
1099
|
else
|
|
1145
1100
|
group += base;
|
|
1146
|
-
|
|
1147
1101
|
var placeholder = data.placeholder;
|
|
1148
1102
|
if (placeholder) {
|
|
1149
1103
|
placeholder = ts.processText(placeholder, tabstopOptions);
|
|
1150
1104
|
}
|
|
1151
|
-
|
|
1152
1105
|
var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}';
|
|
1153
|
-
|
|
1154
1106
|
if (isZero) {
|
|
1155
1107
|
lastZero = [data.start, result];
|
|
1156
1108
|
}
|
|
1157
|
-
|
|
1158
1109
|
return result;
|
|
1159
1110
|
},
|
|
1160
|
-
escape: function(ch) {
|
|
1161
|
-
if (ch == '$')
|
|
1162
|
-
|
|
1111
|
+
escape: function (ch) {
|
|
1112
|
+
if (ch == '$')
|
|
1113
|
+
return '\\$';
|
|
1114
|
+
if (ch == '\\')
|
|
1115
|
+
return '\\\\';
|
|
1163
1116
|
return ch;
|
|
1164
1117
|
}
|
|
1165
1118
|
};
|
|
1166
|
-
|
|
1167
1119
|
value = ts.processText(value, tabstopOptions);
|
|
1168
|
-
|
|
1169
1120
|
if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) {
|
|
1170
1121
|
value += '${0}';
|
|
1171
|
-
}
|
|
1122
|
+
}
|
|
1123
|
+
else if (lastZero) {
|
|
1172
1124
|
var common = emmet.utils ? emmet.utils.common : emmet.require('utils');
|
|
1173
1125
|
value = common.replaceSubstring(value, '${0}', lastZero[0], lastZero[1]);
|
|
1174
1126
|
}
|
|
1175
|
-
|
|
1176
1127
|
return value;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1128
|
+
};
|
|
1129
|
+
return AceEmmetEditor;
|
|
1130
|
+
}());
|
|
1181
1131
|
var keymap = {
|
|
1182
|
-
expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"},
|
|
1183
|
-
match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"},
|
|
1184
|
-
match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"},
|
|
1185
|
-
matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"},
|
|
1132
|
+
expand_abbreviation: { "mac": "ctrl+alt+e", "win": "alt+e" },
|
|
1133
|
+
match_pair_outward: { "mac": "ctrl+d", "win": "ctrl+," },
|
|
1134
|
+
match_pair_inward: { "mac": "ctrl+j", "win": "ctrl+shift+0" },
|
|
1135
|
+
matching_pair: { "mac": "ctrl+alt+j", "win": "alt+j" },
|
|
1186
1136
|
next_edit_point: "alt+right",
|
|
1187
1137
|
prev_edit_point: "alt+left",
|
|
1188
|
-
toggle_comment: {"mac": "command+/", "win": "ctrl+/"},
|
|
1189
|
-
split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"},
|
|
1190
|
-
remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"},
|
|
1191
|
-
evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"},
|
|
1138
|
+
toggle_comment: { "mac": "command+/", "win": "ctrl+/" },
|
|
1139
|
+
split_join_tag: { "mac": "shift+command+'", "win": "shift+ctrl+`" },
|
|
1140
|
+
remove_tag: { "mac": "command+'", "win": "shift+ctrl+;" },
|
|
1141
|
+
evaluate_math_expression: { "mac": "shift+command+y", "win": "shift+ctrl+y" },
|
|
1192
1142
|
increment_number_by_1: "ctrl+up",
|
|
1193
1143
|
decrement_number_by_1: "ctrl+down",
|
|
1194
1144
|
increment_number_by_01: "alt+up",
|
|
1195
1145
|
decrement_number_by_01: "alt+down",
|
|
1196
|
-
increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"},
|
|
1197
|
-
decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"},
|
|
1198
|
-
select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."},
|
|
1199
|
-
select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"},
|
|
1200
|
-
reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"},
|
|
1201
|
-
|
|
1202
|
-
encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"},
|
|
1146
|
+
increment_number_by_10: { "mac": "alt+command+up", "win": "shift+alt+up" },
|
|
1147
|
+
decrement_number_by_10: { "mac": "alt+command+down", "win": "shift+alt+down" },
|
|
1148
|
+
select_next_item: { "mac": "shift+command+.", "win": "shift+ctrl+." },
|
|
1149
|
+
select_previous_item: { "mac": "shift+command+,", "win": "shift+ctrl+," },
|
|
1150
|
+
reflect_css_value: { "mac": "shift+command+r", "win": "shift+ctrl+r" },
|
|
1151
|
+
encode_decode_data_url: { "mac": "shift+ctrl+d", "win": "ctrl+'" },
|
|
1203
1152
|
expand_abbreviation_with_tab: "Tab",
|
|
1204
|
-
wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"}
|
|
1153
|
+
wrap_with_abbreviation: { "mac": "shift+ctrl+a", "win": "shift+ctrl+a" }
|
|
1205
1154
|
};
|
|
1206
|
-
|
|
1207
1155
|
var editorProxy = new AceEmmetEditor();
|
|
1208
1156
|
exports.commands = new HashHandler();
|
|
1209
1157
|
exports.runEmmetCommand = function runEmmetCommand(editor) {
|
|
@@ -1218,15 +1166,14 @@ exports.runEmmetCommand = function runEmmetCommand(editor) {
|
|
|
1218
1166
|
try {
|
|
1219
1167
|
editorProxy.setupContext(editor);
|
|
1220
1168
|
var actions = emmet.actions || emmet.require("actions");
|
|
1221
|
-
|
|
1222
1169
|
if (this.action == "wrap_with_abbreviation") {
|
|
1223
|
-
return setTimeout(function() {
|
|
1170
|
+
return setTimeout(function () {
|
|
1224
1171
|
actions.run("wrap_with_abbreviation", editorProxy);
|
|
1225
1172
|
}, 0);
|
|
1226
1173
|
}
|
|
1227
|
-
|
|
1228
1174
|
var result = actions.run(this.action, editorProxy);
|
|
1229
|
-
}
|
|
1175
|
+
}
|
|
1176
|
+
catch (e) {
|
|
1230
1177
|
if (!emmet) {
|
|
1231
1178
|
var loading = exports.load(runEmmetCommand.bind(this, editor));
|
|
1232
1179
|
if (this.action == "expand_abbreviation_with_tab")
|
|
@@ -1239,7 +1186,6 @@ exports.runEmmetCommand = function runEmmetCommand(editor) {
|
|
|
1239
1186
|
}
|
|
1240
1187
|
return result;
|
|
1241
1188
|
};
|
|
1242
|
-
|
|
1243
1189
|
for (var command in keymap) {
|
|
1244
1190
|
exports.commands.addCommand({
|
|
1245
1191
|
name: "emmet:" + command,
|
|
@@ -1249,23 +1195,23 @@ for (var command in keymap) {
|
|
|
1249
1195
|
multiSelectAction: "forEach"
|
|
1250
1196
|
});
|
|
1251
1197
|
}
|
|
1252
|
-
|
|
1253
|
-
exports.updateCommands = function(editor, enabled) {
|
|
1198
|
+
exports.updateCommands = function (editor, enabled) {
|
|
1254
1199
|
if (enabled) {
|
|
1255
1200
|
editor.keyBinding.addKeyboardHandler(exports.commands);
|
|
1256
|
-
}
|
|
1201
|
+
}
|
|
1202
|
+
else {
|
|
1257
1203
|
editor.keyBinding.removeKeyboardHandler(exports.commands);
|
|
1258
1204
|
}
|
|
1259
1205
|
};
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
if (mode.emmetConfig)
|
|
1206
|
+
exports.isSupportedMode = function (mode) {
|
|
1207
|
+
if (!mode)
|
|
1208
|
+
return false;
|
|
1209
|
+
if (mode.emmetConfig)
|
|
1210
|
+
return true;
|
|
1264
1211
|
var id = mode.$id || mode;
|
|
1265
1212
|
return /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(id);
|
|
1266
1213
|
};
|
|
1267
|
-
|
|
1268
|
-
exports.isAvailable = function(editor, command) {
|
|
1214
|
+
exports.isAvailable = function (editor, command) {
|
|
1269
1215
|
if (/(evaluate_math_expression|expand_abbreviation)$/.test(command))
|
|
1270
1216
|
return true;
|
|
1271
1217
|
var mode = editor.session.$mode;
|
|
@@ -1275,12 +1221,12 @@ exports.isAvailable = function(editor, command) {
|
|
|
1275
1221
|
editorProxy.setupContext(editor);
|
|
1276
1222
|
if (/js|php/.test(editorProxy.getSyntax()))
|
|
1277
1223
|
isSupported = false;
|
|
1278
|
-
}
|
|
1224
|
+
}
|
|
1225
|
+
catch (e) { }
|
|
1279
1226
|
}
|
|
1280
1227
|
return isSupported;
|
|
1281
1228
|
};
|
|
1282
|
-
|
|
1283
|
-
var onChangeMode = function(e, target) {
|
|
1229
|
+
var onChangeMode = function (e, target) {
|
|
1284
1230
|
var editor = target;
|
|
1285
1231
|
if (!editor)
|
|
1286
1232
|
return;
|
|
@@ -1291,36 +1237,34 @@ var onChangeMode = function(e, target) {
|
|
|
1291
1237
|
exports.load();
|
|
1292
1238
|
exports.updateCommands(editor, enabled);
|
|
1293
1239
|
};
|
|
1294
|
-
|
|
1295
|
-
exports.load = function(cb) {
|
|
1240
|
+
exports.load = function (cb) {
|
|
1296
1241
|
if (typeof emmetPath !== "string") {
|
|
1297
1242
|
config.warn("script for emmet-core is not loaded");
|
|
1298
1243
|
return false;
|
|
1299
1244
|
}
|
|
1300
|
-
config.loadModule(emmetPath, function() {
|
|
1245
|
+
config.loadModule(emmetPath, function () {
|
|
1301
1246
|
emmetPath = null;
|
|
1302
1247
|
cb && cb();
|
|
1303
1248
|
});
|
|
1304
1249
|
return true;
|
|
1305
1250
|
};
|
|
1306
|
-
|
|
1307
1251
|
exports.AceEmmetEditor = AceEmmetEditor;
|
|
1308
1252
|
config.defineOptions(Editor.prototype, "editor", {
|
|
1309
1253
|
enableEmmet: {
|
|
1310
|
-
set: function(val) {
|
|
1254
|
+
set: function (val) {
|
|
1311
1255
|
this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
|
|
1312
|
-
onChangeMode({enableEmmet: !!val}, this);
|
|
1256
|
+
onChangeMode({ enableEmmet: !!val }, this);
|
|
1313
1257
|
},
|
|
1314
1258
|
value: true
|
|
1315
1259
|
}
|
|
1316
1260
|
});
|
|
1317
|
-
|
|
1318
|
-
exports.setCore = function(e) {
|
|
1261
|
+
exports.setCore = function (e) {
|
|
1319
1262
|
if (typeof e == "string")
|
|
1320
|
-
|
|
1263
|
+
emmetPath = e;
|
|
1321
1264
|
else
|
|
1322
|
-
|
|
1265
|
+
emmet = e;
|
|
1323
1266
|
};
|
|
1267
|
+
|
|
1324
1268
|
}); (function() {
|
|
1325
1269
|
ace.require(["ace/ext/emmet"], function(m) {
|
|
1326
1270
|
if (typeof module == "object" && typeof exports == "object" && module) {
|