Fixes for the document window state
This commit is contained in:
parent
8422029310
commit
e0612d7e07
|
|
@ -212,12 +212,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
|
|||
{
|
||||
difference |= ProjectDifference.WorkspaceProjectRemoved;
|
||||
}
|
||||
else if (
|
||||
WorkspaceProject?.Id != workspaceProject?.Id ||
|
||||
WorkspaceProject?.Version != workspaceProject?.Version)
|
||||
else
|
||||
{
|
||||
// For now this is very naive. We will want to consider changing
|
||||
// our logic here to be more robust.
|
||||
// We always update the snapshot right now when the project changes. This is how
|
||||
// we deal with changes to the content of C# sources.
|
||||
difference |= ProjectDifference.WorkspaceProjectChanged;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -538,8 +538,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
|
|||
Assert.Equal(ProjectChangeKind.ProjectChanged, ProjectManager.ListenersNotifiedOf);
|
||||
}
|
||||
|
||||
// We always update the snapshot when someone calls WorkspaceProjectChanged. This is how we deal
|
||||
// with changes to source code, which wouldn't result in a new project.
|
||||
[ForegroundFact]
|
||||
public void WorkspaceProjectChanged_WithHostProject_CanNoOp()
|
||||
public void WorkspaceProjectChanged_WithHostProject_NotifiesListeners()
|
||||
{
|
||||
// Arrange
|
||||
ProjectManager.HostProjectAdded(HostProject);
|
||||
|
|
@ -553,6 +555,24 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
|
|||
var snapshot = ProjectManager.GetSnapshot(WorkspaceProject);
|
||||
Assert.True(snapshot.IsInitialized);
|
||||
|
||||
Assert.Equal(ProjectChangeKind.ProjectChanged, ProjectManager.ListenersNotifiedOf);
|
||||
}
|
||||
|
||||
[ForegroundFact]
|
||||
public void WorkspaceProjectChanged_WithHostProject_CanNoOpForSecondProject()
|
||||
{
|
||||
// Arrange
|
||||
ProjectManager.HostProjectAdded(HostProject);
|
||||
ProjectManager.WorkspaceProjectAdded(WorkspaceProject);
|
||||
ProjectManager.Reset();
|
||||
|
||||
// Act
|
||||
ProjectManager.WorkspaceProjectChanged(WorkspaceProjectWithDifferentTfm);
|
||||
|
||||
// Assert
|
||||
var snapshot = ProjectManager.GetSnapshot(WorkspaceProject);
|
||||
Assert.True(snapshot.IsInitialized);
|
||||
|
||||
Assert.Null(ProjectManager.ListenersNotifiedOf);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,10 @@ namespace Microsoft.VisualStudio.RazorExtension.DocumentInfo
|
|||
}
|
||||
|
||||
var textBuffer = textView.BufferGraph.GetRazorBuffers().FirstOrDefault();
|
||||
if (textBuffer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_editorFactoryService.TryGetDocumentTracker(textBuffer, out _documentTracker))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ namespace Microsoft.VisualStudio.RazorExtension.RazorInfo
|
|||
{
|
||||
changed = project;
|
||||
changed.Snapshot = new ProjectSnapshotViewModel(_projectManager.GetLoadedProject(e.ProjectFilePath));
|
||||
DataContext.LoadProjectInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
Command="{Binding UpdateCommand}" />
|
||||
</Grid>
|
||||
<GridSplitter
|
||||
Grid.Row="1"
|
||||
Grid.Row="1"
|
||||
IsEnabled="False" />
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
|
|
@ -168,10 +168,14 @@
|
|||
Grid.Row="4"
|
||||
IsEnabled="{Binding CurrentProjectInfo, TargetNullValue=False}">
|
||||
<Expander.Header>
|
||||
<Grid>
|
||||
<!-- The complicated binding here makes the header stretch horizontally -->
|
||||
<Grid
|
||||
HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition
|
||||
Width="Auto" />
|
||||
<ColumnDefinition
|
||||
Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label
|
||||
Grid.Column="0"
|
||||
|
|
@ -181,10 +185,9 @@
|
|||
Width="Auto"
|
||||
Height="20"
|
||||
Margin="5"
|
||||
Visibility="{Binding CurrentProjectInfo.TagHelperProgressVisibility}"
|
||||
Visibility="{Binding CurrentProjectInfo.TagHelperProgressVisibility, TargetNullValue=Visibility.Hidden}"
|
||||
IsIndeterminate="True" />
|
||||
</Grid>
|
||||
|
||||
</Expander.Header>
|
||||
<ListView
|
||||
ItemsSource="{Binding CurrentProjectInfo.TagHelpers}">
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.VisualStudio.RazorExtension.RazorInfo
|
|||
_currentProject = value;
|
||||
OnPropertyChanged();
|
||||
|
||||
LoadProjectInfo(_currentProject.Snapshot.Project);
|
||||
LoadProjectInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,11 +100,11 @@ namespace Microsoft.VisualStudio.RazorExtension.RazorInfo
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void LoadProjectInfo(ProjectSnapshot snapshot)
|
||||
public async void LoadProjectInfo()
|
||||
{
|
||||
CurrentProjectInfo = new ProjectInfoViewModel();
|
||||
|
||||
var snapshot = CurrentProject?.Snapshot.Project;
|
||||
if (snapshot == null)
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue