Code Monkey home page Code Monkey logo

company-anaconda's Introduction

Company anaconda

Melpa

Anaconda backend for company-mode.

static/company-anaconda.png

Installation

You can install this package from Melpa:

M-x package-install RET company-anaconda RET

Usage

Add company-anaconda to allowed company-mode backends list

(eval-after-load "company"
 '(add-to-list 'company-backends 'company-anaconda))

Enable anaconda-mode in buffers you want to use company-anaconda

(add-hook 'python-mode-hook 'anaconda-mode)

If you want to see anaconda-mode completions together with ones comes from inferior python process use company grouped backend instead:

(eval-after-load "company"
 '(add-to-list 'company-backends '(company-anaconda :with company-capf)))

Customization

By default, company-anaconda uses Jedi's description for candidates as annotations in company-mode's list of completions. This usually tells you the type, and often the fully-qualified name, of a completion candidate. For example, for a candidate a_method, you may see the annotation <function: some_module.SomeClass.a_method>.

You can customize these annotations by setting company-anaconda-annotation-function to a function that takes a candidate string and returns the string company-mode should use as the annotation for that candidate. The candidate string may have the following text properties, which provide additional information about the candidate:

  • description: Jedi's description, typically the type of completion optionally followed by a fully-qualified name for the candidate. For example, "class: foo.bar.Baz" or "statement".
  • module-path: The path to the file that contains this candidate.
  • line: The line within that file where the candidate is defined.
  • docstring: The candidate's docstring.

Here is an example of an alternate annotation function that only returns the first letter of the candidate's description property (indicating its type) in chevrons:

(defun my-annotation-function (candidate)
  (let ((description (get-text-property 0 'description candidate)))
    (when description
      (concat "<" (substring description 0 1) ">"))))

(setq company-anaconda-annotation-function 'my-annotation-function)

For a candidate with a description such as function: some_module.SomeClass.a_method, this would make its annotation in company-mode's completion list simply <f>.

company-anaconda's People

Contributors

demon386 avatar dsedivec avatar proofit404 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.