Skip to content
Permalink
Browse files

Merge pull request #33838 from dotnet/merges/dev16.0-vs-deps-to-maste…

…r-vs-deps

Merge dev16.0-vs-deps to master-vs-deps
  • Loading branch information...
dotnet-automerge-bot committed Mar 4, 2019
2 parents 553aba2 + da920a6 commit c32ec2904856f0b64f20e82329ba69680bdeca70
Showing with 295 additions and 76 deletions.
  1. +13 −5 azure-pipelines-integration.yml
  2. +13 −4 eng/build.ps1
  3. +16 −0 src/EditorFeatures/Core/Implementation/IntelliSense/Completion/AsyncCompletionService.cs
  4. +1 −1 src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs
  5. +7 −0 src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs
  6. +74 −19 src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpIntelliSense.cs
  7. +0 −1 src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractive.cs
  8. +0 −1 src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveDirectives.cs
  9. +1 −7 src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpReplIdeFeatures.cs
  10. +2 −9 src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpReplIntellisense.cs
  11. +3 −1 src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicEditAndContinue.cs
  12. +37 −7 src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicIntelliSense.cs
  13. +17 −0 src/VisualStudio/IntegrationTest/TestUtilities/AsyncCompletionCondition.cs
  14. +59 −0 src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
  15. +18 −0 src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs
  16. +0 −12 src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs
  17. +18 −0 src/VisualStudio/IntegrationTest/TestUtilities/LegacyCompletionCondition.cs
  18. +6 −0 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs
  19. +6 −0 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/TextViewWindow_OutOfProc.cs
  20. +0 −7 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/VisualStudioWorkspace_OutOfProc.cs
  21. +4 −2 src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs
@@ -22,16 +22,24 @@ jobs:
- job: Windows_VisualStudio_Integration_Tests
pool: dotnet-external-vs2019-preview
strategy:
maxParallel: 2
maxParallel: 4
matrix:
debug:
_configuration: Debug
_useLegacyCompletion: false
release:
_configuration: Release
_useLegacyCompletion: false
debug_legacy:
_configuration: Debug
_useLegacyCompletion: true
release_legacy:
_configuration: Release
_useLegacyCompletion: true
timeoutInMinutes: 135

steps:
- script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testVsi
- script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testVsi -testLegacyCompletion:$$(_useLegacyCompletion)
displayName: Build and Test

- task: PublishTestResults@2
@@ -40,14 +48,14 @@ jobs:
testRunner: XUnit
testResultsFiles: $(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml
mergeTestResults: true
testRunTitle: 'Windows Visual Studio Integration $(_configuration)'
testRunTitle: 'Windows Visual Studio Integration $(_configuration)_$(_useLegacyCompletion)'
condition: always()

- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)'
ArtifactName: 'Windows Visual Studio Integration $(_configuration)'
ArtifactName: 'Windows Visual Studio Integration $(_configuration)_$(_useLegacyCompletion)'
publishLocation: Container
continueOnError: true
condition: not(succeeded())
@@ -56,7 +64,7 @@ jobs:
displayName: Publish Screenshots
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.IntegrationTests\$(_configuration)\net472\xUnitResults'
ArtifactName: 'Screenshots $(_configuration)'
ArtifactName: 'Screenshots $(_configuration)_$(_useLegacyCompletion)'
publishLocation: Container
continueOnError: true
condition: not(succeeded())
@@ -57,6 +57,7 @@ param (
[switch][Alias('test')]$testDesktop,
[switch]$testCoreClr,
[switch]$testIOperation,
[switch]$testLegacyCompletion,

[parameter(ValueFromRemainingArguments=$true)][string[]]$properties)

@@ -87,6 +88,7 @@ function Print-Usage() {
Write-Host " -testCoreClr Run CoreClr unit tests"
Write-Host " -testVsi Run all integration tests"
Write-Host " -testIOperation Run extra checks to validate IOperations"
Write-Host " -testLegacyCompletion Run integration tests with legacy completion"
Write-Host ""
Write-Host "Advanced settings:"
Write-Host " -ci Set when running on CI server"
@@ -325,6 +327,10 @@ function TestUsingOptimizedRunner() {
$env:ROSLYN_TEST_IOPERATION = "true"
}

if ($testLegacyCompletion) {
$env:ROSLYN_TEST_LEGACY_COMPLETION = "true"
}

$testResultsDir = Join-Path $ArtifactsDir "TestResults\$configuration"
$binDir = Join-Path $ArtifactsDir "bin"
$runTests = GetProjectOutputBinary "RunTests.exe"
@@ -397,6 +403,9 @@ function TestUsingOptimizedRunner() {
if ($testIOperation) {
Remove-Item env:\ROSLYN_TEST_IOPERATION
}
if ($testLegacyCompletion) {
Remove-Item env:\ROSLYN_TEST_LEGACY_COMPLETION
}
}
}

