public void SetSite()
        {
            // Create the package
            IVsPackage package = new RemoveTrailingWhitespacesPackage() as IVsPackage;
            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            // Unsite the package
            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
        }
示例#2
0
 public int OnBeforeSave(uint docCookie)
 {
     if (_pkg.RemoveOnSave())
     {
         RunningDocumentInfo runningDocumentInfo = _pkg.rdt.GetDocumentInfo(docCookie);
         EnvDTE.Document     document            = _pkg.dte.Documents.OfType <EnvDTE.Document>().SingleOrDefault(x => x.FullName == runningDocumentInfo.Moniker);
         if (document == null)
         {
             return(VSConstants.S_OK);
         }
         if (document.Object("TextDocument") is TextDocument textDoc)
         {
             RemoveTrailingWhitespacesPackage.RemoveTrailingWhiteSpaces(textDoc);
         }
     }
     return(VSConstants.S_OK);
 }
 public RunningDocTableEvents(RemoveTrailingWhitespacesPackage pkg)
 {
     _pkg = pkg;
 }
示例#4
0
 public RunningDocTableEvents(RemoveTrailingWhitespacesPackage pkg)
 {
     _pkg = pkg;
 }
 public void IsIVsPackage()
 {
     RemoveTrailingWhitespacesPackage package = new RemoveTrailingWhitespacesPackage();
     Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage");
 }
 public void CreateInstance()
 {
     RemoveTrailingWhitespacesPackage package = new RemoveTrailingWhitespacesPackage();
 }