File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 47
47
codeMirror . setOption ( "extraKeys" , k ) ;
48
48
codeMirror . on ( "cursorActivity" , function ( cm ) { server . updateArgHints ( cm ) ; } ) ;
49
49
} ) ;
50
+
51
+ /* Ideally espruino.json has:
52
+
53
+ "require": {
54
+ "!type": "fn(moduleName: ?) -> !custom:require_handler",
55
+
56
+ .. and then this handler gets called and sets the correct return type
57
+ when someone uses `require()`.
58
+
59
+ The type is in espruino.json at the root level at the moment, so
60
+ require("http") => "http" object. But what I'm doing below isn't working :(
61
+ */
62
+ /*var infer = tern;
63
+ infer.registerFunction("require_handler", function(self, args, argNodes) {
64
+ if (argNodes.length!=1 || argNodes[0].type!="Literal") return;
65
+ var moduleName = argNodes[0].value;
66
+ var moduleType = new infer.Obj(null, moduleName); // broken
67
+ self.propagate(moduleType);
68
+ return infer.ANull;
69
+ });*/
50
70
51
71
/* When we connect to a board and we load its description,
52
72
go through an add all the pins as variables so Tern cal autocomplete */
You can’t perform that action at this time.
0 commit comments