public void SetSite() { IVsPackage package = new VisualRustPackage() as IVsPackage; OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices(); serviceProvider.AddService(typeof(SVsActivityLog), new FakeIVsActivityLog(), true); serviceProvider.AddService(typeof(SVsSolution), new FakeIVsSolution(), true); serviceProvider.AddService(typeof(SVsRegisterProjectTypes), new FakeIVsRegisterProjectTypes(), true); serviceProvider.AddService(typeof(SOleComponentManager), new FakeIOleComponentManager(), true); serviceProvider.AddService(typeof(SVsRunningDocumentTable), new FakeIVsRunningDocumentTable(), true); Assert.AreEqual(0, package.SetSite(serviceProvider)); Assert.AreEqual(0, package.SetSite(null)); }
public async Task <DebugLaunchSettings> GetLaunchSettingsAsync(string executable, string arguments, string workingDirectory, DebugLaunchOptions options, Cargo cargo, TargetTriple triple) { EnvDTE.DTE env = (EnvDTE.DTE)VisualRustPackage.GetGlobalService(typeof(EnvDTE.DTE)); var target = new DebugLaunchSettings(options) { LaunchOperation = DebugLaunchOperation.CreateProcess, LaunchDebugEngineGuid = MIDebugEngineGuid, Executable = executable, Arguments = arguments, CurrentDirectory = workingDirectory, Options = ToXmlString(await BuildLaunchOptionsAsync(executable, arguments, workingDirectory, env, cargo, triple)) }; return(target); }
private void ReinitializeRacerPaths() { DTE env = (DTE)VisualRustPackage.GetGlobalService(typeof(DTE)); // If path to racer.exe is specifed, use it if (GetVisualRustProperty <bool>(env, nameof(RustOptionsPage.UseCustomRacer))) { racerPathForExecution = GetVisualRustProperty <string>(env, nameof(RustOptionsPage.CustomRacerPath)); } else { racerPathForExecution = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Racer", BundledRacerExecutable); } // Same for custom RUST_SRC_PATH if (GetVisualRustProperty <bool>(env, nameof(RustOptionsPage.UseCustomSources))) { racerSourcesLocation = GetVisualRustProperty <string>(env, nameof(RustOptionsPage.CustomSourcesPath)); } else { racerSourcesLocation = null; } }