How can I disable or override the `inspect` snippet?


#1

The snippet I hope to disable or override is:

inspect

It will be expanded to console.log(require('util').inspect(, { depth: null }));.
I know it might be duplicated with How to override a default snippet? discussing thread.
However, it seems I cannot figure out how to do it in that thread, so I am asking.
Thank you for your help :slight_smile:


#2

I don’t have a snippet that activates on inspect. Considering the fact that it’s spawning JavaScript, I would say that you’ve probably installed some package that’s providing snippets. Can you think of which one that might be?


#3

@DamnedScholar - do you ever sleep? :wink:

@benpptung: Override on your snippets.cson file.
Reached from FILE > SNIPPETS
Add the following:

'.source.js':
  'Word: inspect':
    'prefix': 'inspect'
    'body': 'inspect'

Please let me know if this works for you as I expect it to.

Regards.


#4

Occasionally.


#5

@danPadric: it works. and I think I’ve figured out how to override this and other snippets…Thank you :slight_smile:

@DamnedScholar:
I don’t know which package the inspect snippet coming from, and see no way to check it. Previously, I thought it is a default snippet… :smiley:


#6

The usual way of finding out which package does a thing when you can’t observe directly is to guess. You look at the most likely candidates and disable them to eliminate them until you find the right one. However, you’re in luck. Unless the package has a script that is adding snippets directly, you know that it’s going to be in a snippets.cson file in one of your packages. So what you can do is open .atom/packages in Atom and then search in the whole project for the string 'inspect'.


#7

@DamnedScholar
I am not lucky. Cannot find it in .atom/packages.
I’ve tried to disable all the community packages or core packages, but none of them will disable the inspect snippet except autocomplete-snippets or snippets. However, I believe the two packages are not about the inspect snippet. They are just to disable the feature of snippet or autocomplete.


#8

I can confirm inspect() is built-in to Atom’s language selection.
javascript_autocomplete_inspect


#9

What @benpptung is seeing is a snippet that expands to console.log(require('util').inspect(, { depth: null }));. That’s definitely the behavior of a snippet, not an autocompletion.


#10

It is good you explicitly said that.
I get sometimes get confused with auto-complete vs snippet vs emmet.


#11

I’ve found out where is inspect snippet.
It’s coming from language-javascript package.

language-javascript(L86)

So, it is not considered as a default snippet in Atom ? I don’t understand why, this is not a core package created by atom team?
Anyway, I wish they can provide some settings to disable this snippet and some other snippets.


#12

Hi Ben. Good to hear from you.

As you could identify it inside a package - it is an add-on; it is not
considered to be part of the core. Regardless who created it, it is still a
package which can be switched off and be replaced by another language
package.

You could clone the package and make the changes you want. Then switch off
the default one and use your custom version instead.

A step back first -
How does the triggering of the snippets work on your system at the moment?
Would it help if you had to press a particular key to confirm the usage of
a snippet?
Maybe the resolve lies in answering those two questions.

Cheers


#13

No, that’s correct. It’s a core package. With that name, you should be able to override it by adding this snippet to your snippets.cson:

'.source.js':
    'inspect':
        prefix: 'inspect'
        body: 'inspect'

#14

For further clarification, I can only think of three differences between core and community packages.

  1. Community packages take precedence over core packages whenever there are conflicts.
  2. Core packages are only updated alongside an Atom update.
  3. Core packages are maintained by members of the Atom organization.

So really, there’s only one functional difference - for the most part, a package is a package.


#15

@danPadric, @Wliu, @DamnedScholar
Thank you for clarification, and sorry for misunderstanding.
I just switched from WebStorm to Atom, so I am sorry to assume snippets from core packages as default snippets. yes, I share the same opinion, a package is a package.

Atom is great!! Much! Much better than WebStorm!! I’ve been waiting for this switch for 1 year. Thank you for this great product!