[MonoDevelop] css auto complete
m.j.hutchinson at gmail.com
Tue Nov 25 15:06:19 EST 2008
On Tue, Nov 25, 2008 at 1:45 PM, James King <james.king at 4act.com> wrote:
> Is css supposed to have syntax highlighting and/or auto completion? Is there
> any sort of add-in for that?
Sorry, there is no CSS completion support. I mentored a summer of code
student last year who was implementing it, but unfortunately had to
drop out. He got as far as writing a CSS parser, which is done (in the
SoC SVN repository) but untested
> If it is not there could someone point me in the correct direction for how
> to implement it?
There are a few pieces we need:
* Parser -- convert CSS source into an AST. .
* Completion database -- some kind of data file of allowed selectors,
properties, values etc. Ideally we'd ahve data for different CSS
versions and browser versions.
* Completion engine -- given a text file and a location, decide
whether to trigger and what items to offer. This obviously depends on
the parser and the database.
Completing for CSS should be very easy, given the AST.
The most important missing piece right now, I think, is the database.
A split CSS/HTML preview view would be very easy to implement, and
would be very useful IMO -- just synch the the CSS file to the browser
whenever the AST is valid. I'm also very interested in any ideas you
have to go beyond just text editing, i.e. GUIs for building CSS.
> Do I just need to populate some sort of xml file? Would I have to write the
> entire editor? Would it be best to work on the existing editor and propose
> some changes to someone?
Once the components above are done, it'd be very easy to plug in to
the MD editor. You just have to subclass CompletionTextEditorExtension
and override a couple of methods. For example, one of them is passed
the current character/location on every keystroke, and you just return
a completion list if you want to complete, or null otherwise. There
are a couple of other places to plug in to enable a document outline
(from the AST) and folding. Syntax highlighting can be enabled with an
XML-based definition file.
Inline CSS in HTML files will be trickier, but I can take care of that.
I can go into much more detail on all this pieces when you get to them :)
> I am pretty handy with C# but have never attempted to develop an editor
> Any sort of leg up would be appreciated before I spend an entire weekend
> digging through code and googling just to find a starting block.
I think that CSS is one of the big gaps in the web editing parts of
MD, so I'd be more than happy to give you any assistance you need.
> FYI I am still a linux newb. Everything C# has been on the .Net framework
> (except my most recent project using monodevelop to develop an asp.net C#
> app) I know that gtk replaces winforms in mono and that's about it.
No worries, we were all there at some point :-)
> Any websites, handy articles, list of things I should learn before even
> attempting to develop any sort of add-in for monodevelop would be
http://monodevelop.com/Articles (a little outdated, unfortunately)
Our developer docs aren't that comprehensive, but we'd be happy to
answer any questions you have.
More information about the Monodevelop-list