我正在尝试从我的 Atom 代码编辑器获取自动完成建议。当我尝试 doc
时,我期待 document
,当我输入 document.que
时,我期待 Atom 会显示 .querySelector ()
。但这并没有发生。我已经安装了这些软件包来解决该问题:
- atom-ternjs
之后我仍然没有获得 doc
或 document 的自动完成功能。
我的 -tern.project 文件如下所示:
{
"ecmaVersion": 6,
"libs": [],
"loadEagerly": [],
"dontLoad": [
"node_modules/**"
],
"plugins": {
"doc_comment": true,
"complete_strings": {
"maxLength": 15
},
"node": {
"dontLoad": "",
"load": "",
"modules": ""
},
"modules": {
"dontLoad": "",
"load": "",
"modules": ""
},
"es_modules": {}
}
}
那么,如何在 Atom 中自动完成 JS 呢?有趣的事情 - 请注意,如果我创建数组并尝试 array.
,那么 Atom 会给我诸如 .pop .push 等建议,但为什么它不给我一个 document.
= > .querySelector()
以及其他用于 DOM 操作的内容。
我的 Atom config.cson:
"*":
core:
telemetryConsent: "no"
editor:
fontSize: 13
"exception-reporting":
userId: "bla-bla-bla"
"linter-ui-default":
showPanel: true
最佳答案
我找到了答案。需要激活: Packages => Atom Ternjs => Configure Project => 这里需要勾选浏览器选项。
关于javascript - 如何设置 Atom JS 自动完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49649287/