Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
585a1775
Commit
585a1775
authored
Nov 22, 2015
by
ThorbenQuast
Browse files
[editor] schedule the autocompletion (i.e. add 500ms delay and require >= 2 letters)
parent
a2ae7e20
Changes
3
Hide whitespace changes
Inline
Side-by-side
vispa/extensions/codeeditor/static/js/editor.js
View file @
585a1775
...
...
@@ -310,7 +310,7 @@ define(["jquery", "emitter", "./action", "require", "ace/ace", "ace/ext-language
enableLiveAutocompletion
:
enable
,
enableSnippets
:
enable
,
liveAutocompletionDelay
:
500
,
liveAutocompletionThreshold
:
3
liveAutocompletionThreshold
:
2
});
},
...
...
vispa/static/vendor/ace/ext-language_tools.js
View file @
585a1775
...
...
@@ -1866,7 +1866,7 @@ function getCompletionPrefix(editor) {
}
});
return
prefix
||
util
.
retrievePrecedingIdentifier
(
line
,
pos
.
column
);
}
}
;
var
doLiveAutocomplete
=
function
(
e
)
{
var
editor
=
e
.
editor
;
...
...
@@ -1877,7 +1877,8 @@ var doLiveAutocomplete = function(e) {
}
else
if
(
e
.
command
.
name
===
"
insertstring
"
)
{
var
prefix
=
getCompletionPrefix
(
editor
);
if
(
prefix
&&
!
hasCompleter
)
{
//if (prefix && !hasCompleter) {
if
(
prefix
&&
prefix
.
length
>=
editor
.
$liveAutocompletionThreshold
&&
!
hasCompleter
)
{
//CHECK ME
if
(
!
editor
.
completer
)
{
editor
.
completer
=
new
Autocomplete
();
}
...
...
@@ -1887,6 +1888,15 @@ var doLiveAutocomplete = function(e) {
}
};
//check me from here
var
lastExec_e
;
var
liveAutocompleteTimer
=
lang
.
delayedCall
(
function
()
{
doLiveAutocomplete
(
lastExec_e
);
},
0
);
var
scheduleAutocomplete
=
function
(
e
)
{
lastExec_e
=
e
;
liveAutocompleteTimer
.
delay
(
e
.
editor
.
$liveAutocompletionDelay
);
};
//until here
var
Editor
=
require
(
"
../editor
"
).
Editor
;
require
(
"
../config
"
).
defineOptions
(
Editor
.
prototype
,
"
editor
"
,
{
enableBasicAutocompletion
:
{
...
...
@@ -1906,13 +1916,24 @@ require("../config").defineOptions(Editor.prototype, "editor", {
if
(
val
)
{
if
(
!
this
.
completers
)
this
.
completers
=
Array
.
isArray
(
val
)?
val
:
completers
;
this
.
commands
.
on
(
'
afterExec
'
,
doLiveAutocomplete
);
//this.commands.on('afterExec', doLiveAutocomplete);
this
.
commands
.
on
(
'
afterExec
'
,
scheduleAutocomplete
);
//CHECK ME
}
else
{
this
.
commands
.
removeListener
(
'
afterExec
'
,
doLiveAutocomplete
);
//this.commands.removeListener('afterExec', doLiveAutocomplete);
this
.
commands
.
removeListener
(
'
afterExec
'
,
scheduleAutocomplete
);
//CHECK ME
}
},
value
:
false
},
//Check me from here
// (default values)
liveAutocompletionDelay
:
{
value
:
100
},
liveAutocompletionThreshold
:
{
value
:
0
},
//to here!
enableSnippets
:
{
set
:
function
(
val
)
{
if
(
val
)
{
...
...
vispa/static/vendor/ace/ext-modelist.js
View file @
585a1775
...
...
@@ -40,7 +40,8 @@ var supportedModes = {
ADA
:
[
"
ada|adb
"
],
Apache_Conf
:
[
"
^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd
"
],
AsciiDoc
:
[
"
asciidoc|adoc
"
],
Assembly_x86
:[
"
asm
"
],
//Assembly_x86:["asm"],
Assembly_x86
:[
"
asm|s
"
],
//CHECK ME
AutoHotKey
:
[
"
ahk
"
],
BatchFile
:
[
"
bat|cmd
"
],
C_Cpp
:
[
"
cpp|c|cc|cxx|h|hh|hpp
"
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment