Atom JavaScript Coding Bug


#1

So, I’m pretty new to javascript and I try to write in javascript in atom but always when I write: “console.l” and that gives me the option to complete to console.log but when It completes to it it writes the line: “console.console.log()”, help?


#2

Well I found out that I can just write log but it’s still annoying… Is that even a bug? If there is a way to fix this I would like to get help.


#3

It’s not a bug, it’s a feature. You can override this writing your own custom snippet.

Example:

'.source.js':
  'console.log':
    'prefix': 'log'
    'body': 'log($1);$0'

The example above is independent from console and you could –for instance– use it for grunt (as in grunt.log()) as well.

However, if this only about console.log, I’m not sure why you’d find this annoying. Get used to it, many other editors treat this the same way. It’s the same with HTML snippets, which let you omit the < part of any tag. Snippets are meant to be time saving, so it’s only natural that you would want to write less.