Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
genlu committed Nov 10, 2023
1 parent 5e7f3b3 commit 72e85df
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Extensibility.Testing;
Expand All @@ -23,6 +24,10 @@ public async Task WaitForCompilationAvailableAsync(CancellationToken cancellatio
await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, cancellationToken);

var workspace = await TestServices.Shell.GetComponentModelServiceAsync<VisualStudioWorkspace>(cancellationToken);

var hook = workspace.Services.GetRequiredService<IWorkspacePartialSolutionsTestHook>();
hook.IsPartialSolutionDisabled = true;

foreach (var project in workspace.CurrentSolution.Projects)
{
await project.GetCompilationAsync(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.Text.Editor;
using Roslyn.VisualStudio.IntegrationTests;
using Roslyn.VisualStudio.IntegrationTests.InProcess;
using Roslyn.VisualStudio.NewIntegrationTests.InProcess;
Expand All @@ -31,12 +32,40 @@ public override async Task InitializeAsync()
{
await base.InitializeAsync();

var editorOptionsFactory = await TestServices.Shell.GetComponentModelServiceAsync<IEditorOptionsFactoryService>(HangMitigatingCancellationToken);
var options = editorOptionsFactory.GlobalOptions;
options.SetOptionValue(DefaultOptions.ResponsiveCompletionOptionId, false);

// Disable import completion.
var globalOptions = await TestServices.Shell.GetComponentModelServiceAsync<IGlobalOptionService>(HangMitigatingCancellationToken);
globalOptions.SetGlobalOption(CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces, LanguageNames.CSharp, false);
globalOptions.SetGlobalOption(CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces, LanguageNames.VisualBasic, false);
}

[IdeFact]
public async Task Test()
{
await SetUpEditorAsync(@"
Module Module1
Sub Main()
$$
End Sub
End Module", HangMitigatingCancellationToken);

await TestServices.Editor.SetUseSuggestionModeAsync(false, HangMitigatingCancellationToken);

await TestServices.Input.SendAsync("dim ", HangMitigatingCancellationToken);

await TestServices.EditorVerifier.TextContainsAsync(@"
Module Module1
Sub Main()
Dim
End Sub
End Module",
assertCaretPosition: true,
HangMitigatingCancellationToken);
}

[IdeFact]
public async Task IntelliSenseTriggersOnParenWithBraceCompletionAndCorrectUndoMerging()
{
Expand Down

0 comments on commit 72e85df

Please sign in to comment.