pangloss / vim-javascript

Vastly improved Javascript indentation and syntax support in Vim.
http://www.vim.org/scripts/script.php?script_id=4452
3.8k stars 358 forks source link

Add known DOM element properties #1215

Closed jsit closed 4 years ago

jsit commented 4 years ago

From MDN: https://developer.mozilla.org/en-US/docs/Web/API/Element#Properties

Not sure if this is the best way to do this. But, for instance, if you are doing something like this in HTML:

<div onclick="classList.toggle('foobar');"></div>

the classList property there doesn't get properly highlighted, since it doesn't follow a period. Might be useful to be explicit about these, although it also might be smart to limit the context in which they're valid matches.

jsit commented 4 years ago

Ah, I'm seeing @amadeus actually explicitly doesn't want this stuff in here:

https://github.com/pangloss/vim-javascript/commit/6c2de10

Not that this is anybody's problem but my own, but out of curiosity, if this shouldn't go here, where should it go? Surely not in the HTML syntax. In a separate syntax file altogether?

jsit commented 4 years ago

Would it be overzealous to define as jsObject any string that's followed by a period?

syntax match jsObject /\<\K\k*\ze\s*\./
HiLink jsObject Identifier