Commit 05178ff5 authored by ThorbenQuast's avatar ThorbenQuast
Browse files

[editor] introduce autoCompletion preference

parent 96ce4865
......@@ -58,11 +58,8 @@ define(["jquery", "emitter", "./action", "require"], function($, Emitter, CodeEd
});
self.ace = ace.edit($(self.node).get(0));
self.ace.setOptions({
enableBasicAutocompletion: true,
enableLiveAutocompletion: true,
enableSnippets: true,
});
self.setAutoCompletion();
self.ace.selection.on('changeCursor', function() {
var line = self.ace.selection.getCursor().row + 1;
......@@ -304,6 +301,18 @@ define(["jquery", "emitter", "./action", "require"], function($, Emitter, CodeEd
return this;
},
setAutoCompletion: function() {
if (!this.ace)
return;
var self = this;
var enable = self.view.getPreference("autoCompletion");
this.ace.setOptions({
enableBasicAutocompletion: enable,
enableLiveAutocompletion: enable,
enableSnippets: enable
});
},
setTheme: function(theme) {
if (this.ace) {
theme = theme == null ? this.view.getPreference("theme") : theme;
......
......@@ -33,7 +33,7 @@ define(["vispa/extensions", "./view", "./prefs", "css!../css/styles"],
// register to listen to certain file extensions
this.fileExtensions = ["bsc", "c", "cc", "conf", "cpp", "csh", "css", "cxx", "diff", "f", "f70",
"f90", "f95", "f03", "h", "hh", "hxx", "hpp", "html", "ini", "java", "js", "less", "log", "json",
"m", "md", "orig", "php", "py", "r", "rb", "sh", "tex", "txt", "xml", "yml", "yaml", "zsh"
"m", "md", "orig", "php", "py", "r", "rb", "sh", "tex", "txt", "yml", "yaml", "zsh"
];
var openFunction = function(workspaceId, path) {
......
......@@ -64,6 +64,13 @@ define(function() {
range: [0, 300, 10]
},
//autosave
autoCompletion: {
description: "Enable ace's autocompletion?",
type: "boolean",
value: true
},
// output
autoClear: {
description: "Clear the output between jobs?",
......
......@@ -122,6 +122,8 @@ define([
this.editor.setRuler();
// autosave
this.editor.actions.setupAutoSave();
//autoCompletion
this.editor.setAutoCompletion();
//previewSize
this.preview.externalRefresh();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment