From ca47896204482bf4a6979e3838bf7f09f61cebeb Mon Sep 17 00:00:00 2001 From: giy <giy@omp-system.ru> Date: Fri, 02 Sep 2022 14:16:56 +0300 Subject: [PATCH] Обновление до версии 2.9.0 --- QtVsTools.Package/Editors/Editor.QtDesigner.cs | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/QtVsTools.Package/Editors/Editor.QtDesigner.cs b/QtVsTools.Package/Editors/Editor.QtDesigner.cs index 518bd6c..73148b0 100644 --- a/QtVsTools.Package/Editors/Editor.QtDesigner.cs +++ b/QtVsTools.Package/Editors/Editor.QtDesigner.cs @@ -31,12 +31,15 @@ using System.IO; using System.Runtime.InteropServices; using System.Threading.Tasks; -using Microsoft.VisualStudio.Shell.Interop; -using QtVsTools.QtMsBuild; -using QtVsTools.VisualStudio; +using Microsoft.VisualStudio.Shell; + +using Task = System.Threading.Tasks.Task; namespace QtVsTools.Editors { + using QtMsBuild; + using VisualStudio; + [Guid(GuidString)] public class QtDesigner : Editor { @@ -58,27 +61,31 @@ protected override void OnStart(Process process) { + ThreadHelper.ThrowIfNotOnUIThread(); + base.OnStart(process); var document = VsShell.GetDocument(Context, ItemId); if (document == null) return; + var project = document.ProjectItem?.ContainingProject; - if (project == null || !QtProjectTracker.IsTracked(project)) + if (project == null || !QtProjectTracker.IsTracked(project.FullName)) return; + string projectPath = project.FullName; string filePath = document.FullName; string[] itemId = new[] { document.ProjectItem?.Name }; var lastWriteTime = File.GetLastWriteTime(filePath); - Task.Run(() => + _ = Task.Run(async () => { while (!process.WaitForExit(1000)) { var latestWriteTime = File.GetLastWriteTime(filePath); if (lastWriteTime != latestWriteTime) { lastWriteTime = latestWriteTime; - QtProjectIntellisense.Refresh(project, selectedFiles: itemId); + await QtProjectIntellisense.RefreshAsync(project, projectPath); } } if (lastWriteTime != File.GetLastWriteTime(filePath)) { - QtProjectIntellisense.Refresh(project, selectedFiles: itemId); + await QtProjectIntellisense.RefreshAsync(project, projectPath); } }); } -- Gitblit v1.9.1