-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong support.constant.dom.js #37
Comments
Actually I do miss something. Those constants should be separated into two types: objects and properties. Objects like '(?<!\.|\$)\b(console|window...)\b(?!\$)'; and properties like '(?<=\.)\b(log|error|top|...)\b(?!\$)'; |
I'll look into it. I agree with what you're saying, something I've noticed as well but I just haven't gotten to it yet. |
I started looking into this and I don't think I can use your suggestion as-is. For example, the Until we have per-runtime (Browser, Node.js, Common.js, Rhino, ...) JavaScript grammars, it will be impossible to get everything right. Let me see what I can come up with. |
Per-runtime grammars sounds like a bad idea since I don't see any way to automatically distinguish Browser and node.js code for example. |
I agree. It's not ideal, I'm just saying that we're close to "anomalies" being because we have one syntax for all of JavaScript. Maybe we could do something like JSHint or emacs where you can throw a special comment in your file to "choose" browser vs. Node.js vs. ... Thoughts? |
Project can contain thousands of JS files. Throwing a comment in each one of them doesn't sound like a solution. It's even easier then to use I'd say we either highlight browser's default globals everywhere or we highlight them only as a property of Even within the browser's js in cases like |
Well, you'd only need the comment when you open the file for editing so it's not like you'd have to go in and alter all files just because. That said, I do get your drift and I also think a As for when we highlight browser global variables, we're already doing it everywhere and that's why you've filed the bug. The problem is for us to just not highlight it when it's not a reference to the variable is that we don't really parse JavaScript using a JavaScript parser. We use regex patterns, that's how TextMate works. So it's nearly impossible to go line-by-line and tell a token's context because matching is line by line. I could special case lines starting with Let me think a little more and if you have any suggestions, let me know. |
I've noticed that that TM wrongly highlights some constants. That's how it currently looks
It should be vise versa,
var top
should not have highlight, butwindow.top
should.In short I think that
match
should look like thisAm I missing something?
The text was updated successfully, but these errors were encountered: