Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

huangapple go评论49阅读模式
英文:

Emmet in VS Code is overwriting text in HTML when using wrap with abbreviation, some kind of bug?

问题

我正在使用VS Code时遇到了一些令人沮丧的Emmet行为,据我所知,Emmet已经集成在VS Code中(?)。

使用缩写包装似乎没有按预期工作,似乎会清除我的选择下方的文本并删除其他标记。

以下是我的起始点:

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

我正在尝试使用Emmet将选定的文本用缩写包装(<kbd>⌘</kbd><kbd>M</kbd> <kbd>⌘</kbd><kbd>W</kbd>),您可以看到热键触发后,换行符已被删除。

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

在输入ul作为Emmet缩写后,我得到了这个结果,文本恢复了换行符,并且它不知何故覆盖了下一个标记的一部分。

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

然后我完成缩写,输入&lt;li&gt;以获取我的5个项目,我得到了如下结果,这是预期的,但我失去了下面元素的一部分。 有什么想法吗?

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

英文:

I am experiencing some frustrating behavior from Emmet right now while using VS Code, as far as I am aware Emmet is baked into VS Code (?).

The wrap with abbreviation seems to not be working as expected, seems to clear text that is below my selection and deletes other tags

Below is my starting point

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

I am trying to wrap the selected text with emmet using wrap with abbreviation(<kbd>⌘</kbd><kbd>M</kbd> <kbd>⌘</kbd><kbd>W</kbd>), you can see the line breaks have been removed after hitting the hotkeys

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

After entering ul for the emmet abbreviation I get this, the text has its line breaks back and it has somehow overwritten a part of the next tag.

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

I then finish the abbreviation with &lt;li&gt; to get my 5 items and I get this, as expected but I have lost a chunk of my element below it. Any ideas?

Emmet在VS Code中在使用缩写包装时覆盖HTML文本,是否存在某种错误?

答案1

得分: 0

当您使用Emmet Wrap时,文件会失去焦点,导致自动保存,触发所有自动格式化工具。它们可能会移动文本,但仍然选择相同的部分。

尝试手动保存文件(Ctrl+S),然后再使用Emmet Wrap。

我曾经也遇到过这个问题,但是自己解决了它。

英文:

When you use Emmet Wrap, the file loses focus, causing it to auto-save, which triggers all auto-formatters. They may shift text, but the same part is still selected.

Try to manually save the file (<kbd>ctrl</kbd><kbd>S</kbd>), and then use Emmet Wrap.

I once faced this problem too, but figured it out myself.

答案2

得分: 0

我已经弄清楚了。 我已经打开了保存时的格式设置。由于某种原因,在保存文件时,它会清除任何不在标签内的文本的换行符,这似乎与Emmet不兼容。我已经关闭了这个设置,现在它可以完美工作了。

英文:

So I figured it out. I had format on save turned ON. For some reason it clears any line breaks for text that isn't within a tag when the file is saved, which doesn't seem to play ball with Emmet. I turned this setting off and it works perfectly now.

huangapple
  • 本文由 发表于 2023年5月11日 20:01:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76227444.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定