为什么不推荐/自动完成console.log()?

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

[确定,我已经开始使用原子文本编辑器。我既是原子文本编辑器又是javascript的初学者。我想知道一件事,为什么Atom在以下情况下不提供建议/自动完成功能:

例如,如果我想写console.log(),即使我按con,键入ctrl+space也不会弹出任何建议。这仅与Atom文本编辑器有关,还是我对console.log()和javascript的理解有误?实际上,我曾尝试过出色的表现,但它也没有为我提供con的补充。

javascript atom-editor
1个回答
1
投票

已经可以完成console.log(),您只需要键入log。这也适用于warnerror,但不支持其他控制台方法,例如time / timeEndtrace

Demo:

enter image description here

要覆盖此默认行为,您可以创建your own snippet

示例:

'.source.js, .source.ts':     # defines the scope of the snippet, e.g. JavaScript and TypeScript
  'console.log()':            # the greyed-out part in the completion popup
    'prefix': 'console'       # trigger for the snippet
    'body': 'console.log($1)' # body of the snippet, where $1 is the cursor position after the completion
© www.soinside.com 2019 - 2024. All rights reserved.