use data.snippet in completions for snippet insertion
This commit is contained in:
parent
d276f10bcd
commit
7ce86e24f1
2 changed files with 6 additions and 5 deletions
|
|
@ -137,14 +137,15 @@ var Autocomplete = function() {
|
||||||
if (data.completer && data.completer.insertMatch) {
|
if (data.completer && data.completer.insertMatch) {
|
||||||
data.completer.insertMatch(this.editor);
|
data.completer.insertMatch(this.editor);
|
||||||
} else {
|
} else {
|
||||||
if (data.value)
|
|
||||||
data = data.value;
|
|
||||||
if (this.completions.filterText) {
|
if (this.completions.filterText) {
|
||||||
var range = this.editor.selection.getRange();
|
var range = this.editor.selection.getRange();
|
||||||
range.start.column -= this.completions.filterText.length;
|
range.start.column -= this.completions.filterText.length;
|
||||||
this.editor.session.remove(range);
|
this.editor.session.remove(range);
|
||||||
}
|
}
|
||||||
snippetManager.insertSnippet(this.editor, data);
|
if (data.snippet)
|
||||||
|
snippetManager.insertSnippet(this.editor, data.snippet);
|
||||||
|
else
|
||||||
|
this.editor.insert(data.value || data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ var snippetCompleter = {
|
||||||
if (s.tabTrigger && s.tabTrigger.indexOf(prefix) === 0)
|
if (s.tabTrigger && s.tabTrigger.indexOf(prefix) === 0)
|
||||||
completions.push({
|
completions.push({
|
||||||
caption: s.tabTrigger,
|
caption: s.tabTrigger,
|
||||||
value: s.content,
|
snippet: s.content,
|
||||||
meta: 'snippet'
|
meta: "snippet"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue