Geany is missing some of the newer language features available to JavaScript since about version 1.6. This includes 'get', 'set', and 'yield' [1].
There's also a large gap between the keywords available to JavaScript embedded in HTML/PHP (filetypes.xml) and JavaScript on its own (filetypes.javascript); filetypes.xml contains a large number of keywords, many of which are not just language features, but also objects, and their properties and methods. This just seems incorrect, to me. And I'll admit, the separation between embedded and standalone JavaScript is something of a design flaw in Scintilla. Some might say it's a "feature".
I'll just attach a patch that contains all of the additions I've collected over a short (~20 minute) time frame. My primary source is Mozilla Documentation Network, although the ECMA standards are more authoritative. (Not that I even want to make an attempt to read it...)
The patch only touches filetypes.javascript, I think filetypes.xml needs a thorough overlooking to determine what needs to go. I've stuck with keywords listed in [1] and [2] for what's really necessary to define in filetypes.javascript.
I tried to keep the separation between primary and secondary keywords simple: 'primary' keywords are statements, operators, types, values, and other language constructs. 'secondary' keywords are functions, objects, properties, methods, etc. Note that I have not included functions like alert(), confirm(), prompt(), ... in the secondary keywords, because those are methods of the global window object, and are not a core function in JavaScript itself.
Finally, the 'secondary' keywords in filetypes.javascript are unused. This patch fixes it.
[1] https://developer.mozilla.org/en/JavaScript/Reference/Operators [2] https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
On 12/22/2010 10:37 AM, Jason Oster wrote:
'secondary' keywords are functions, objects, properties, methods, etc.
'eval' should also be moved to the secondary keywords list, as well. ;) Attached.
Some others like JSON might be nice to have as well. I'm not quite sure where this one stands, it seems to be a part of ECMAScript 5, so I would argue for its inclusion. Some other obvious "nice-to-haves" would be 'require' (RequireJS, Node.js, etc.), 'Buffer' objects (Node.js), and other common framework additions. Maybe some web devs on the list can provide their thoughts on this?
On Wed, 22 Dec 2010 10:37:22 -0700, Jason wrote:
Hi,
Geany is missing some of the newer language features available to JavaScript since about version 1.6. This includes 'get', 'set', and 'yield' [1].
There's also a large gap between the keywords available to JavaScript embedded in HTML/PHP (filetypes.xml) and JavaScript on its own (filetypes.javascript); filetypes.xml contains a large number of keywords, many of which are not just language features, but also objects, and their properties and methods. This just seems incorrect, to me. And I'll admit, the separation between embedded and standalone
Ok. So should we remove the extra keywords from filetypes.xml, to have embedded JS containing only language features? I don't mind much which way to go as I don't use JS and so don't really know what's best.
JavaScript is something of a design flaw in Scintilla. Some might say it's a "feature".
:).
I'll just attach a patch that contains all of the additions I've collected over a short (~20 minute) time frame. My primary source is Mozilla Documentation Network, although the ECMA standards are more authoritative. (Not that I even want to make an attempt to read it...)
The patch only touches filetypes.javascript, I think filetypes.xml needs a thorough overlooking to determine what needs to go. I've stuck with keywords listed in [1] and [2] for what's really necessary to define in filetypes.javascript.
Awesome, thank you. Committed (actually the second version of your patch).
I tried to keep the separation between primary and secondary keywords simple: 'primary' keywords are statements, operators, types, values, and other language constructs. 'secondary' keywords are functions, objects, properties, methods, etc. Note that I have not included
Sounds reasonable.
Regards, Enrico