5

I'm trying to get Code suggestion (the drop-down box) to suggest properly.

Right now it does not. It only suggests, more or less, identifiers and modules that are already in the file being edited (meaning in-file scope). If, for example, I try this:

import numpy <--- numpy is not suggested as I type it.

numpy.a <--- And here, nothing that begins with 'a' is suggested.

I've implemented a raft of things suggested at various sites, including the following, but with no success in getting correct code-complete suggestions to appear, or sometimes to appear at all:

- Installed SublimeRope
- "use_simple_completion": true  (in SublimeRope.sublime-settings)
- "auto_complete_triggers": [ {"selector": "source.python - string - comment - constant.numeroc", "characters": "."} ]  (in Pyhon.sublime-settings)
- etc.

Am I missing something (of course I am :)). Appreciate the suggestions.

Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
NYCeyes
  • 5,215
  • 6
  • 57
  • 64
  • 1
    That’s working as it should. Sublime Text doesn’t autocomplete arbitrary module names or their contents, as far as I know — even in Python. – Ry- Feb 28 '13 at 01:12
  • As minitech said, you did nothing wrong, except that you think at SublimeText as some IDE. It is a text editor with nice interface. Even geany is better( but autocompletion sucks to). If you need to „explore” function from package/modules, try dreampie as shell( you may copy/paste code) or an real IDE (SPE, Ninja, Eric, Aptana, NetBeans, PyCharm ...) – cox Feb 28 '13 at 01:50
  • Thank you minitech3 and cox. I do use "Komodo" and "Wing IDE" as full Python IDEs already (happy with Wing IDE especially); and from the tty I use the curses-based "bpython" (which is excellent, and has full auto complete). I was hoping SublimeText would be a nice cross between bython's lightness and Wing/Komodo's heavier experience. But I guess not as of this writing. Still, I like SublimeText and will use it. I appreciate the responses. :) – NYCeyes Feb 28 '13 at 05:10
  • Not satisfied that SublimeText didn't do what I read it could (stated above), I tinkered some more. It seems I'm probably one setting off, because I discovered that there are two sets of suggestions that come up... (1) The first are in-scope suggestions based on contents already in the file, and (2) but if I back the cursor up one position and hit the dot (.) separator again (e.g. collections.Counter), *then* the complete list detailing the modules & functions I want to see appear. So there's probably a disambiguation setting that needs to be adjusted. I'll report back what that is when able. – NYCeyes Feb 28 '13 at 07:28
  • I believe that this is properly a duplicate of "[Getting full JS autocompletion under Sublime Text](http://stackoverflow.com/q/13661462/1309332)", not the marked question. – dbn Mar 06 '13 at 00:57

1 Answers1

11

Sublime's autocomplete is intended to match within the current file.

If you want to have code completion based on syntactic features of the language, you have many options, but I would suggest some combination of the following:

Hope that helps.

dbn
  • 13,144
  • 3
  • 60
  • 86
  • Thank you. It does. I actually had tried CodeIntel which is what got me closer to what I wanted, though it still struggles to auto-suggest correctly (and it's slows things down -- like any plugin naturally would -- some more that others). Your comment let me know I was going in the right direction (with the myriad of settings that there are). I'd upvote your response (because it's correct), but I only have a measly 6 points. :) – NYCeyes Mar 01 '13 at 23:06
  • Just a heads up for others, the setup for CodeIntel is very difficult and the documentation is very poor. – NL23codes Apr 07 '20 at 16:20