visual studio code - VSCode not commenting css.liquid lines correctly
I've been having a problem when trying to comment out a line in a css.liquid file with the VScode shortcut (CTRL+/).
Whenever I do this it puts{%\s*#
in front of the line and doesn't comment out the code. I tried disabling all extensions but it's not helping. I haven't touched any settings. When I switch to CSS or Liquid it will comment out fine, but Liquid CSS doesn't work.
Does anybody recognize this issue?
Answer
Solution:
I see this issue has been reported lately: Incorrect comment blocks in Liquid files with this extension enabled (https://github.com/panoply/vscode-liquid/issues/119).
I see this in the liquid css language configuration file:
"comments": {
"lineComment": "{%\\s*#",
"blockComment": [ "/*", "*/" ]
I don't know what the lineComment value is supposed to be but I have never seen a regex value there in other language configuration files - so it may be a mistake.
I built an extension which may be able to help until the language configuration file is fixed: Custom Language Properties (https://marketplace.visualstudio.com/items?itemName=ArturoDent.custom-language-syntax).
- Install it.
- Run the command
Custom Language Properies: Check for new language extensions
. - Make this setting in your
settings.json
:
"custom-language-properties": {
"liquid-css.comments.lineComment": "",
}
If this doesn't work immediately, try a reload of vscode.
This basically sets thelineComment
's to null and so theblockComment
will be used instead. I am not familiar withLiquid
comment styles so let me know if that is not how line comments are supposed to work. Demo:
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.