Does anyone know of any plugins or extensions for Visual Studio Code that prevent MODX tags being marked as errors?
Whenever I am working on templates, chunks, snippets to be used in MODX, I get frequent errors when I use modx tags - [[*xyz]] inside html, php or css. As an example <div id="[[*id]]"> or #prod[[+id]] { background-image: url("img/[[+prodImg]]"); } will generate error messages.
Unfortunately these non-errors clutter up the error panel, making the real errors more difficult to spot quickly.
That probably isn’t actually part of Intellisense, which tends to be for code completion, code declarations/navigation etc.
What file extension are you using for your MODX components? If I use .html for templates and chunks, .php for snippets, I don’t get any errors reported. The [[...]] tags shouldn’t throw errors when used as per your examples.
Yep, a single square bracket means something in CSS, and a second bracket is what’s causing the syntax error to be triggered.
In your particular example, my preference is to inline the element-specific CSS for the element, rather than create what is a dynamic rule in your block, e.g.:
Thanks. That would work for one of our websites, it would add more code, but that wouldn’t be a deal breaker. However it wouldn’t work for another of our websites, for various reasons.
That is why I was hoping there might be a way to teach VCS to accept MODX markup. Or a way to tell it to ignore errors such as those. Would rather fix the tool instead of redesigning the house.