Sublime Text 2 auto completion popup does not work properly

29,843

Solution 1

If you hit CTRL-SPACE you'll get the dropdown of available completions for what you've just typed.

http://www.sublimetext.com/docs/2/tab_completion.html

If you want the autocomplete dropdown to appear as you type then add this line to your User Preferences.sublime-settings file:

{
  "auto_complete_selector": "source, text"
}

That should do what you're looking for :-)

Solution 2

Consider changing User Settings to the following:

{
  // By default, auto complete will commit the current completion on enter.
  // This setting can be used to make it complete on tab instead.
  // Completing on tab is generally a superior option, as it removes
  // ambiguity between committing the completion and inserting a newline.
  "auto_complete_commit_on_tab": true,

  // Controls if auto complete is shown when snippet fields are active.
  // Only relevant if auto_complete_commit_on_tab is true.
  "auto_complete_with_fields": true,

  // As Richard Jordan suggested, this item
  // controls what scopes auto complete will be triggered in
  "auto_complete_selector": "source, text"
}

Open your User Settings by pressing Cmd+, on Mac or Ctrl+, on Windows

And if you want to fully grasp Sublime Text 2, I do recommend this course: Perfect Workflow in Sublime Text. It used to be free by the time I first posted this answer. I still recommend it anyways.

Solution 3

The creator of the video is using SublimeCodeIntel. What you see at 00:50 isn't Sublime Text 2's autocompletion popup, it's SublimeCodeIntel's import autocompletion popup:

Imports autocomplete - Shows autocomplete with the available modules/symbols in real time.

See the Github page for more information.

Solution 4

Which OS are you using? I'm guessing Windows.

The problem here seems to be that the jQuery snippets in the available plugins have <tabTrigger> attributes that start either with a $ or a ., which causes trouble.

Try the following: Find the jQuery package that contains those snippets (Under Preferences -> Browse Packages) and open the .sublime-snippet file of a snippet that doesn't work properly. The one you named in your post would be defined in the file event-on.sublime-snippet.

Find the line

<tabTrigger>.on</tabTrigger>

and remove the . as follows

<tabTrigger>on</tabTrigger>

Save and return to your .js file. Now see if the snippet shows up when you type o. This works for me.

I guess this is a bug in Sublime Text 2 for Windows (maybe Linux, too?), since it obviously works fine on OS X as we see in the video course you've linked.

There was an issue created on GitHub on this specific package and I now commented this info. I guess the only way to get this working is to have snippets that do not start with special characters.

I also filed a bug for Sublime Text on Userecho.

Share:
29,843

Related videos on Youtube

born2fr4g
Author by

born2fr4g

Updated on July 09, 2022

Comments

  • born2fr4g
    born2fr4g almost 2 years

    I got problem with jQuery Snippet that i installed throughout package control. After installation I do not have popup with jQuery code hints and intalisance. Look at this video:
    http://code.tutsplus.com/courses/perfect-workflow-in-sublime-text-2/lessons/adding-snippets-through-package-control

    On 0:50 after typing . he got popup with code hints - I don't have this one. I have to type . on and then press Tab to display popup with snippet...
    And yes, I'm in JavaScript file and I got default settings.

    And after . he also got all jQuery functions like add or addClass. I do not have this one even if I press Ctrl+Space.

    • born2fr4g
      born2fr4g over 11 years
      Come on guys ? How its on your machine ? Do you have autocompletion when you typing (in real time)(for javascript or jQuery code) just like in above movie ? – born2fr4g just now edit
    • user2503795
      user2503795 over 11 years
      i have the same problem. I don't see the autocompletion popup in realtime. tab either automatically completed my text (I guess when there is just one match) or shows the popup, which I would like to see in real time!
    • Richard Jordan
      Richard Jordan over 11 years
      see answer below - you can get it manually or set it do do this automatically while you type
    • Richard Jordan
      Richard Jordan about 11 years
      the answer below is the right one...
    • dbn
      dbn about 11 years
    • dbn
      dbn about 11 years
      (which was asked after this question, sorry).
    • Alexander Rechsteiner
      Alexander Rechsteiner almost 11 years
      I've got the same problem. The answer below doesn't help.
  • Alexander Rechsteiner
    Alexander Rechsteiner almost 11 years
    Doesn't help unfortunately. I'm having the same issue on ST2 on Windows and I'm trying to get those jQuery snippets to run with autocomplete. Just. Doesn't. Work.
  • Alexander Rechsteiner
    Alexander Rechsteiner almost 11 years
    Ok, found the problem! See my answer below.