vscode-plugin icon indicating copy to clipboard operation
vscode-plugin copied to clipboard

(Enhancement) Ignore particular lines

Open HiEv opened this issue 6 years ago • 4 comments

Could you add an option to have this VSCode extension ignore particular lines? For example, any line that includes "/* csstree-ignore-line */".

I have some code in my CSS for older browsers (e.g. -webkit-margin-before:, -webkit-margin-after:, width: -webkit-fill-available, width: -moz-available, and width: fill-available), which are reported as errors, and I'd rather have an empty "Problems" window in VSCode. Giving me a way to have your extension not report those lines as errors would really be appreciated.

Thank you, and thank you for the VSCode extension. :smiley:

HiEv avatar Dec 20 '19 09:12 HiEv

I'd also like to be able to do this. In my case to silence a validator error when using font-display.

@font-face {
  font-display: swap;
}

see: https://github.com/csstree/csstree/issues/108

timohofmeijer avatar Apr 29 '20 09:04 timohofmeijer

Any update on this?

HarryAdney avatar Jan 26 '21 11:01 HarryAdney

Issue with font-display is not an issue anymore, since plugin validates at-rule's declarations based on a dictionary for at-rules now.

I believe that comments is not a good approach to disable validation.

Options we have:

  • Use stylelint + VS Code stylelint plugin + stylelint CSSTree plugin. In this case you may tweak syntax dictionary and use other options to fix warning. I see this approach as a better choice for now, since stylelint + CSSTree plugin may be used on CI as well.
  • Extend syntax dictionary in CSSTree (patch for mdn-data) or in mdn-data, and wait for merge/release and this plugin update. I may take some time, but will be helpful for others who use such properties (syntax dictionaries are incomplete currently), so that's good for a dev community.
  • Add some settings to this plugin. However, I'm not sure it will satisfy user's needs and looks a bit complicated for users.

lahmatiy avatar Jan 26 '21 15:01 lahmatiy

The 'csstree-ignore-line' comment would be a great way to handle this. It's flexible, easy to understand and apply, and wouldn't require any configuration changes.

antefix-consulting avatar Apr 09 '21 20:04 antefix-consulting