private static LanguageDispatcher GetLanguageDispatcher(Document document) { if (document == null) { return(null); } var project = document.Project; if (project == null) { return(null); } var language = project.Language; if (language == LanguageNames.CSharp) { return(CSharp.GetDispatcher()); } else if (language == LanguageNames.VisualBasic) { return(VisualBasic.GetDispatcher()); } else { return(null); } }