Skip to content
Snippets Groups Projects
Commit 6ce61821 authored by Franco Pariani's avatar Franco Pariani
Browse files

Showing hints and default words with ctrl+space

parent ec3e7dd9
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,30 @@ ...@@ -25,6 +25,30 @@
var specialRE = /[(),;[\]`{}]/; var specialRE = /[(),;[\]`{}]/;
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
var defualt_words = [];
var anyWord = CodeMirror.hint.anyword;
CodeMirror.hint.anyword = function(cm) {
var cur = cm.getCursor(), token = cm.getTokenAt(cur)
var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
term = token.string.substr(0, cur.ch - token.start)
} else {
term = ""
from = cur
}
var inner = anyWord(cm) || {from: from, to: to, list: []};
var filtered_words = defualt_words.filter(w => w.indexOf(term) === 0);
for(var i= 0; i < filtered_words.length; i++){
if (inner.list.indexOf(filtered_words[i]) === -1)
inner.list.push(filtered_words[i]);
}
return inner;
};
function normal(source, setState) { function normal(source, setState) {
if (source.eatWhile(whiteCharRE)) { if (source.eatWhile(whiteCharRE)) {
return null; return null;
...@@ -255,4 +279,4 @@ ...@@ -255,4 +279,4 @@
CodeMirror.defineMIME("text/x-matefun", "matefun-EN"); CodeMirror.defineMIME("text/x-matefun", "matefun-EN");
}); });
\ No newline at end of file
...@@ -88,7 +88,10 @@ export class MateFunComponent { ...@@ -88,7 +88,10 @@ export class MateFunComponent {
}, },
gutters: ["CodeMirror-linenumbers", "breakpoints"], gutters: ["CodeMirror-linenumbers", "breakpoints"],
theme: 'dracula', theme: 'dracula',
fontSize: 12 fontSize: 12,
hintOptions: {
completeSingle: false
}
}; };
themes = ['3024-day', '3024-night', 'abcdef', 'ambiance-mobile', 'ambiance', 'base16-dark', 'base16-light', 'bespin', 'blackboard', 'cobalt', 'colorforth', 'dracula', 'duotone-dark', 'duotone-light', 'eclipse', 'elegant', 'erlang-dark', 'hopscotch', 'icecoder', 'isotope', 'lesser-dark', 'liquibyte', 'material', 'mbo', 'mdn-like', 'midnight', 'monokai', 'neat', 'neo', 'night', 'panda-syntax', 'paraiso-dark', 'paraiso-light', 'pastel-on-dark', 'railscasts', 'rubyblue', 'seti', 'solarized', 'the-matrix', 'tomorrow-night-bright', 'tomorrow-night-eighties', 'ttcn', 'twilight', 'vibrant-ink', 'xq-dark', 'xq-light', 'yeti', 'zenburn'] themes = ['3024-day', '3024-night', 'abcdef', 'ambiance-mobile', 'ambiance', 'base16-dark', 'base16-light', 'bespin', 'blackboard', 'cobalt', 'colorforth', 'dracula', 'duotone-dark', 'duotone-light', 'eclipse', 'elegant', 'erlang-dark', 'hopscotch', 'icecoder', 'isotope', 'lesser-dark', 'liquibyte', 'material', 'mbo', 'mdn-like', 'midnight', 'monokai', 'neat', 'neo', 'night', 'panda-syntax', 'paraiso-dark', 'paraiso-light', 'pastel-on-dark', 'railscasts', 'rubyblue', 'seti', 'solarized', 'the-matrix', 'tomorrow-night-bright', 'tomorrow-night-eighties', 'ttcn', 'twilight', 'vibrant-ink', 'xq-dark', 'xq-light', 'yeti', 'zenburn']
version: string = npm.version; version: string = npm.version;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment