@muze-nl/simplystore 0.3.5 → 0.4.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/package.json +2 -2
- package/package.json~ +33 -0
- package/src/commands.mjs +1 -0
- package/src/server.mjs +69 -62
- package/src/worker-command-init.mjs +2 -1
- package/src/worker-command.mjs +3 -3
- package/www/codemirror/addon/comment/comment.js +0 -211
- package/www/codemirror/addon/comment/continuecomment.js +0 -114
- package/www/codemirror/addon/dialog/dialog.css +0 -32
- package/www/codemirror/addon/dialog/dialog.js +0 -163
- package/www/codemirror/addon/display/autorefresh.js +0 -47
- package/www/codemirror/addon/display/fullscreen.css +0 -6
- package/www/codemirror/addon/display/fullscreen.js +0 -41
- package/www/codemirror/addon/display/panel.js +0 -133
- package/www/codemirror/addon/display/placeholder.js +0 -78
- package/www/codemirror/addon/display/rulers.js +0 -51
- package/www/codemirror/addon/edit/closebrackets.js +0 -201
- package/www/codemirror/addon/edit/closetag.js +0 -185
- package/www/codemirror/addon/edit/continuelist.js +0 -101
- package/www/codemirror/addon/edit/matchbrackets.js +0 -160
- package/www/codemirror/addon/edit/matchtags.js +0 -66
- package/www/codemirror/addon/edit/trailingspace.js +0 -27
- package/www/codemirror/addon/fold/brace-fold.js +0 -119
- package/www/codemirror/addon/fold/comment-fold.js +0 -59
- package/www/codemirror/addon/fold/foldcode.js +0 -159
- package/www/codemirror/addon/fold/foldgutter.css +0 -20
- package/www/codemirror/addon/fold/foldgutter.js +0 -169
- package/www/codemirror/addon/fold/indent-fold.js +0 -48
- package/www/codemirror/addon/fold/markdown-fold.js +0 -49
- package/www/codemirror/addon/fold/xml-fold.js +0 -184
- package/www/codemirror/addon/hint/anyword-hint.js +0 -41
- package/www/codemirror/addon/hint/css-hint.js +0 -66
- package/www/codemirror/addon/hint/html-hint.js +0 -351
- package/www/codemirror/addon/hint/javascript-hint.js +0 -162
- package/www/codemirror/addon/hint/show-hint.css +0 -37
- package/www/codemirror/addon/hint/show-hint.js +0 -523
- package/www/codemirror/addon/hint/sql-hint.js +0 -304
- package/www/codemirror/addon/hint/xml-hint.js +0 -132
- package/www/codemirror/addon/lint/coffeescript-lint.js +0 -47
- package/www/codemirror/addon/lint/css-lint.js +0 -40
- package/www/codemirror/addon/lint/html-lint.js +0 -59
- package/www/codemirror/addon/lint/json-lint.js +0 -40
- package/www/codemirror/addon/lint/yaml-lint.js +0 -41
- package/www/codemirror/addon/merge/merge.css +0 -119
- package/www/codemirror/addon/merge/merge.js +0 -1018
- package/www/codemirror/addon/mode/loadmode.js +0 -66
- package/www/codemirror/addon/mode/multiplex.js +0 -136
- package/www/codemirror/addon/mode/multiplex_test.js +0 -49
- package/www/codemirror/addon/mode/overlay.js +0 -90
- package/www/codemirror/addon/mode/simple.js +0 -216
- package/www/codemirror/addon/runmode/colorize.js +0 -40
- package/www/codemirror/addon/runmode/runmode-standalone.js +0 -334
- package/www/codemirror/addon/runmode/runmode.js +0 -76
- package/www/codemirror/addon/runmode/runmode.node.js +0 -329
- package/www/codemirror/addon/scroll/annotatescrollbar.js +0 -128
- package/www/codemirror/addon/scroll/scrollpastend.js +0 -48
- package/www/codemirror/addon/scroll/simplescrollbars.css +0 -66
- package/www/codemirror/addon/scroll/simplescrollbars.js +0 -152
- package/www/codemirror/addon/search/jump-to-line.js +0 -53
- package/www/codemirror/addon/search/match-highlighter.js +0 -167
- package/www/codemirror/addon/search/matchesonscrollbar.css +0 -8
- package/www/codemirror/addon/search/matchesonscrollbar.js +0 -97
- package/www/codemirror/addon/search/search.js +0 -295
- package/www/codemirror/addon/search/searchcursor.js +0 -305
- package/www/codemirror/addon/selection/active-line.js +0 -72
- package/www/codemirror/addon/selection/mark-selection.js +0 -119
- package/www/codemirror/addon/selection/selection-pointer.js +0 -98
- package/www/codemirror/addon/tern/tern.css +0 -87
- package/www/codemirror/addon/tern/tern.js +0 -756
- package/www/codemirror/addon/tern/worker.js +0 -44
- package/www/codemirror/addon/wrap/hardwrap.js +0 -160
- package/www/codemirror/bin/source-highlight +0 -48
- package/www/codemirror/keymap/emacs.js +0 -545
- package/www/codemirror/keymap/sublime.js +0 -720
- package/www/codemirror/keymap/vim.js +0 -5978
- package/www/codemirror/mode/apl/apl.js +0 -174
- package/www/codemirror/mode/asciiarmor/asciiarmor.js +0 -74
- package/www/codemirror/mode/asn.1/asn.1.js +0 -204
- package/www/codemirror/mode/asterisk/asterisk.js +0 -220
- package/www/codemirror/mode/brainfuck/brainfuck.js +0 -85
- package/www/codemirror/mode/clike/clike.js +0 -940
- package/www/codemirror/mode/clojure/clojure.js +0 -292
- package/www/codemirror/mode/cmake/cmake.js +0 -97
- package/www/codemirror/mode/cobol/cobol.js +0 -255
- package/www/codemirror/mode/coffeescript/coffeescript.js +0 -359
- package/www/codemirror/mode/commonlisp/commonlisp.js +0 -125
- package/www/codemirror/mode/crystal/crystal.js +0 -433
- package/www/codemirror/mode/css/css.js +0 -862
- package/www/codemirror/mode/cypher/cypher.js +0 -152
- package/www/codemirror/mode/d/d.js +0 -223
- package/www/codemirror/mode/dart/dart.js +0 -166
- package/www/codemirror/mode/diff/diff.js +0 -47
- package/www/codemirror/mode/django/django.js +0 -356
- package/www/codemirror/mode/dockerfile/dockerfile.js +0 -211
- package/www/codemirror/mode/dtd/dtd.js +0 -142
- package/www/codemirror/mode/dylan/dylan.js +0 -352
- package/www/codemirror/mode/ebnf/ebnf.js +0 -195
- package/www/codemirror/mode/ecl/ecl.js +0 -206
- package/www/codemirror/mode/eiffel/eiffel.js +0 -160
- package/www/codemirror/mode/elm/elm.js +0 -245
- package/www/codemirror/mode/erlang/erlang.js +0 -619
- package/www/codemirror/mode/factor/factor.js +0 -85
- package/www/codemirror/mode/fcl/fcl.js +0 -173
- package/www/codemirror/mode/forth/forth.js +0 -180
- package/www/codemirror/mode/fortran/fortran.js +0 -188
- package/www/codemirror/mode/gas/gas.js +0 -353
- package/www/codemirror/mode/gfm/gfm.js +0 -129
- package/www/codemirror/mode/gherkin/gherkin.js +0 -178
- package/www/codemirror/mode/go/go.js +0 -187
- package/www/codemirror/mode/groovy/groovy.js +0 -247
- package/www/codemirror/mode/haml/haml.js +0 -161
- package/www/codemirror/mode/handlebars/handlebars.js +0 -70
- package/www/codemirror/mode/haskell/haskell.js +0 -268
- package/www/codemirror/mode/haskell-literate/haskell-literate.js +0 -43
- package/www/codemirror/mode/haxe/haxe.js +0 -515
- package/www/codemirror/mode/htmlembedded/htmlembedded.js +0 -37
- package/www/codemirror/mode/htmlmixed/htmlmixed.js +0 -153
- package/www/codemirror/mode/http/http.js +0 -113
- package/www/codemirror/mode/idl/idl.js +0 -290
- package/www/codemirror/mode/jinja2/jinja2.js +0 -193
- package/www/codemirror/mode/jsx/jsx.js +0 -148
- package/www/codemirror/mode/julia/julia.js +0 -390
- package/www/codemirror/mode/livescript/livescript.js +0 -280
- package/www/codemirror/mode/lua/lua.js +0 -160
- package/www/codemirror/mode/markdown/markdown.js +0 -886
- package/www/codemirror/mode/mathematica/mathematica.js +0 -176
- package/www/codemirror/mode/mbox/mbox.js +0 -129
- package/www/codemirror/mode/meta.js +0 -221
- package/www/codemirror/mode/mirc/mirc.js +0 -193
- package/www/codemirror/mode/mllike/mllike.js +0 -359
- package/www/codemirror/mode/modelica/modelica.js +0 -245
- package/www/codemirror/mode/mscgen/mscgen.js +0 -175
- package/www/codemirror/mode/mumps/mumps.js +0 -148
- package/www/codemirror/mode/nginx/nginx.js +0 -178
- package/www/codemirror/mode/nsis/nsis.js +0 -95
- package/www/codemirror/mode/ntriples/ntriples.js +0 -195
- package/www/codemirror/mode/octave/octave.js +0 -139
- package/www/codemirror/mode/oz/oz.js +0 -252
- package/www/codemirror/mode/pascal/pascal.js +0 -136
- package/www/codemirror/mode/pegjs/pegjs.js +0 -111
- package/www/codemirror/mode/perl/perl.js +0 -836
- package/www/codemirror/mode/php/php.js +0 -234
- package/www/codemirror/mode/pig/pig.js +0 -178
- package/www/codemirror/mode/powershell/powershell.js +0 -398
- package/www/codemirror/mode/properties/properties.js +0 -78
- package/www/codemirror/mode/protobuf/protobuf.js +0 -72
- package/www/codemirror/mode/pug/pug.js +0 -591
- package/www/codemirror/mode/puppet/puppet.js +0 -220
- package/www/codemirror/mode/python/python.js +0 -402
- package/www/codemirror/mode/q/q.js +0 -139
- package/www/codemirror/mode/r/r.js +0 -190
- package/www/codemirror/mode/rpm/changes/index.html +0 -66
- package/www/codemirror/mode/rpm/rpm.js +0 -109
- package/www/codemirror/mode/rst/rst.js +0 -557
- package/www/codemirror/mode/ruby/ruby.js +0 -303
- package/www/codemirror/mode/rust/rust.js +0 -72
- package/www/codemirror/mode/sas/sas.js +0 -303
- package/www/codemirror/mode/sass/sass.js +0 -459
- package/www/codemirror/mode/scheme/scheme.js +0 -284
- package/www/codemirror/mode/shell/shell.js +0 -168
- package/www/codemirror/mode/sieve/sieve.js +0 -193
- package/www/codemirror/mode/slim/slim.js +0 -575
- package/www/codemirror/mode/smalltalk/smalltalk.js +0 -168
- package/www/codemirror/mode/smarty/smarty.js +0 -225
- package/www/codemirror/mode/solr/solr.js +0 -104
- package/www/codemirror/mode/soy/soy.js +0 -665
- package/www/codemirror/mode/sparql/sparql.js +0 -184
- package/www/codemirror/mode/spreadsheet/spreadsheet.js +0 -112
- package/www/codemirror/mode/sql/sql.js +0 -525
- package/www/codemirror/mode/stex/stex.js +0 -264
- package/www/codemirror/mode/stylus/stylus.js +0 -775
- package/www/codemirror/mode/swift/swift.js +0 -221
- package/www/codemirror/mode/tcl/tcl.js +0 -140
- package/www/codemirror/mode/textile/textile.js +0 -469
- package/www/codemirror/mode/tiddlywiki/tiddlywiki.css +0 -14
- package/www/codemirror/mode/tiddlywiki/tiddlywiki.js +0 -308
- package/www/codemirror/mode/tiki/tiki.css +0 -26
- package/www/codemirror/mode/tiki/tiki.js +0 -312
- package/www/codemirror/mode/toml/toml.js +0 -88
- package/www/codemirror/mode/tornado/tornado.js +0 -68
- package/www/codemirror/mode/troff/troff.js +0 -84
- package/www/codemirror/mode/ttcn/ttcn.js +0 -283
- package/www/codemirror/mode/ttcn-cfg/ttcn-cfg.js +0 -214
- package/www/codemirror/mode/turtle/turtle.js +0 -162
- package/www/codemirror/mode/twig/twig.js +0 -141
- package/www/codemirror/mode/vb/vb.js +0 -275
- package/www/codemirror/mode/vbscript/vbscript.js +0 -350
- package/www/codemirror/mode/velocity/velocity.js +0 -202
- package/www/codemirror/mode/verilog/verilog.js +0 -781
- package/www/codemirror/mode/vhdl/vhdl.js +0 -189
- package/www/codemirror/mode/vue/vue.js +0 -77
- package/www/codemirror/mode/wast/wast.js +0 -132
- package/www/codemirror/mode/webidl/webidl.js +0 -195
- package/www/codemirror/mode/xml/xml.js +0 -417
- package/www/codemirror/mode/xquery/xquery.js +0 -448
- package/www/codemirror/mode/yacas/yacas.js +0 -204
- package/www/codemirror/mode/yaml/yaml.js +0 -120
- package/www/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +0 -72
- package/www/codemirror/mode/z80/z80.js +0 -116
- package/www/codemirror/rollup.config.js +0 -52
- package/www/codemirror/src/addon/runmode/codemirror-standalone.js +0 -24
- package/www/codemirror/src/addon/runmode/codemirror.node.js +0 -21
- package/www/codemirror/src/addon/runmode/runmode-standalone.js +0 -2
- package/www/codemirror/src/addon/runmode/runmode.node.js +0 -2
- package/www/codemirror/src/codemirror.js +0 -3
- package/www/codemirror/src/display/Display.js +0 -116
- package/www/codemirror/src/display/focus.js +0 -50
- package/www/codemirror/src/display/gutters.js +0 -44
- package/www/codemirror/src/display/highlight_worker.js +0 -55
- package/www/codemirror/src/display/line_numbers.js +0 -48
- package/www/codemirror/src/display/mode_state.js +0 -22
- package/www/codemirror/src/display/operations.js +0 -206
- package/www/codemirror/src/display/scroll_events.js +0 -132
- package/www/codemirror/src/display/scrollbars.js +0 -194
- package/www/codemirror/src/display/scrolling.js +0 -186
- package/www/codemirror/src/display/selection.js +0 -173
- package/www/codemirror/src/display/update_display.js +0 -267
- package/www/codemirror/src/display/update_line.js +0 -189
- package/www/codemirror/src/display/update_lines.js +0 -82
- package/www/codemirror/src/display/view_tracking.js +0 -153
- package/www/codemirror/src/edit/CodeMirror.js +0 -217
- package/www/codemirror/src/edit/commands.js +0 -178
- package/www/codemirror/src/edit/deleteNearSelection.js +0 -30
- package/www/codemirror/src/edit/drop_events.js +0 -130
- package/www/codemirror/src/edit/fromTextArea.js +0 -61
- package/www/codemirror/src/edit/global_events.js +0 -45
- package/www/codemirror/src/edit/key_events.js +0 -163
- package/www/codemirror/src/edit/legacy.js +0 -62
- package/www/codemirror/src/edit/main.js +0 -69
- package/www/codemirror/src/edit/methods.js +0 -555
- package/www/codemirror/src/edit/mouse_events.js +0 -417
- package/www/codemirror/src/edit/options.js +0 -194
- package/www/codemirror/src/edit/utils.js +0 -7
- package/www/codemirror/src/input/ContentEditableInput.js +0 -546
- package/www/codemirror/src/input/TextareaInput.js +0 -380
- package/www/codemirror/src/input/indent.js +0 -71
- package/www/codemirror/src/input/input.js +0 -134
- package/www/codemirror/src/input/keymap.js +0 -147
- package/www/codemirror/src/input/keynames.js +0 -17
- package/www/codemirror/src/input/movement.js +0 -111
- package/www/codemirror/src/line/highlight.js +0 -284
- package/www/codemirror/src/line/line_data.js +0 -349
- package/www/codemirror/src/line/pos.js +0 -40
- package/www/codemirror/src/line/saw_special_spans.js +0 -10
- package/www/codemirror/src/line/spans.js +0 -390
- package/www/codemirror/src/line/utils_line.js +0 -85
- package/www/codemirror/src/measurement/position_measurement.js +0 -702
- package/www/codemirror/src/measurement/widgets.js +0 -26
- package/www/codemirror/src/model/Doc.js +0 -436
- package/www/codemirror/src/model/change_measurement.js +0 -61
- package/www/codemirror/src/model/changes.js +0 -339
- package/www/codemirror/src/model/chunk.js +0 -167
- package/www/codemirror/src/model/document_data.js +0 -112
- package/www/codemirror/src/model/history.js +0 -228
- package/www/codemirror/src/model/line_widget.js +0 -78
- package/www/codemirror/src/model/mark_text.js +0 -293
- package/www/codemirror/src/model/selection.js +0 -84
- package/www/codemirror/src/model/selection_updates.js +0 -216
- package/www/codemirror/src/modes.js +0 -96
- package/www/codemirror/src/util/StringStream.js +0 -90
- package/www/codemirror/src/util/bidi.js +0 -215
- package/www/codemirror/src/util/browser.js +0 -34
- package/www/codemirror/src/util/dom.js +0 -101
- package/www/codemirror/src/util/event.js +0 -103
- package/www/codemirror/src/util/feature_detection.js +0 -84
- package/www/codemirror/src/util/misc.js +0 -168
- package/www/codemirror/src/util/operation_group.js +0 -72
- package/www/codemirror/theme/3024-day.css +0 -41
- package/www/codemirror/theme/3024-night.css +0 -39
- package/www/codemirror/theme/abbott.css +0 -268
- package/www/codemirror/theme/abcdef.css +0 -32
- package/www/codemirror/theme/ambiance-mobile.css +0 -5
- package/www/codemirror/theme/ambiance.css +0 -74
- package/www/codemirror/theme/ayu-dark.css +0 -44
- package/www/codemirror/theme/ayu-mirage.css +0 -45
- package/www/codemirror/theme/base16-dark.css +0 -40
- package/www/codemirror/theme/base16-light.css +0 -38
- package/www/codemirror/theme/bespin.css +0 -34
- package/www/codemirror/theme/blackboard.css +0 -32
- package/www/codemirror/theme/cobalt.css +0 -25
- package/www/codemirror/theme/colorforth.css +0 -33
- package/www/codemirror/theme/darcula.css +0 -53
- package/www/codemirror/theme/dracula.css +0 -40
- package/www/codemirror/theme/duotone-dark.css +0 -35
- package/www/codemirror/theme/duotone-light.css +0 -36
- package/www/codemirror/theme/eclipse.css +0 -23
- package/www/codemirror/theme/elegant.css +0 -13
- package/www/codemirror/theme/erlang-dark.css +0 -34
- package/www/codemirror/theme/gruvbox-dark.css +0 -39
- package/www/codemirror/theme/hopscotch.css +0 -34
- package/www/codemirror/theme/icecoder.css +0 -43
- package/www/codemirror/theme/idea.css +0 -42
- package/www/codemirror/theme/isotope.css +0 -34
- package/www/codemirror/theme/juejin.css +0 -30
- package/www/codemirror/theme/lesser-dark.css +0 -47
- package/www/codemirror/theme/liquibyte.css +0 -95
- package/www/codemirror/theme/lucario.css +0 -37
- package/www/codemirror/theme/material-darker.css +0 -135
- package/www/codemirror/theme/material-palenight.css +0 -141
- package/www/codemirror/theme/material.css +0 -141
- package/www/codemirror/theme/mbo.css +0 -37
- package/www/codemirror/theme/mdn-like.css +0 -46
- package/www/codemirror/theme/midnight.css +0 -39
- package/www/codemirror/theme/monokai.css +0 -41
- package/www/codemirror/theme/moxer.css +0 -143
- package/www/codemirror/theme/neat.css +0 -12
- package/www/codemirror/theme/neo.css +0 -43
- package/www/codemirror/theme/night.css +0 -27
- package/www/codemirror/theme/nord.css +0 -42
- package/www/codemirror/theme/oceanic-next.css +0 -46
- package/www/codemirror/theme/panda-syntax.css +0 -85
- package/www/codemirror/theme/paraiso-dark.css +0 -38
- package/www/codemirror/theme/paraiso-light.css +0 -38
- package/www/codemirror/theme/pastel-on-dark.css +0 -52
- package/www/codemirror/theme/railscasts.css +0 -34
- package/www/codemirror/theme/rubyblue.css +0 -25
- package/www/codemirror/theme/seti.css +0 -44
- package/www/codemirror/theme/shadowfox.css +0 -52
- package/www/codemirror/theme/solarized.css +0 -165
- package/www/codemirror/theme/ssms.css +0 -16
- package/www/codemirror/theme/the-matrix.css +0 -30
- package/www/codemirror/theme/tomorrow-night-bright.css +0 -35
- package/www/codemirror/theme/tomorrow-night-eighties.css +0 -38
- package/www/codemirror/theme/ttcn.css +0 -64
- package/www/codemirror/theme/twilight.css +0 -32
- package/www/codemirror/theme/vibrant-ink.css +0 -34
- package/www/codemirror/theme/xq-dark.css +0 -53
- package/www/codemirror/theme/xq-light.css +0 -43
- package/www/codemirror/theme/yeti.css +0 -44
- package/www/codemirror/theme/yonce.css +0 -59
- package/www/codemirror/theme/zenburn.css +0 -37
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
2
|
-
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
|
3
|
-
|
|
4
|
-
// declare global: DOMRect
|
|
5
|
-
|
|
6
|
-
(function(mod) {
|
|
7
|
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
8
|
-
mod(require("../../lib/codemirror"));
|
|
9
|
-
else if (typeof define == "function" && define.amd) // AMD
|
|
10
|
-
define(["../../lib/codemirror"], mod);
|
|
11
|
-
else // Plain browser env
|
|
12
|
-
mod(CodeMirror);
|
|
13
|
-
})(function(CodeMirror) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
|
|
17
|
-
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
|
|
18
|
-
|
|
19
|
-
// This is the old interface, kept around for now to stay
|
|
20
|
-
// backwards-compatible.
|
|
21
|
-
CodeMirror.showHint = function(cm, getHints, options) {
|
|
22
|
-
if (!getHints) return cm.showHint(options);
|
|
23
|
-
if (options && options.async) getHints.async = true;
|
|
24
|
-
var newOpts = {hint: getHints};
|
|
25
|
-
if (options) for (var prop in options) newOpts[prop] = options[prop];
|
|
26
|
-
return cm.showHint(newOpts);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
CodeMirror.defineExtension("showHint", function(options) {
|
|
30
|
-
options = parseOptions(this, this.getCursor("start"), options);
|
|
31
|
-
var selections = this.listSelections()
|
|
32
|
-
if (selections.length > 1) return;
|
|
33
|
-
// By default, don't allow completion when something is selected.
|
|
34
|
-
// A hint function can have a `supportsSelection` property to
|
|
35
|
-
// indicate that it can handle selections.
|
|
36
|
-
if (this.somethingSelected()) {
|
|
37
|
-
if (!options.hint.supportsSelection) return;
|
|
38
|
-
// Don't try with cross-line selections
|
|
39
|
-
for (var i = 0; i < selections.length; i++)
|
|
40
|
-
if (selections[i].head.line != selections[i].anchor.line) return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (this.state.completionActive) this.state.completionActive.close();
|
|
44
|
-
var completion = this.state.completionActive = new Completion(this, options);
|
|
45
|
-
if (!completion.options.hint) return;
|
|
46
|
-
|
|
47
|
-
CodeMirror.signal(this, "startCompletion", this);
|
|
48
|
-
completion.update(true);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
CodeMirror.defineExtension("closeHint", function() {
|
|
52
|
-
if (this.state.completionActive) this.state.completionActive.close()
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
function Completion(cm, options) {
|
|
56
|
-
this.cm = cm;
|
|
57
|
-
this.options = options;
|
|
58
|
-
this.widget = null;
|
|
59
|
-
this.debounce = 0;
|
|
60
|
-
this.tick = 0;
|
|
61
|
-
this.startPos = this.cm.getCursor("start");
|
|
62
|
-
this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
|
|
63
|
-
|
|
64
|
-
if (this.options.updateOnCursorActivity) {
|
|
65
|
-
var self = this;
|
|
66
|
-
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
|
|
71
|
-
return setTimeout(fn, 1000/60);
|
|
72
|
-
};
|
|
73
|
-
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
|
|
74
|
-
|
|
75
|
-
Completion.prototype = {
|
|
76
|
-
close: function() {
|
|
77
|
-
if (!this.active()) return;
|
|
78
|
-
this.cm.state.completionActive = null;
|
|
79
|
-
this.tick = null;
|
|
80
|
-
if (this.options.updateOnCursorActivity) {
|
|
81
|
-
this.cm.off("cursorActivity", this.activityFunc);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (this.widget && this.data) CodeMirror.signal(this.data, "close");
|
|
85
|
-
if (this.widget) this.widget.close();
|
|
86
|
-
CodeMirror.signal(this.cm, "endCompletion", this.cm);
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
active: function() {
|
|
90
|
-
return this.cm.state.completionActive == this;
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
pick: function(data, i) {
|
|
94
|
-
var completion = data.list[i], self = this;
|
|
95
|
-
this.cm.operation(function() {
|
|
96
|
-
if (completion.hint)
|
|
97
|
-
completion.hint(self.cm, data, completion);
|
|
98
|
-
else
|
|
99
|
-
self.cm.replaceRange(getText(completion), completion.from || data.from,
|
|
100
|
-
completion.to || data.to, "complete");
|
|
101
|
-
CodeMirror.signal(data, "pick", completion);
|
|
102
|
-
self.cm.scrollIntoView();
|
|
103
|
-
});
|
|
104
|
-
if (this.options.closeOnPick) {
|
|
105
|
-
this.close();
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
cursorActivity: function() {
|
|
110
|
-
if (this.debounce) {
|
|
111
|
-
cancelAnimationFrame(this.debounce);
|
|
112
|
-
this.debounce = 0;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var identStart = this.startPos;
|
|
116
|
-
if(this.data) {
|
|
117
|
-
identStart = this.data.from;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
|
|
121
|
-
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
|
|
122
|
-
pos.ch < identStart.ch || this.cm.somethingSelected() ||
|
|
123
|
-
(!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
|
|
124
|
-
this.close();
|
|
125
|
-
} else {
|
|
126
|
-
var self = this;
|
|
127
|
-
this.debounce = requestAnimationFrame(function() {self.update();});
|
|
128
|
-
if (this.widget) this.widget.disable();
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
update: function(first) {
|
|
133
|
-
if (this.tick == null) return
|
|
134
|
-
var self = this, myTick = ++this.tick
|
|
135
|
-
fetchHints(this.options.hint, this.cm, this.options, function(data) {
|
|
136
|
-
if (self.tick == myTick) self.finishUpdate(data, first)
|
|
137
|
-
})
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
finishUpdate: function(data, first) {
|
|
141
|
-
if (this.data) CodeMirror.signal(this.data, "update");
|
|
142
|
-
|
|
143
|
-
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
|
|
144
|
-
if (this.widget) this.widget.close();
|
|
145
|
-
|
|
146
|
-
this.data = data;
|
|
147
|
-
|
|
148
|
-
if (data && data.list.length) {
|
|
149
|
-
if (picked && data.list.length == 1) {
|
|
150
|
-
this.pick(data, 0);
|
|
151
|
-
} else {
|
|
152
|
-
this.widget = new Widget(this, data);
|
|
153
|
-
CodeMirror.signal(data, "shown");
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
function parseOptions(cm, pos, options) {
|
|
160
|
-
var editor = cm.options.hintOptions;
|
|
161
|
-
var out = {};
|
|
162
|
-
for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
|
|
163
|
-
if (editor) for (var prop in editor)
|
|
164
|
-
if (editor[prop] !== undefined) out[prop] = editor[prop];
|
|
165
|
-
if (options) for (var prop in options)
|
|
166
|
-
if (options[prop] !== undefined) out[prop] = options[prop];
|
|
167
|
-
if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
|
|
168
|
-
return out;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function getText(completion) {
|
|
172
|
-
if (typeof completion == "string") return completion;
|
|
173
|
-
else return completion.text;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function buildKeyMap(completion, handle) {
|
|
177
|
-
var baseMap = {
|
|
178
|
-
Up: function() {handle.moveFocus(-1);},
|
|
179
|
-
Down: function() {handle.moveFocus(1);},
|
|
180
|
-
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
|
|
181
|
-
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
|
|
182
|
-
Home: function() {handle.setFocus(0);},
|
|
183
|
-
End: function() {handle.setFocus(handle.length - 1);},
|
|
184
|
-
Enter: handle.pick,
|
|
185
|
-
Tab: handle.pick,
|
|
186
|
-
Esc: handle.close
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
var mac = /Mac/.test(navigator.platform);
|
|
190
|
-
|
|
191
|
-
if (mac) {
|
|
192
|
-
baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);};
|
|
193
|
-
baseMap["Ctrl-N"] = function() {handle.moveFocus(1);};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var custom = completion.options.customKeys;
|
|
197
|
-
var ourMap = custom ? {} : baseMap;
|
|
198
|
-
function addBinding(key, val) {
|
|
199
|
-
var bound;
|
|
200
|
-
if (typeof val != "string")
|
|
201
|
-
bound = function(cm) { return val(cm, handle); };
|
|
202
|
-
// This mechanism is deprecated
|
|
203
|
-
else if (baseMap.hasOwnProperty(val))
|
|
204
|
-
bound = baseMap[val];
|
|
205
|
-
else
|
|
206
|
-
bound = val;
|
|
207
|
-
ourMap[key] = bound;
|
|
208
|
-
}
|
|
209
|
-
if (custom)
|
|
210
|
-
for (var key in custom) if (custom.hasOwnProperty(key))
|
|
211
|
-
addBinding(key, custom[key]);
|
|
212
|
-
var extra = completion.options.extraKeys;
|
|
213
|
-
if (extra)
|
|
214
|
-
for (var key in extra) if (extra.hasOwnProperty(key))
|
|
215
|
-
addBinding(key, extra[key]);
|
|
216
|
-
return ourMap;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function getHintElement(hintsElement, el) {
|
|
220
|
-
while (el && el != hintsElement) {
|
|
221
|
-
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
|
|
222
|
-
el = el.parentNode;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function Widget(completion, data) {
|
|
227
|
-
this.id = "cm-complete-" + Math.floor(Math.random(1e6))
|
|
228
|
-
this.completion = completion;
|
|
229
|
-
this.data = data;
|
|
230
|
-
this.picked = false;
|
|
231
|
-
var widget = this, cm = completion.cm;
|
|
232
|
-
var ownerDocument = cm.getInputField().ownerDocument;
|
|
233
|
-
var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow;
|
|
234
|
-
|
|
235
|
-
var hints = this.hints = ownerDocument.createElement("ul");
|
|
236
|
-
hints.setAttribute("role", "listbox")
|
|
237
|
-
hints.setAttribute("aria-expanded", "true")
|
|
238
|
-
hints.id = this.id
|
|
239
|
-
var theme = completion.cm.options.theme;
|
|
240
|
-
hints.className = "CodeMirror-hints " + theme;
|
|
241
|
-
this.selectedHint = data.selectedHint || 0;
|
|
242
|
-
|
|
243
|
-
var completions = data.list;
|
|
244
|
-
for (var i = 0; i < completions.length; ++i) {
|
|
245
|
-
var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i];
|
|
246
|
-
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
|
|
247
|
-
if (cur.className != null) className = cur.className + " " + className;
|
|
248
|
-
elt.className = className;
|
|
249
|
-
if (i == this.selectedHint) elt.setAttribute("aria-selected", "true")
|
|
250
|
-
elt.id = this.id + "-" + i
|
|
251
|
-
elt.setAttribute("role", "option")
|
|
252
|
-
if (cur.render) cur.render(elt, data, cur);
|
|
253
|
-
else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur)));
|
|
254
|
-
elt.hintId = i;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
var container = completion.options.container || ownerDocument.body;
|
|
258
|
-
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
|
|
259
|
-
var left = pos.left, top = pos.bottom, below = true;
|
|
260
|
-
var offsetLeft = 0, offsetTop = 0;
|
|
261
|
-
if (container !== ownerDocument.body) {
|
|
262
|
-
// We offset the cursor position because left and top are relative to the offsetParent's top left corner.
|
|
263
|
-
var isContainerPositioned = ['absolute', 'relative', 'fixed'].indexOf(parentWindow.getComputedStyle(container).position) !== -1;
|
|
264
|
-
var offsetParent = isContainerPositioned ? container : container.offsetParent;
|
|
265
|
-
var offsetParentPosition = offsetParent.getBoundingClientRect();
|
|
266
|
-
var bodyPosition = ownerDocument.body.getBoundingClientRect();
|
|
267
|
-
offsetLeft = (offsetParentPosition.left - bodyPosition.left - offsetParent.scrollLeft);
|
|
268
|
-
offsetTop = (offsetParentPosition.top - bodyPosition.top - offsetParent.scrollTop);
|
|
269
|
-
}
|
|
270
|
-
hints.style.left = (left - offsetLeft) + "px";
|
|
271
|
-
hints.style.top = (top - offsetTop) + "px";
|
|
272
|
-
|
|
273
|
-
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
|
274
|
-
var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
|
|
275
|
-
var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
|
|
276
|
-
container.appendChild(hints);
|
|
277
|
-
cm.getInputField().setAttribute("aria-autocomplete", "list")
|
|
278
|
-
cm.getInputField().setAttribute("aria-owns", this.id)
|
|
279
|
-
cm.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint)
|
|
280
|
-
|
|
281
|
-
var box = completion.options.moveOnOverlap ? hints.getBoundingClientRect() : new DOMRect();
|
|
282
|
-
var scrolls = completion.options.paddingForScrollbar ? hints.scrollHeight > hints.clientHeight + 1 : false;
|
|
283
|
-
|
|
284
|
-
// Compute in the timeout to avoid reflow on init
|
|
285
|
-
var startScroll;
|
|
286
|
-
setTimeout(function() { startScroll = cm.getScrollInfo(); });
|
|
287
|
-
|
|
288
|
-
var overlapY = box.bottom - winH;
|
|
289
|
-
if (overlapY > 0) { // Does not fit below
|
|
290
|
-
var height = box.bottom - box.top, spaceAbove = box.top - (pos.bottom - pos.top) - 2
|
|
291
|
-
if (winH - box.top < spaceAbove) { // More room at the top
|
|
292
|
-
if (height > spaceAbove) hints.style.height = (height = spaceAbove) + "px";
|
|
293
|
-
hints.style.top = ((top = pos.top - height) + offsetTop) + "px";
|
|
294
|
-
below = false;
|
|
295
|
-
} else {
|
|
296
|
-
hints.style.height = (winH - box.top - 2) + "px";
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
var overlapX = box.right - winW;
|
|
300
|
-
if (scrolls) overlapX += cm.display.nativeBarWidth;
|
|
301
|
-
if (overlapX > 0) {
|
|
302
|
-
if (box.right - box.left > winW) {
|
|
303
|
-
hints.style.width = (winW - 5) + "px";
|
|
304
|
-
overlapX -= (box.right - box.left) - winW;
|
|
305
|
-
}
|
|
306
|
-
hints.style.left = (left = Math.max(pos.left - overlapX - offsetLeft, 0)) + "px";
|
|
307
|
-
}
|
|
308
|
-
if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
|
|
309
|
-
node.style.paddingRight = cm.display.nativeBarWidth + "px"
|
|
310
|
-
|
|
311
|
-
cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
|
|
312
|
-
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
|
|
313
|
-
setFocus: function(n) { widget.changeActive(n); },
|
|
314
|
-
menuSize: function() { return widget.screenAmount(); },
|
|
315
|
-
length: completions.length,
|
|
316
|
-
close: function() { completion.close(); },
|
|
317
|
-
pick: function() { widget.pick(); },
|
|
318
|
-
data: data
|
|
319
|
-
}));
|
|
320
|
-
|
|
321
|
-
if (completion.options.closeOnUnfocus) {
|
|
322
|
-
var closingOnBlur;
|
|
323
|
-
cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
|
|
324
|
-
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
cm.on("scroll", this.onScroll = function() {
|
|
328
|
-
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
|
|
329
|
-
if (!startScroll) startScroll = cm.getScrollInfo();
|
|
330
|
-
var newTop = top + startScroll.top - curScroll.top;
|
|
331
|
-
var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop);
|
|
332
|
-
if (!below) point += hints.offsetHeight;
|
|
333
|
-
if (point <= editor.top || point >= editor.bottom) return completion.close();
|
|
334
|
-
hints.style.top = newTop + "px";
|
|
335
|
-
hints.style.left = (left + startScroll.left - curScroll.left) + "px";
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
CodeMirror.on(hints, "dblclick", function(e) {
|
|
339
|
-
var t = getHintElement(hints, e.target || e.srcElement);
|
|
340
|
-
if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
CodeMirror.on(hints, "click", function(e) {
|
|
344
|
-
var t = getHintElement(hints, e.target || e.srcElement);
|
|
345
|
-
if (t && t.hintId != null) {
|
|
346
|
-
widget.changeActive(t.hintId);
|
|
347
|
-
if (completion.options.completeOnSingleClick) widget.pick();
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
CodeMirror.on(hints, "mousedown", function() {
|
|
352
|
-
setTimeout(function(){cm.focus();}, 20);
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
// The first hint doesn't need to be scrolled to on init
|
|
356
|
-
var selectedHintRange = this.getSelectedHintRange();
|
|
357
|
-
if (selectedHintRange.from !== 0 || selectedHintRange.to !== 0) {
|
|
358
|
-
this.scrollToActive();
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
Widget.prototype = {
|
|
366
|
-
close: function() {
|
|
367
|
-
if (this.completion.widget != this) return;
|
|
368
|
-
this.completion.widget = null;
|
|
369
|
-
if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints);
|
|
370
|
-
this.completion.cm.removeKeyMap(this.keyMap);
|
|
371
|
-
var input = this.completion.cm.getInputField()
|
|
372
|
-
input.removeAttribute("aria-activedescendant")
|
|
373
|
-
input.removeAttribute("aria-owns")
|
|
374
|
-
|
|
375
|
-
var cm = this.completion.cm;
|
|
376
|
-
if (this.completion.options.closeOnUnfocus) {
|
|
377
|
-
cm.off("blur", this.onBlur);
|
|
378
|
-
cm.off("focus", this.onFocus);
|
|
379
|
-
}
|
|
380
|
-
cm.off("scroll", this.onScroll);
|
|
381
|
-
},
|
|
382
|
-
|
|
383
|
-
disable: function() {
|
|
384
|
-
this.completion.cm.removeKeyMap(this.keyMap);
|
|
385
|
-
var widget = this;
|
|
386
|
-
this.keyMap = {Enter: function() { widget.picked = true; }};
|
|
387
|
-
this.completion.cm.addKeyMap(this.keyMap);
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
pick: function() {
|
|
391
|
-
this.completion.pick(this.data, this.selectedHint);
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
changeActive: function(i, avoidWrap) {
|
|
395
|
-
if (i >= this.data.list.length)
|
|
396
|
-
i = avoidWrap ? this.data.list.length - 1 : 0;
|
|
397
|
-
else if (i < 0)
|
|
398
|
-
i = avoidWrap ? 0 : this.data.list.length - 1;
|
|
399
|
-
if (this.selectedHint == i) return;
|
|
400
|
-
var node = this.hints.childNodes[this.selectedHint];
|
|
401
|
-
if (node) {
|
|
402
|
-
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
|
|
403
|
-
node.removeAttribute("aria-selected")
|
|
404
|
-
}
|
|
405
|
-
node = this.hints.childNodes[this.selectedHint = i];
|
|
406
|
-
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
|
|
407
|
-
node.setAttribute("aria-selected", "true")
|
|
408
|
-
this.completion.cm.getInputField().setAttribute("aria-activedescendant", node.id)
|
|
409
|
-
this.scrollToActive()
|
|
410
|
-
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
|
|
411
|
-
},
|
|
412
|
-
|
|
413
|
-
scrollToActive: function() {
|
|
414
|
-
var selectedHintRange = this.getSelectedHintRange();
|
|
415
|
-
var node1 = this.hints.childNodes[selectedHintRange.from];
|
|
416
|
-
var node2 = this.hints.childNodes[selectedHintRange.to];
|
|
417
|
-
var firstNode = this.hints.firstChild;
|
|
418
|
-
if (node1.offsetTop < this.hints.scrollTop)
|
|
419
|
-
this.hints.scrollTop = node1.offsetTop - firstNode.offsetTop;
|
|
420
|
-
else if (node2.offsetTop + node2.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
|
|
421
|
-
this.hints.scrollTop = node2.offsetTop + node2.offsetHeight - this.hints.clientHeight + firstNode.offsetTop;
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
screenAmount: function() {
|
|
425
|
-
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
|
|
426
|
-
},
|
|
427
|
-
|
|
428
|
-
getSelectedHintRange: function() {
|
|
429
|
-
var margin = this.completion.options.scrollMargin || 0;
|
|
430
|
-
return {
|
|
431
|
-
from: Math.max(0, this.selectedHint - margin),
|
|
432
|
-
to: Math.min(this.data.list.length - 1, this.selectedHint + margin),
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
function applicableHelpers(cm, helpers) {
|
|
438
|
-
if (!cm.somethingSelected()) return helpers
|
|
439
|
-
var result = []
|
|
440
|
-
for (var i = 0; i < helpers.length; i++)
|
|
441
|
-
if (helpers[i].supportsSelection) result.push(helpers[i])
|
|
442
|
-
return result
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function fetchHints(hint, cm, options, callback) {
|
|
446
|
-
if (hint.async) {
|
|
447
|
-
hint(cm, callback, options)
|
|
448
|
-
} else {
|
|
449
|
-
var result = hint(cm, options)
|
|
450
|
-
if (result && result.then) result.then(callback)
|
|
451
|
-
else callback(result)
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function resolveAutoHints(cm, pos) {
|
|
456
|
-
var helpers = cm.getHelpers(pos, "hint"), words
|
|
457
|
-
if (helpers.length) {
|
|
458
|
-
var resolved = function(cm, callback, options) {
|
|
459
|
-
var app = applicableHelpers(cm, helpers);
|
|
460
|
-
function run(i) {
|
|
461
|
-
if (i == app.length) return callback(null)
|
|
462
|
-
fetchHints(app[i], cm, options, function(result) {
|
|
463
|
-
if (result && result.list.length > 0) callback(result)
|
|
464
|
-
else run(i + 1)
|
|
465
|
-
})
|
|
466
|
-
}
|
|
467
|
-
run(0)
|
|
468
|
-
}
|
|
469
|
-
resolved.async = true
|
|
470
|
-
resolved.supportsSelection = true
|
|
471
|
-
return resolved
|
|
472
|
-
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
|
|
473
|
-
return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
|
|
474
|
-
} else if (CodeMirror.hint.anyword) {
|
|
475
|
-
return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
|
|
476
|
-
} else {
|
|
477
|
-
return function() {}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
CodeMirror.registerHelper("hint", "auto", {
|
|
482
|
-
resolve: resolveAutoHints
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
|
|
486
|
-
var cur = cm.getCursor(), token = cm.getTokenAt(cur)
|
|
487
|
-
var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
|
|
488
|
-
if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
|
|
489
|
-
term = token.string.substr(0, cur.ch - token.start)
|
|
490
|
-
} else {
|
|
491
|
-
term = ""
|
|
492
|
-
from = cur
|
|
493
|
-
}
|
|
494
|
-
var found = [];
|
|
495
|
-
for (var i = 0; i < options.words.length; i++) {
|
|
496
|
-
var word = options.words[i];
|
|
497
|
-
if (word.slice(0, term.length) == term)
|
|
498
|
-
found.push(word);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
if (found.length) return {list: found, from: from, to: to};
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
CodeMirror.commands.autocomplete = CodeMirror.showHint;
|
|
505
|
-
|
|
506
|
-
var defaultOptions = {
|
|
507
|
-
hint: CodeMirror.hint.auto,
|
|
508
|
-
completeSingle: true,
|
|
509
|
-
alignWithWord: true,
|
|
510
|
-
closeCharacters: /[\s()\[\]{};:>,]/,
|
|
511
|
-
closeOnPick: true,
|
|
512
|
-
closeOnUnfocus: true,
|
|
513
|
-
updateOnCursorActivity: true,
|
|
514
|
-
completeOnSingleClick: true,
|
|
515
|
-
container: null,
|
|
516
|
-
customKeys: null,
|
|
517
|
-
extraKeys: null,
|
|
518
|
-
paddingForScrollbar: true,
|
|
519
|
-
moveOnOverlap: true,
|
|
520
|
-
};
|
|
521
|
-
|
|
522
|
-
CodeMirror.defineOption("hintOptions", null);
|
|
523
|
-
});
|