microsoft / vscode-htmlhint

VS Code integration of HTMLHint, an HTML linter.
MIT License
50 stars 35 forks source link

PHP support missing #50

Open esemlabel opened 5 years ago

esemlabel commented 5 years ago
  1. Current version of extension doesn't work when mixing code in PHP files.

Adding php to documentSelector option doesn't make much sense, since extension doesn't know how to ignore embedded PHP (<?php, <?, <?=, ?>, heredoc opening <<<HTML and closing \nHTML;) tags inside php files when mixing with html code, which is usual for PHP coding. That's why errors, that doesn't related to html, appears for embedded tags every time linter is running with message Special characters must be escaped.

Regex pattern for excluding php tags and its content should run before pass document to linter. It is very important for php coding.

I hope you will fix this as soon as possible to make every programmer much happier. Thank you very much!

  1. Linter doesn't work for unsaved php files (and html too), when you just started typing or copy pasting code.

  2. Linter doesn't start to check php file until any other html document is open. That's very annoying, especially when you aren't using html documents in projects at all.


OS: 10.11.6 (El Capitan). VS: 1.29.1

esemlabel commented 5 years ago
  1. Current version of extension doesn't work when mixing code in PHP files.

The easiest and fastest solution would be ability to set custom regex via htmlhint options to exclude content from linting, so users could decide what to exclude by themselves, e.g. "htmlhint.excludePattern": "/<\?(php|=)?(.+?)\?>/is",

or even multiple patterns

"htmlhint.excludePattern": [
    "/somepattern1/",
    "/somepattern2/"
],

Then everything except patterns match can be checked with linter. Or just wrap every matches in <!-- --> comment tags.

kanlukasz commented 4 years ago

+1 for this