public void Execute(ISolution solution, ITextControl textControl) { var file = myMethodDeclaration.GetContainingFile(); if (file == null) { return; } var treeRange = myMethodDeclaration.GetTreeTextRange(); var provider = LanguageManager.Instance.GetService <ICommentOrDirectiveInserter>(file.Language); provider.Insert(treeRange, file, Text, Comment); }