protected override async Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { if (!NodeProcess.IsReadyToExecute()) { await NodeProcess.EnsurePackageInstalled(); } }
private async void DocumentSaved(object sender, TextDocumentFileActionEventArgs e) { if (e.FileActionType != FileActionTypes.ContentSavedToDisk || !_project.IsLessCompilationEnabled()) { return; } if (NodeProcess.IsInstalling) { VsHelpers.WriteStatus("The LESS compiler is being installed. Please try again in a few seconds..."); } else if (NodeProcess.IsReadyToExecute()) { CompilerOptions options = await CompilerOptions.Parse(e.FilePath, _view.TextBuffer.CurrentSnapshot.GetText()); if (_view.Properties.TryGetProperty(typeof(LessAdornment), out LessAdornment adornment)) { await adornment.Update(options); } if (options == null || !_project.SupportsCompilation() || !_project.IsLessCompilationEnabled()) { return; } await LessCatalog.UpdateFile(_project, options); if (await LessCatalog.EnsureCatalog(_project)) { await CompilerService.CompileAsync(options, _project); } } }
private async Tasks.Task Execute() { if (!NodeProcess.IsReadyToExecute()) { return; } var solution = (IVsSolution)ServiceProvider.GetService(typeof(SVsSolution)); IEnumerable <IVsHierarchy> hierarchies = GetProjectsInSolution(solution, __VSENUMPROJFLAGS.EPF_LOADEDINSOLUTION); foreach (IVsHierarchy hierarchy in hierarchies) { Project project = GetDTEProject(hierarchy); if (project.SupportsCompilation() && project.IsLessCompilationEnabled()) { if (await LessCatalog.EnsureCatalog(project)) { await CompilerService.CompileProjectAsync(project); } } } }