VS Code 中多行字符串中的代码完成

问题描述 投票:0回答:2

每当我尝试在 TypeScript 中使用反引号在多行字符串中编写 html 代码时,VS Code 不会自动完成 html 标签。 例如:

    @Component({
  selector: 'app-property-binding',
  template:`
    <h1></h1>
  `,
  styles: [
  ]
})

我必须手动编写标头标签。 VS Code 不提供自动完成功能。

有没有办法将其添加到 VS Code 中?

typescript visual-studio-code multiline
2个回答
0
投票

您需要在设置中执行此操作:

  "emmet.includeLanguages": {
    "typescript": "javascriptreact"
  },

https://code.visualstudio.com/docs/editor/emmet#_emmet-abbreviations-in-other-file-types


0
投票

您可以通过按 Ctrl+Enter 将模板字符串的内容转义到另一个窗口

https://marketplace.visualstudio.com/items?itemName=plievone.vscode-template-literal-editor

© www.soinside.com 2019 - 2024. All rights reserved.