[Monodevelop-devel] Google Summer of Code - Razor and MVC 3

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Mar 23 23:35:27 UTC 2012


2012/3/23 Sparek <sparekd at gmail.com>:
> Hi,
>
> My name is Peter and I’d like to participate in developing MD under GSoC
> 2012. I have some experience in web development in .NET hence the projects
> related to ASP .NET MVC draw my attention. I’m particularly interested in
> adding Razor syntax support to Mono Develop – syntax highlighting, code
> completion, new project templates etc. - but I have some questions that
> hopefully could be answered by more experienced developers.
>
> My questions are generally about the difficulty of the task. I started
> browsing the code and investigating the add-ins. I’ve also read several
> articles for developers but I can’t precisely assess the complexity of the
> Razor support task. I think that adding syntax highlighting wouldn’t be too
> hard, but a good Razor parser and code completion seems to me a bit
> challenging.  Am I right or is it just the wrong impression? Will it be
> possible to use the existing ASP and HTML parsers to provide Razor syntax
> support?  I’d be grateful for some feedback so that I could prepare a
> feasible timeline for my application.

It is a challenging project, but I believe it's doable in the GSoC
timeframe. The main challenge is in building a Razor parser. Then you
should integrate with the existing HTML and C# completion engines.

The current ASPX completion support uses a multi-pass approach to code
completion. It's basically an extension of the HTML parser and
completion engine that adds support for ASPX tags, and defers C#
regions to the C# parser and completion engine.

You right that syntax highlighting is usually simpler - it doesn't
track any document structure, it's really just a tokenizer. It uses
the C# token-based highlighter to highlight the regions it identifies
as C#. Unfortunately this makes it hard to do "semantic highlighting"
but that's not really a big deal. It should be pretty easy to modify
it to support Razor.

That said, for Razor, the syntax highlighter's logic for identifying
C# and HTML regions may provide a good basis for the code completion
parser, since it could be used to identify regiosn to be deferred to
the existing HTML and C# completion engines.

For code completion, you'll definitely need to defer C# regions to the
C# completion engine - C# completion is very complex. But I'm not sure
yet whether it would be better to try to extend the existing ASPX
parser to handle Razor C# regions, or to write a new Razor parser that
would defer HTML regions to the HTML completion engine, or reimplement
HTML completion on top of a new Razor parser.

> I’d also like to ask if you have any other ideas related to mvc, maybe of
> greater importance than Razor, that you would like to have implemented.
> Support for MVC 3 from your tasks list seems like an important thing to me.
> What features in this area are most important to you? Adding new templates
> and project types that guarantee building and running mvc 3 without any
> hacks, bug fixing, maybe something else?

The isn't much more to basic ASP.NET MVC3 support than adding
templates. Beyond that, there's a lot that could be done to make
ASP.NET support more awesome - but we leave the details up to you, so
that your proposal can show your understanding of what will make it a
great experience. Here are some ideas of things that *could* be done,
in no particular order:
* support for targeting different web browsers
* make HTML completion in ASP.NET content pages use the context from
the master page
* inline CSS code completion in aspx/html pages
* a split browser/source view for previewing your code as you write it
* support for the "find references" command (and rename command) to
find things in aspx pages
* make C# tooltips work in aspx pages
* a "go to view" command in MVC controller source code, and vice versa
* create a unit test project when creating new ASP.NET MVC projects
* support for deploying and debugging on remote servers
* more unit tests for the aspx completion engine, so it doesn't bitrot again

You can find a few more at
http://monodevelop.com/Developers/Tasks/Web_Development, but these
aren't exhaustive lists - I'm sure there's a lot of things I haven't
listed here that would be worth doing. The key to a good proposal is
to identify things with the most "bang for the buck" for improving the
ASP.NET experience in MD and making sure it's robust.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-devel-list mailing list