Closed degorov closed 11 years ago
Hmm.. Well, we can add Math and JSON to built-in types and only add static properties and methods. Problem solved there. As for the others.. that will be trickier. Right now autocomplete depends on a dot being there... I'm in the midst of rewriting the plugin to use classes and not a steaming heap of util functions. I'll think about how to incorporate this... for now, your keywords file might be the best option.
{
"name": "Math",
"enabled": true,
"constructors": [],
"static_properties": [
{"name": "E"},
{"name": "LN10"},
{"name": "LN2"},
{"name": "LOG10E"}
// etc...
],
"static_methods":
[
{"name":"abs", "args": [{"name": "blahblahblah"}]},
{"name":"acos", "args": [{"name": "blahblahblah"}]},
{"name":"asin", "args": [{"name": "blahblahblah"}]}
// etc...
],
"instance_properties": [],
"instance_methods": []
}
FYI, I added JSON to built-in types.
I wanted to say that Math's methods are practically never used like Math class members, but rather as a single "command" Math.cos(x)
and so on. But if someone extends the Math prototype with own functions, this simplification will fail. So, you are right! I will supply Math members later today. And those 9 global methods can be added to keywords as for now.
I see what you mean. Okay, sounds good!
Maybe Ctrl+Tab on "nothing" should pop-up the list of them?
Math and JSON objects do have only static props and methods, so I think we can treat them the same way - just add them all to pop-up-on-nothing list (
Math.cos(x)
etc). If you create a settings file (or section in existing one) for Global, Math and JSON, I can help with its contents!As for properties of Global object (
Infinity
,NaN
andundefined
), I think it's better to leave them in keywords file, because they are actually always used errrrrr... as keywords :)