Skip to content

Commit

Permalink
Fix Formatting and On Enter integration tests (#10788)
Browse files Browse the repository at this point in the history
Since the end of last week, these tests have been failing. Seems like
something changed on the platform side, perhaps a default value of a
setting. Have started a thread with the editor team to see if we need to
do more.
  • Loading branch information
davidwengier committed Aug 26, 2024
2 parents aa024eb + cdcef8e commit 156f016
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public override async Task InitializeAsync()

VisualStudioLogging.AddCustomLoggers();

// Our expected test results have spaces not tabs
await TestServices.Shell.SetInsertSpacesAsync(ControlledHangMitigatingCancellationToken);

_projectFilePath = await CreateAndOpenBlazorProjectAsync(ControlledHangMitigatingCancellationToken);

await TestServices.SolutionExplorer.RestoreNuGetPackagesAsync(ControlledHangMitigatingCancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Razor;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.TextManager.Interop;
using Xunit;

namespace Microsoft.VisualStudio.Extensibility.Testing;

Expand All @@ -22,4 +25,16 @@ public async Task<string> GetActiveDocumentFileNameAsync(CancellationToken cance
var documentPath = (string)documentPathObj;
return Path.GetFileName(documentPath);
}

public async Task SetInsertSpacesAsync(CancellationToken cancellationToken)
{
var textManager = await GetRequiredGlobalServiceAsync<SVsTextManager, IVsTextManager4>(cancellationToken);

var langPrefs3 = new LANGPREFERENCES3[] { new LANGPREFERENCES3() { guidLang = RazorConstants.RazorLanguageServiceGuid } };
Assert.Equal(VSConstants.S_OK, textManager.GetUserPreferences4(null, langPrefs3, null));

langPrefs3[0].fInsertTabs = 0;

Assert.Equal(VSConstants.S_OK, textManager.SetUserPreferences4(null, langPrefs3, null));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ private static void FeedbackLoggerInternal(string filePath, params string[] expe
var files = new List<string>();
foreach (var feedbackFileProvider in feedbackFileProviders)
{
files.AddRange(feedbackFileProvider.GetFiles());
try
{
files.AddRange(feedbackFileProvider.GetFiles());
}
catch
{
// If one of the providers has issues, we don't want it causing us to not be able to report our stuff properly
}
}

_ = CollectFeedbackItemsAsync(files, filePath, expectedFileParts);
Expand Down

0 comments on commit 156f016

Please sign in to comment.