roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Ability to prioritize function parameters and showing them on entering ( #75

Open sassanh opened 7 years ago

sassanh commented 7 years ago

Is it possible to:

  1. Have an option to prioritize function parameters.
  2. Show function parameters when user enters (. For example when entering serializers.SerializerMethodField( (python, rest framework) would be great to show method_field as first completion suggestion and when entering serializers.SerializerMethodField(me would be great to have method_field as first suggestion (currently for me it's map then max, etc, method_field is 6th)
roxma commented 7 years ago
  1. Have an option to prioritize function parameters.

I guess you want custom sorting of the python completion items.

A completion source can use its own sort algorithm with the sort option set to 0 (it's currently undocumented behavior).

  1. Show function parameters when user enters (. For example when entering serializers.SerializerMethodField( (python, rest framework) would be great to show method_field as first completion suggestion and when entering serializers.SerializerMethodField(me would be great to have method_field as first suggestion (currently for me it's map then max, etc, method_field is 6th)

ncm's python completion is based on jedi library. According to the documentation, it doesn't have this feature.

However, it seems possible to implement it, as the completion results returned by jedi has information about the type. To be specific, it's Completion.BaseDefinition.type http://jedi.readthedocs.io/en/latest/_modules/jedi/api/classes.html#Completion.

It is not really attractive to me so I have no plan to support it.

sassanh commented 7 years ago

OK, maybe I can make a PR if it attracts myself 😄