Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Jul 23, 2024
1 parent e830fed commit 8b3d26f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/OneWare.Essentials/ViewModels/ExtendedDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,18 @@ public virtual Task<bool> SaveAsync()
public virtual void InitializeContent()
{
var oldCurrentFile = CurrentFile;
if (CurrentFile?.FullPath != FullPath)

CurrentFile = _projectExplorerService.SearchFullPath(FullPath) as IFile ??
_projectExplorerService.GetTemporaryFile(FullPath);
Title = CurrentFile is ExternalFile ? $"[{CurrentFile.Name}]" : CurrentFile.Name;

if (CurrentFile != oldCurrentFile && oldCurrentFile != null)
{
CurrentFile = _projectExplorerService.SearchFullPath(FullPath) as IFile ??
_projectExplorerService.GetTemporaryFile(FullPath);
Title = CurrentFile is ExternalFile ? $"[{CurrentFile.Name}]" : CurrentFile.Name;
_dockService.OpenFiles.Remove(oldCurrentFile);
}

_dockService.OpenFiles.TryAdd(CurrentFile, this);

UpdateCurrentFile(oldCurrentFile);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,11 @@ public async Task<bool> SimulateAsync(IFile file)
{
var vcdFileRelativePath = match.Groups[1].Value;
var vcdFileFullPath = Path.Combine(projectFile.Root!.FullPath, vcdFileRelativePath);

await Task.Delay(50);


var vcdFile = projectFile.Root.SearchRelativePath(vcdFileRelativePath.ToPlatformPath()) as IFile ??
_projectExplorerService.GetTemporaryFile(vcdFileFullPath);

var doc = await _dockService.OpenFileAsync(vcdFile);
if (doc is IStreamableDocument vcd) vcd.PrepareLiveStream();
}

return true;
Expand Down
3 changes: 3 additions & 0 deletions src/OneWare.ProjectExplorer/Services/ProjectWatchInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ private async Task ProcessAsync(string path, IReadOnlyCollection<FileSystemEvent
case WatcherChangeTypes.Created:
case WatcherChangeTypes.Changed when changes.Any(x => x.ChangeType is WatcherChangeTypes.Created):
_root.OnExternalEntryAdded(path, attributes);
var openTab = _dockService.OpenFiles.FirstOrDefault(x => x.Key.FullPath.EqualPaths(path));
if (openTab.Key is not null)
openTab.Value.InitializeContent();
return;
case WatcherChangeTypes.Changed:
if (_root is ISavable savable && _root.ProjectPath.EqualPaths(path))
Expand Down

0 comments on commit 8b3d26f

Please sign in to comment.