[MonoDevelop] I want to contribute Autocomplete CSS

Michael Hutchinson m.j.hutchinson at gmail.com
Mon Jan 4 23:59:04 EST 2010


2010/1/4 Alberto León <leontiscar at gmail.com>:
> I was contributing in the past in "Pandora" programming a CSS Autocomplete
> and HTML Autocomplete module, so I think I can contribute on monodevelop.
> Any suggestions?, any thing I must account for it?

I know we discussed this on IRC but I'll go into more detail here so
that other people can chime in too.

MD has XHTML completion support already, using the W3C schemas. I'm
sure there are things that could be improved but the core is pretty
sound.

There are several parts to CSS support in MD. It can be broadly broken
into 3 pieces:
1) CSS file editing support - code completion in .css files, document
outline, folding, etc
2) Integration with HTML completion - completion for css classes in
xhtml pages, completion for inline css in html, etc
3) More advanced editing, e.g. live preview, or structured editor of
some kind, or a panel for viewing styles of a page on the fly, etc.
In my opinion, these are in order of increasing difficulty, and each
depends on the previous, so I'll focus on (1) for now. Integrating
with HTML files is complicated because we haven't really solved the
problem of cleanly supporting multiple languages within a single file
yet. However, IMO actual CSS files are better practice than
inline/embedded CSS anyway.


Full support for editing css files can be further broken down:
* Syntax highlighting definitions
* Full parser for CSS files, to parse them into some sort of DOM - for
document outline, code folding, error underlining, and for any
operations that need to query the whole document, such as validation,
or listing defined classes.
* Lightweight "mini" parser for triggering code completion, and
triggering logic. Needs to be fast, so start from the beginning of the
current scope instead of the file.
* Data for code completion in various profiles, e.g. CSS1, CSS1, IE6,
Firefox 3, etc.

Fortunately CSS is quite simple, so the parsers should be
straightforward. The bigger challenge IMO to the data for code
completion, since it all need to be driven from some kind of "schema"
of allowed style names and values, and it really should support
different profiles, not only for the various W3C browsers, but also
for the subsets supported by various major browsers versions.
Hopefully this could be taken from (shared with) some other OSS IDE
such as Eclipse.

A good example to look at would be the TextTemplating addin, which
implements highlighting and outlining for T4 files.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list