Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments only being added with opening tags #102

Closed
davidwarrington opened this issue Sep 28, 2022 · 5 comments · Fixed by #104
Closed

Comments only being added with opening tags #102

davidwarrington opened this issue Sep 28, 2022 · 5 comments · Fixed by #104
Labels
Bug Something isn't working in the vscode extension

Comments

@davidwarrington
Copy link
Collaborator

First off - congratulations on getting this over the line!

Onto the issue:

Using the shortcut cmd + / to create a liquid comment, only the opening tag is added to the beginning of each the area.

Screen.Recording.2022-09-28.at.19.41.23.mov

It's happening in every file I try, but in case it helps, here's the code I'm testing in the video

<div class="prg-ProgressBar {%- if value >= max %} prg-ProgressBar-complete{%- endif -%}" style="--ProgressBar_Max: {{ max }}; --ProgressBar_Value: {{ value }};">
  <p class="prg-ProgressBar_Label fz-14_171">
    {%- if value >= max -%}
      <span class="prg-ProgressBar_Icon">
        {%- render 'icon-check' -%}
      </span>
    {%- endif -%}

    {{ label }}
  </p>

  <div class="prg-ProgressBar_Bar"></div>
</div>
@panoply panoply added the Bug Something isn't working in the vscode extension label Sep 28, 2022
@panoply
Copy link
Owner

panoply commented Sep 28, 2022

Thanks for all the help and discussions to get it/us here!

I've actually never used this command. I will need to have a look and see what might be causing it. I am about to publish a patch, tell me it works. I was using a matching prefix in snippets, but I am not sure if they are related to this?

@panoply
Copy link
Owner

panoply commented Sep 28, 2022

@davidwarrington can you see if the patch release #103 fixes this?

@davidwarrington
Copy link
Collaborator Author

davidwarrington commented Sep 28, 2022

That update doesn't seem to do it.

I've had a quick scan of the project files and stumbled across this in liquid.language-configuration.json which I think is the cause:

{
	"comments": {
		"lineComment": "{% #",
		"blockComment": [
			"{%- comment -%}",
			"{%- endcomment -%}",
			"{% comment %}",
			"{% endcomment %}"
		]
	},
	// ...
}

I know very little about VSCode extensions so I'm hoping I'm wrong, or that there is a workaround, but from a very quick scan it looks like lineComment doesn't support > 1 entry. Also I guess technically the line comment you're using here is still a block comment as it doesn't force the entire line to become a comment.

I've tried modifying my install of this extension by removing lineComment and reducing the blockComment option to two items such as below which seems to work, however it I'm not sure why removing lineComment is necessary when a multiline block is highlighted. Also doing something like below would be enforcing either a whitespace-controlled or no-whitespace-controlled opinion.

{
	"comments": {
		"blockComment": [
			"{%- comment -%}",
			"{%- endcomment -%}",
		]
	},
}

Also just on a personal level I'd really love to default to the inline comments but it's more hassle than it's usually worth if my editor isn't automating writing it for me for multiline comments.

Having a quick Google I also see there's this issue microsoft/vscode#64659 I can see there is some demand for more flexibility here, but no responses.

@panoply
Copy link
Owner

panoply commented Sep 28, 2022

That's the one. I'll PR

panoply added a commit that referenced this issue Sep 28, 2022
Co-Authored-By: David Warrington <[email protected]>
@panoply panoply mentioned this issue Sep 28, 2022
@panoply
Copy link
Owner

panoply commented Sep 28, 2022

🚢 v3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working in the vscode extension
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants