Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Formatting and On Enter integration tests #10788

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading