【问题标题】:Frustration with inconsistent Emmet results in VSCodeVSCode 中不一致的 Emmet 结果令人沮丧
【发布时间】:2018-02-06 11:50:22
【问题描述】:

大约 6 或 7 个月前,我从 ST3 迁移到 VSCode,总的来说我很喜欢它。但我真的在为 Emmet/VSCode 如何扩展文本的不一致而苦苦挣扎......

例如:(这些例子是根据cheat sheet)

  • fl 应该给我float:left,但我得到的是flex: gif
  • m:a 应该给我margin:auto - 尽管自 ST3 以来我一直为此使用 m-。但是在 VScode 中:我得到 max-block-size: gif
  • ttu 应该给我text-transform:uppercase,但我却得到text-underline-position:
  • p20-40 应该给我 padding: 20px 40px 但在这种情况下,什么都没有发生 - 根本无法识别它
  • w100p 应该给我width:100% 但同样,我什至不认识它
  • 甚至 HTML 也经常出现问题:.div-class 变为 .div-class<?php gif

似乎 VSCode 有自己的内置 Emmet,它总是与 actual Emmet 冲突。我会第一个承认这可能是我的settings.json 中的一个冲突选项,所以这是我的设置文件:

{
  "editor.tabSize": 2,
  "editor.minimap.enabled": false,
  "editor.acceptSuggestionOnEnter": "smart",
  "editor.wordBasedSuggestions": false,
  "editor.quickSuggestions": {
    "other": true,
    "comments": false,
    "strings": true
  },
  "editor.tabCompletion": true,
  "editor.renderWhitespace": "boundary",
  "editor.snippetSuggestions": "top",
  "editor.occurrencesHighlight": false,
  "editor.selectionHighlight": false,
  "editor.renderIndentGuides": true,
  "editor.autoIndent": true,

  "php.suggest.basic": false,
  "php.validate.executablePath": "/usr/local/php5/bin/php",

  "workbench.colorTheme": "Bimbo Theme",
  "workbench.iconTheme": "vs-seti",
  "workbench.startupEditor": "none",
  "workbench.editor.tabCloseButton": "left",
  "workbench.commandPalette.preserveInput": true,
  "workbench.tips.enabled": false,

  "window.zoomLevel": 0,
  "git.enableSmartCommit": true
}

我已删除与字体大小和主题等相关的设置。

其他信息:

如果没有遇到这些问题的人可以分享他们的设置文件以便我可以解决我的挫败感并继续热爱 VSCode,真的会很感激吗?

谢谢:)

【问题讨论】:

    标签: visual-studio-code emmet vscode-settings


    【解决方案1】:

    这是因为 Emmet 干扰了自动完成功能。尝试键入任何这些命令并从命令面板Emmet: Expand Abbreviation 执行。

    • 您可以为 emmet 命令重新映射键绑定 editor.emmet.action.expandAbbreviation

    • 您可以禁用 css 的自动完成功能(在需要时显示自动完成功能Trigger Suggest Ctrl+Space)

    "[css]": {
        "editor.quickSuggestions": {
            "other": false,
            "comments": false,
            "strings": false
        }
    }
    

    从1.16 August 2017 版本开始,您可以将 emmet sn-ps 移到顶部并仍然具有自动完成功能:

    "emmet.showSuggestionsAsSnippets": true,
    "editor.snippetSuggestions": "top"
    

    【讨论】:

    • 感谢@Alex,这非常有用。似乎我的很多烦恼都来自editor.quickSuggestions 对象。感谢您的帮助
    猜你喜欢
    • 1970-01-01
    • 2012-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-05
    • 1970-01-01
    • 1970-01-01
    • 2011-04-03
    相关资源
    最近更新 更多