[英]JavaScript autocomplete on imported modules in GitHub's Atom
I'm trying to get familiar with GitHub's Atom and working with JavaScript on a large-scale project. 我正在尝试熟悉GitHub的Atom并在大型项目中使用JavaScript。 I've been working with tutorials, and the biggest complaint I'm having with Atom is that I can't find a way to get the out of the box autocomplete to work consistently.
我一直在使用教程,而我对Atom的最大抱怨是我无法找到一种方法来开箱即用自动完成工作。
For example, I'm following a relatively simple Node.js tutorial, using ES6 syntax, and I have the following code in a core.js
file: 例如,我正在使用ES6语法关注一个相对简单的Node.js教程,并且我在
core.js
文件中有以下代码:
export function logMe(message) {
console.log('message: ' + message);
}
In main.js
file, I have the following: 在
main.js
文件中,我有以下内容:
import {logMe} from '../src/core'
logMe('Hello, world!');
However, when typing in main.js
, I get no autocomplete suggestions for logMe
or anything in my core.js
file. 但是,在
main.js
输入时,我没有获得logMe
或我的core.js
文件中任何内容的自动完成建议。 I feel like there should be either some existing functionality in autocomplete-plus
, or another plugin, that allows autocomplete to work across import
statements. 我觉得
autocomplete-plus
或其他插件中应该有一些现有功能,允许自动完成功能跨import
语句。
Have you tried using atom-ternjs it is Atom integration with the excellent TernJS . 您是否尝试过使用atom-ternjs,它是Atom与优秀TernJS的集成。 You will need to spend a bit of time generating your
.tern-project
file by going to the Packages
menu → Atom Ternjs
→ Configure Project
, but once you have it setup it works very well. 您需要花费一些时间来生成
.tern-project
文件,方法是转到Packages
菜单→ Atom Ternjs
→ Configure Project
,但是一旦设置好,它就可以正常工作。
If you don't want to go down the TernJS route, then there is a setting for the autocomplete-plus
package called Include Completions from All Buffers
: 如果您不想沿着TernJS路线走下去,那么有一个名为
Include Completions from All Buffers
的autocomplete-plus
包的设置:
In my experience it can create a lot of noise and is dependent upon a the other files being open which doesn't scale well. 根据我的经验,它可以产生很多噪音,并且依赖于其他文件被打开而不能很好地扩展。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.