Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2 :: Python code completion [duplicate]

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.

like image 203
NYCeyes Avatar asked Feb 28 '13 01:02

NYCeyes


People also ask

How do I autocomplete in Sublime Text?

Usage. By default, Sublime Text will automatically show the completions popup when a user is editing source code or markup, but not within prose in comments, strings or markups. Pressing the Esc key will hide the completions popup. To manually show the completions popup, press Ctrl+Space.

Does Sublime Text have intellisense?

You can add the auto-complete Intellisense feature for Kony UI, API, and SDK functions while working with Sublime Text from Visualizer. You must install the Ternjs for Sublime package to enable this feature.


1 Answers

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:

  • Install the CodeIntel package (package control instructions here)
  • Use snippets
    • Install Python snippets through package control (I like sublime-unittest).
    • Instructions for creating your own snippets.

Hope that helps.

like image 108
dbn Avatar answered Sep 27 '22 01:09

dbn