[MonoDevelop] Generics support - Part 2 (PATCH)

Matej Urbas matej.urbas at gmail.com
Sun Jul 23 09:46:38 EDT 2006


Hi

Finally, I have concluded with the second part of implementing generic
support in MonoDevelop's code completion. (There is still a lot to be
done before we can be happy, though...)

What has been done:

- generic data gets parsed correctly from .NET assemblies (using
Mono.Cecil). This means that code completion databases contain all
generic info about types from every assembly.

- I have improved the way we obtain info for return types and parameters
in methods (generics are included).

- some generic info is already displayed in the code completion window,
but due to some greater design obstacles, I could not do much to make it
perfect/usable - this is the point where we have to redesign the way
code completion works (in source editors).

What has to be done:

- language bindings must fill out generic info about types

- language bindings must know that generic types have a '`#' appended in
their names...

- code completion must be somewhat redesigned to thoroughly support
generics...


The patch is attached and ready to commit.


Discussion:

You will notice, that generic types have a '`#' appended to their names.
Since Alejandro and Miguel have pointed out that this is the standard
naming convention of CLS (and it sure makes perfect sence), I have
decided that FullyQualifiedNames MUST preserve this naming convention.
But since language bindings don't understand this naming convention (and
since MonoDevelop's code completion doesn't trim the aforementioned
suffix) MonoDevelop doesn't recognize generic types, and hence members
for all generic types are invisible for now. (Note that generic members
of non-generic types ARE visible already...)

To solve this, I suggest the following (a short term solution):

- we introduce a new method in IAmbience - namely 'string
ConvertName(IClass)', which only removes the suffix and perhaps adds the
generic parameters (e.g.: enclosed in '<' and '>' for C#).

- we introduce a new property in the CodeCompletionWindow which contains
the correct 'completionString'. Now, it seems, that MonoDevelop uses the
string which is used in the code completion popup to display names, but
the problem is that characters '<' and '>' get replaced by '&lt;' and
'&gt;' - which makes no sense in the SourceEditor...


Well, this is only a short term solution. I'll be working on a
redesigned code completion infrastructure and will discuss much before I
implement anything. But for now, we should just get the bare minimum
working...


Enjoy,
---
Matej
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MonoDevelop-generics-part2.diff
Type: text/x-patch
Size: 32780 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/monodevelop-list/attachments/20060723/674ce280/attachment-0001.bin 


More information about the Monodevelop-list mailing list