removing @ autocomplete, leaving quotes alone
authorNicholas Bollweg <nicholas.bollweg@gtri.gatech.edu>
Fri, 01 Nov 2013 11:04:25 -0400
changeset 2081 4f507e2f7d28
parent 2080 16f3b91fc4e3
child 2082 d8ce908a3350
removing @ autocomplete, leaving quotes alone
playground/jsonld-hint.js
playground/playground.js
--- a/playground/jsonld-hint.js	Wed Oct 23 16:05:21 2013 -0400
+++ b/playground/jsonld-hint.js	Fri Nov 01 11:04:25 2013 -0400
@@ -31,7 +31,7 @@
   function keywordsLike(str){
     str = str ? String(str).trim() : "";
     var result = accum(ldKeywords, function(_, kw, i){
-      !str || ~kw.indexOf(str) ? _('"@' + kw + '"') : null;
+      !str || ~kw.indexOf(str) ? _('@' + kw) : null;
     });
     
     if(str){ result.sort(relevanceComparator(str)); }
@@ -47,7 +47,7 @@
     if(doc && (ctx = doc["@context"])){
       for(key in ctx){
         if(!ctx.hasOwnProperty(key)){ return; }
-        !str || ~key.indexOf(str) ? result.push("\"" + key + "\"") : null;
+        !str || ~key.indexOf(str) ? result.push(key) : null;
       }
     }
     return result;
@@ -76,14 +76,14 @@
       
       word = token.string,
       start = token.start,
-      end = token.end,
+      end = token.end + -1 * (word.slice(-1) === '"'),
       
       match;
       
     function suggest(suggestions){
       return {
         list: suggestions,
-        from: Pos(cur.line, start),
+        from: Pos(cur.line, start + 1),
         to: Pos(cur.line, end)
       }; 
     }
@@ -111,7 +111,7 @@
       return suggest(keywordsLike(match[1]));
     }
     
-    return suggest(keywordsLike(word).concat(contextLike(word, lastParsed)));
+    return suggest(contextLike(word, lastParsed).concat(keywordsLike(word)));
 
   });
 }).call(this, CodeMirror, CodeMirror.Pos);
--- a/playground/playground.js	Wed Oct 23 16:05:21 2013 -0400
+++ b/playground/playground.js	Fri Nov 01 11:04:25 2013 -0400
@@ -206,10 +206,7 @@
           gutters: ["CodeMirror-lint-markers"],
           theme: "elegant",
           lint: true,
-          extraKeys: {
-            "Ctrl-Space": "autocomplete",
-            "Shift-2": "at_autocomplete"
-          },
+          extraKeys: {"Ctrl-Space": "autocomplete"},
           _playground_key: key
         });