@@ -525,22 +534,22 @@ try {
if ($quserItems[1] -eq 'console') {
Write-Host "Disconnecting from console before attempting reconnection"
try {
Exec-Command tsdiscon
tsdiscon
} catch {
# ignore
}

# Disconnection is asynchronous, so wait a few seconds for it to complete
Start-Sleep -Seconds 3
Exec-Command query user
query user
}

Write-Host "tscon $sessionid /dest:console"
Exec-Command tscon $sessionid /dest:console
tscon $sessionid /dest:console

# Connection is asynchronous, so wait a few seconds for it to complete
Start-Sleep 3
Exec-Command query user
query user

# Make sure we can capture a screenshot. An exception at this point will fail-fast the build.
Capture-Screenshot $screenshotPath
@@ -162,5 +162,21 @@ private ImmutableHashSet<char> GetAllAutoBraceCompletionChars(IContentType buffe

return set;
}

internal TestAccessor GetTestAccessor()
=> new TestAccessor(this);

internal readonly struct TestAccessor
{
private readonly AsyncCompletionService _asyncCompletionService;

public TestAccessor(AsyncCompletionService asyncCompletionService)
{
_asyncCompletionService = asyncCompletionService;
}

internal bool UseLegacyCompletion(ITextView textView, ITextBuffer subjectBuffer)
=> _asyncCompletionService.UseLegacyCompletion(textView, subjectBuffer);
}
}
}
@@ -51,7 +51,7 @@ public override async Task InitializeAsync()
_projectTemplate != WellKnownProjectTemplates.WpfApplication &&
_projectTemplate != WellKnownProjectTemplates.CSharpNetCoreClassLibrary)
{
VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);
ClearEditor();
}
}
@@ -63,6 +63,13 @@ public virtual async Task InitializeAsync()
/// </summary>
public virtual Task DisposeAsync()
{
if (VisualStudio?.Editor.IsCompletionActive() ?? false)
{
// Make sure completion isn't visible.
// 🐛 Only needed as a workaround for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/801435
VisualStudio.SendKeys.Send(VirtualKey.Escape);
}

_visualStudioContext.Dispose();
return Task.CompletedTask;
}
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
@@ -87,7 +89,7 @@ public static class NavigateTo
[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
public void CtrlAltSpace()
{
VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);

VisualStudio.Editor.SendKeys("nam Goo", VirtualKey.Enter);
VisualStudio.Editor.SendKeys('{', VirtualKey.Enter, '}', VirtualKey.Up, VirtualKey.Enter);
@@ -99,7 +101,7 @@ public void CtrlAltSpace()
VisualStudio.Editor.Verify.CurrentLineText("System.Console.WriteLine();$$", assertCaretPosition: true);
VisualStudio.Editor.SendKeys(VirtualKey.Home, Shift(VirtualKey.End), VirtualKey.Delete);

VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_ToggleCompletionMode);
VisualStudio.Editor.SendKeys(new KeyPress(VirtualKey.Space, ShiftState.Ctrl | ShiftState.Alt));

VisualStudio.Editor.SendKeys("System.Console.writeline();");
VisualStudio.Editor.Verify.CurrentLineText("System.Console.writeline();$$", assertCaretPosition: true);
@@ -108,13 +110,13 @@ public void CtrlAltSpace()
[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
public void CtrlAltSpaceOption()
{
VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);

VisualStudio.Editor.SendKeys("nam Goo");
VisualStudio.Editor.Verify.CurrentLineText("namespace Goo$$", assertCaretPosition: true);

ClearEditor();
VisualStudio.Workspace.SetUseSuggestionMode(true);
VisualStudio.Editor.SetUseSuggestionMode(true);

VisualStudio.Editor.SendKeys("nam Goo");
VisualStudio.Editor.Verify.CurrentLineText("nam Goo$$", assertCaretPosition: true);
@@ -157,6 +159,20 @@ void Main(string[] args)
VisualStudio.Editor.SendKeys("<s");
VisualStudio.Editor.Verify.CompletionItemsExist("see", "seealso", "summary");

if (LegacyCompletionCondition.Instance.ShouldSkip)
{
// 🐛 Workaround for https://github.com/dotnet/roslyn/issues/33824
var completionItems = VisualStudio.Editor.GetCompletionItems();
var targetIndex = Array.IndexOf(completionItems, "see");
var currentIndex = Array.IndexOf(completionItems, VisualStudio.Editor.GetCurrentCompletionItem());
if (currentIndex != targetIndex)
{
var key = currentIndex < targetIndex ? VirtualKey.Down : VirtualKey.Up;
var keys = Enumerable.Repeat(key, Math.Abs(currentIndex - targetIndex)).Cast<object>().ToArray();
VisualStudio.Editor.SendKeys(keys);
}
}

VisualStudio.Editor.SendKeys(VirtualKey.Enter);
VisualStudio.Editor.Verify.CurrentLineText("///<see cref=\"$$\"/>", assertCaretPosition: true);
}
@@ -193,15 +209,17 @@ void Main(string[] args)
}
}");

VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);

VisualStudio.Editor.SendKeys("Mai(");

VisualStudio.Editor.Verify.CurrentSignature("void Class1.Main(string[] args)");
VisualStudio.Editor.Verify.CurrentParameter("args", "");
}

[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
// 🐛 The async completion controller in 16.0 Preview 4 fails to account for brace completion sessions.
[ConditionalWpfFact(typeof(LegacyCompletionCondition)), Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(33825, "https://github.com/dotnet/roslyn/issues/33825")]
public void CompletionUsesTrackingPointsInTheFaceOfAutomaticBraceCompletion()
{
SetUpEditor(@"
@@ -211,7 +229,7 @@ void Main(string[] args)
$$
}");

VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);

VisualStudio.Editor.SendKeys(
'{',
@@ -232,7 +250,9 @@ void Main(string[] args)
assertCaretPosition: true);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
// 🐛 This should work with async completion, but currently does not.
[ConditionalWpfFact(typeof(LegacyCompletionCondition)), Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(33823, "https://github.com/dotnet/roslyn/issues/33823")]
public void CommitOnShiftEnter()
{
SetUpEditor(@"
@@ -244,7 +264,7 @@ void Main(string[] args)
}
}");

VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);

VisualStudio.Editor.SendKeys(
'M',
@@ -261,6 +281,36 @@ void Main(string[] args)
assertCaretPosition: true);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
public void LineBreakOnShiftEnter()
{
SetUpEditor(@"
class Class1
{
void Main(string[] args)
{
$$
}
}");

VisualStudio.Editor.SetUseSuggestionMode(true);

VisualStudio.Editor.SendKeys(
'M',
Shift(VirtualKey.Enter));

VisualStudio.Editor.Verify.TextContains(@"
class Class1
{
void Main(string[] args)
{
M
$$
}
}",
assertCaretPosition: true);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
public void CommitOnLeftCurly()
{
@@ -270,7 +320,7 @@ class Class1
$$
}");

VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);

VisualStudio.Editor.SendKeys("int P { g{");

@@ -282,26 +332,31 @@ class Class1
assertCaretPosition: true);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
[ConditionalWpfFact(typeof(LegacyCompletionCondition)), Trait(Traits.Feature, Traits.Features.Completion)]
[WorkItem(33822, "https://github.com/dotnet/roslyn/issues/33822")]
public void EnsureTheCaretIsVisibleAfterALongEdit()
{
SetUpEditor(@"
var visibleColumns = VisualStudio.Editor.GetVisibleColumnCount();
var variableName = new string('a', (int)(0.75 * visibleColumns));
SetUpEditor($@"
public class Program
{
{{
static void Main(string[] args)
{
var aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 0;
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = $$
}
}");
{{
var {variableName} = 0;
{variableName} = $$
}}
}}");

Assert.True(variableName.Length > 0);
VisualStudio.Editor.SendKeys(
VirtualKey.Delete,
"aaa",
VirtualKey.Tab);
var actualText = VisualStudio.Editor.GetText();
Assert.Contains("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", actualText);
Assert.Contains($"{variableName} = {variableName}", actualText);
Assert.True(VisualStudio.Editor.IsCaretOnScreen());
Assert.True(VisualStudio.Editor.GetCaretColumn() > visibleColumns, "This test is inconclusive if the view didn't need to move to keep the caret on screen.");
}

[WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
@@ -97,7 +97,6 @@ public async Task WpfInteractionAsync()
[WpfFact]
public void TypingHelpDirectiveWorks()
{
VisualStudio.Workspace.SetUseSuggestionMode(true);
VisualStudio.InteractiveWindow.ShowWindow(waitForPrompt: true);

// Directly type #help, rather than sending it through VisualStudio.InteractiveWindow.SubmitText. We want to actually test
@@ -18,7 +18,6 @@ public CSharpInteractiveDirectives(VisualStudioInstanceFactory instanceFactory)
[WpfFact]
public void VerifyHostCommandsCompletionList()
{
VisualStudio.Workspace.SetUseSuggestionMode(true);
VisualStudio.InteractiveWindow.InsertCode("#");
VisualStudio.InteractiveWindow.InvokeCompletionList();

@@ -16,15 +16,9 @@ public CSharpReplIdeFeatures(VisualStudioInstanceFactory instanceFactory)
{
}

public override async Task InitializeAsync()
{
await base.InitializeAsync().ConfigureAwait(true);
VisualStudio.Workspace.SetUseSuggestionMode(true);
}

public override Task DisposeAsync()
{
VisualStudio.Workspace.SetUseSuggestionMode(false);
VisualStudio.Editor.SetUseSuggestionMode(false);
VisualStudio.InteractiveWindow.ClearReplText();
VisualStudio.InteractiveWindow.Reset();
return base.DisposeAsync();
Oops, something went wrong.

0 comments on commit c32ec29

Please sign in to comment.
You can’t perform that action at this time.