[MonoDevelop] Monodevelop Razor Code Completion
m.j.hutchinson at gmail.com
Fri Jan 28 17:23:54 EST 2011
On Fri, Jan 28, 2011 at 12:47 PM, dave <david.groups at gmx.at> wrote:
> No that MVC 3 + Razor runs on the latest builds i'm wondering how hard it
> would be to implement Monodevelop Code Completion in the Views.
> I'm sure there is some nice infrastructure to reuse. Is there someone
> working on this topic at the moment or can someone provide some hints for
I'm not aware of anyone working on it but I could certainly give some
pointers on how to implement it.
We have APIs to plug in code completion and syntax highlighting, and
to get the type and HTML data for completion. The challenges in
implementing Razor support will be implementing an appropriate parser,
and making it fast enough to be used for checking whether to trigger
completion on each keystroke, then implementing the completion logic.
MonoDevelop already has an extensible HTML parser infrastructure that
is extended by the ASP.NET completion. The ASP.NET completion feeds C#
regions and expressions to the C# parser and completion engine to
provide embedded C# completion, and allows the base HTML completion to
handle HTML completion, then only implements ASP.NET tag completion
itself, so is able to make good re-use of other infrastructure. I'm
not sure how easy this will be with Razor because of how the C# and
HTMl are blended. It would be unfortunate if the Razor completion
engine had to fully reimplement C# and HTML completion.
I haven't looked closely at Razor, but if it is possible to parse
Razor to an HTML tree with C# "regions", then it would probably be
possible to build some custom parser nodes for our extensible XML/HTML
parser, which would make a lot of stuff much easier:
See also https://github.com/mono/monodevelop/blob/master/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/BaseHtmlEditorExtension.cs
Let me know if you have any more specific questions.
More information about the Monodevelop-list