> Hello.
> My name is Marcelo Taube.

Hello Marcelo,

> One of the most important requirements for my users is completion according
> to our needs. The problems comes from two fronts
>  1) In our python installation we have modules which were wrote by us in the
> C language, we would like our users to get proper completion proposals.
> Logically this wont work in the initial installation because pydev has not
> python code to parse.
> 2) Sometimes we would like our users to have completion on function return
> values and even concatenations like in " foo(3,4).bar([3,4],5).doit(). ".
>
> If I am right the first problem might be solvable by just configuring the
> builtin completion in pydev (right?). The second problem is not problem with
> most of python code since i saw that pydev has good code analysis. However
> both together are a problem since I don't think pydev is able to check the
> return type of function written in C.

You're right:
- You can configure the forced builtins to do what you want by
spawning a shell and dynamically analyzing your dlls (
http://fabioz.com/pydev/manual_101_interpreter.html )
- pydev has no way of getting return types of c-functions (that's not
available in the shell code-completion introspection -- right now,
sometimes pydev is able to get the arguments by analyzing the
docstrings from those dlls, but that's also not always available)

> If there is a current solution to this i want to know. But in any case i
> would like to be able to add my own completions in order to be able to fix
> problems if they appear.
>
> I think there might be two approaches, one is being able to connect to the
> logical engine of pydev and suppling extra information like the return type
> of some functions. The other approach would be to supply textual completions
> by a separate engine.
>
> I have not discarded the first approach but it seems to be easier to
> implement the second one since i noticed that you have an extension point in
> pydev to add completions participants, so i started investigating that
> option.

There are plans to add a way to the engine so that you can provide a
file with the completions -- right now you could probably generate
python stubs for the c code you have and add those as a .zip to the
pythonpath -- but creating a plugin to add more completions would
surely work too.

> I have studyed a little the code of pydev as a way of learning. since i have
> not found material about the desing of your completion and how to extend it.
> I readed the classes PyCodeCompletion, PythonCompletionProcessor,
> CompletionState, CompletionRequest and most important
> IPyDevCompletionParticipant.
> Please correct me if i am not learning in the proper way.

Reading the code/asking in the list is really the best way of doing it.

> I also wrote a kind of example completion participant to add some dumb
> completion.
> My example would always return a token for the completion 'abcdef', not
> depending in the activation token. It seems that pydev correctly filters out
> the completion if the activation token is not a prefix of the proposal.
> Anyway, the example worked, but now I found an extra problem. PyDev would
> only allow me to add completion proposals to global variables but would not
> allow me to give proposals which include dots. If i return the proposal
> 'abcdef.ghi' and the user writes 'abcedf.' + Ctrl +Space my proposal does
> not appear.
> After some debugging i noticed my code is never called and after reading
> what is happening in PyCodeCompletion i realized that there two distinct
> cases, one for global variables and one for tokens. It seems that in the
> second case contributors are never called. Is that a bug?

It's more like a feature-request (as you can see in
IPyDevCompletionParticipant, it specifically names the methods for
globals and arguments) -- also, when getting things from a token, you
usually need to know more things, such as what that token actually
represents, so, the code-completion for clients there would need good
use-cases to know what would be needed for a client to properly do a
code-completion there.

> Thank you for your time and your answers, i hope you can help me and also
> that i will be able to contribute back for this help.

;-)

Cheers,

Fabio

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
pydev-code mailing list
pydev-code@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to