[MonoDevelop] What happend to the ParserService?

Michael Hutchinson m.j.hutchinson at gmail.com
Sun Mar 25 12:50:03 EDT 2007


On 3/25/07, Marcos Marín <marcosmarin at gmail.com> wrote:
> I'm pretty new to MonoDevelop Addins and I was following a tutorial where it
> had this:
> ProjectFile file = (ProjectFile) dataObject;
>  IClass[] cls = Runtime.ParserService.GetFileContents
> (file.Project, file.Name);
>  label = string.Format ("{0} ({1})", label, cls.Length);
> But apparently Runtime no longer has the parser service, where did it go?
> I tried doing something like this but I'm not sure if it will work (can't
> test it yet):
>         ProjectFile file = (ProjectFile)dataObject;
>         IParserService parser =
> (IParserService)ServiceManager.GetService(typeof(IParserService));
>         ICompilationUnit unit = parser.GetParser(file.ToString
> ()).Parse(file.ToString());
>         ClassCollection classes = unit.Classes;
>         label = string.Format("{0} ({1})", label, classes.Count);
> Any help appreciated.

This explains the current structure of MD and where various
functionality can be found:
http://www.monodevelop.com/Architecture_Overview. The ParserService is
in the MonoDevelop.Projects layer.

However, if you're at the MonoDevelop.Ide later or above,
MonoDevelop.Ide.Gui.IdeApp is the easy place to find most services,
eg. IdeApp.Services.ParserService

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list