简体   繁体   中英

Atom JavaScript Autocomplete

I'm new to Atom and JavaScript, Atom seems to be pretty good for web developing.

But to my best knowledge, it seems that there is no Atom package for enabling JavaScript autocomplete.

Does anyone know a package doing this or does Atom have a plan to support JavaScript autocomplete?

Since JavaScript is loosely coupled, providing a working autocomplete solution is not as easy as for statically typed languages like Java. Your best bets with Atom are the following packages:

  • autocomplete-plus - this is now bundled with Atom as the default autocomplete provider
  • ternjs - this looks pretty good, but requires some configuration.

I suggest you give these a try.

I think you should go for atom-ternjs

This is java script intelligence for atom

You need to change(Enable) setting for atom-ternjs

  1. Use autocomplete-snippets
  2. Display both autocomplete-snippets and function name

and many more depends on your requirements ...

If you are using modern JavaScript or TypeScript or Node then atom-typescript is good. It uses tsserver (like vscode) which gives autocomplete, go to definition, syntax checking and other ide goodies. By default it's not enabled for JavaScript. Follow the docs to enable for .js files - https://github.com/TypeStrong/atom-typescript/blob/master/docs/faq.md#i-want-to-use-atom-typescript-with-javascript-too . Configuration for tsserver is done by .jsconfig file - https://code.visualstudio.com/docs/languages/jsconfig .

  1. install "autocomplete-plus"
  2. install "atom-ternjs"
  3. create or open any js file in your project
  4. click on Packages -> Atom Ternjs -> Configure Project
  5. below libs enable the item "browser"
  6. scroll down and click on “Save and Restart Server”

Recommended Atom Packages

  1. atom-ternjs: Adds code intelligence to Atom. https://atom.io/packages/atom-ternjs
  2. autoclose-html-plus: Will help you automatically close HTML tags. https://atom.io/packages/autoclose-html-plus
  3. emmet: Adds code expansion to Atom. https://atom.io/packages/emmet
  4. csslint: Adds CSS error checking abilities to Atom. https://atom.io/packages/csslint
  5. pigments: Adds the ability to display colour in Atom code files. https://atom.io/packages/pigments
  6. language-ejs: Adds EJS language support to Atom. https://atom.io/packages/language-ejs
  7. atom-beautify: Helps to automatically format your code in Atom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM