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

Merge master to master-vs-deps #48835

Merged
34 commits merged into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
03a1e3b
Move to thread pool after yield in WaitAllAsync
sharwell May 22, 2020
42f965b
Move VisualStudioTaskSchedulerProvider to the EditorFeatures layer
sharwell Oct 16, 2020
c57a388
Handle cases where IThreadingContext does not provide a main thread
sharwell Oct 16, 2020
734aac3
Remove inline tags when edits intersect them.
CyrusNajmabadi Oct 20, 2020
6435c7c
Filter out empty tags
CyrusNajmabadi Oct 20, 2020
9900f32
Allow hints to specify space before/after them that will render as a …
CyrusNajmabadi Oct 20, 2020
30a63b1
Support buffer space on both sides
CyrusNajmabadi Oct 20, 2020
ed0acf9
Use an iterative wait in DiagnosticTaggerWrapper
sharwell Oct 20, 2020
7c05aa4
Use PAT fro VS drop
genlu Oct 20, 2020
0e820e1
more fix
genlu Oct 21, 2020
e735c13
Fix
genlu Oct 21, 2020
6a8b676
Merge remote-tracking branch 'dotnet/master' into configure-await
sharwell Oct 21, 2020
677b694
Rename VisualStudioTaskSchedulerProvider to ThreadingContextTaskSched…
sharwell Oct 21, 2020
b17a1f7
Merge remote-tracking branch 'upstream/master' into GenerateConstruct…
CyrusNajmabadi Oct 21, 2020
2ca0b34
Set VM for 'publish-build-assets.yml' in dnceng
genlu Oct 21, 2020
e49cb8b
Parameterize Integration CI queue name.
JoeRobich Oct 21, 2020
eb08ff1
Simplify generate-constructor logic for delegated constructors.
CyrusNajmabadi Oct 21, 2020
45c469a
Merge remote-tracking branch 'upstream/master' into simplifyGenConstr…
CyrusNajmabadi Oct 21, 2020
6b175cc
Docs
CyrusNajmabadi Oct 21, 2020
c23aac7
Add comment
CyrusNajmabadi Oct 21, 2020
5eb557e
Remove verbose logging
genlu Oct 21, 2020
01c03c1
rename
CyrusNajmabadi Oct 21, 2020
36b9f2e
Further simplification.
CyrusNajmabadi Oct 21, 2020
e3e688f
Share code
CyrusNajmabadi Oct 21, 2020
af2c8ba
Merge pull request #48800 from sharwell/proper-wait
Oct 21, 2020
0b6ff9b
Merge pull request #44514 from sharwell/configure-await
sharwell Oct 21, 2020
4debfd2
Merge pull request #48809 from dotnet/dev/gel/usePat
Oct 21, 2020
ae8b081
Restore retry on integration tests (#48812)
jaredpar Oct 21, 2020
c8eecdb
Merge pull request #48662 from sharwell/jtf-scheduler
sharwell Oct 21, 2020
de2462c
Merge pull request #48802 from JoeRobich/run-staging-integration
JoeRobich Oct 21, 2020
fbc0325
Disable sig help in cloud scenario
allisonchou Oct 22, 2020
01fbb98
Merge pull request #48821 from CyrusNajmabadi/simplifyGenConstructor
Oct 22, 2020
53f4587
Merge pull request #48792 from CyrusNajmabadi/cutTagsOnEdit
Oct 22, 2020
e2e303a
Merge pull request #48830 from allisonchou/LSPDoubleSigHelp
allisonchou Oct 22, 2020
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
2 changes: 1 addition & 1 deletion azure-pipelines-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- job: VS_Integration
pool:
name: NetCorePublic-Pool
queue: buildpool.windows.10.amd64.vs2019.pre.open
queue: $(queueName)
strategy:
maxParallel: 4
matrix:
Expand Down
20 changes: 16 additions & 4 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ stages:
condition: and(succeeded(), eq(variables['PRNumber'], 'default'))

# Publish OptProf configuration files
# The env variable is required to enable cross account access using PAT (dnceng -> devdiv)
- task: ms-vscs-artifact.build-tasks.artifactDropTask-1.artifactDropTask@0
env:
ARTIFACTSERVICES_DROP_PAT: $(_DevDivDropAccessToken)
inputs:
dropServiceURI: 'https://devdiv.artifacts.visualstudio.com'
buildNumber: 'ProfilingInputs/DevDiv/$(Build.Repository.Name)/$(SourceBranchName)/$(Build.BuildNumber)'
Expand Down Expand Up @@ -224,17 +227,22 @@ stages:
inputs:
DropName: $(VisualStudio.DropName)
DropFolder: 'artifacts\VSSetup\$(BuildConfiguration)\Insertion'
AccessToken: $(_DevDivDropAccessToken)
condition: succeeded()

# Publish insertion packages to CoreXT store.
- task: NuGetCommand@2
displayName: Publish CoreXT Packages
inputs:
command: push
feedsToUse: config
packagesToPush: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\DevDivPackages\**\*.nupkg'
publishVstsFeed: '97a41293-2972-4f48-8c0e-05493ae82010'
allowPackageConflicts: true
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
feedsToUse: config
publishVstsFeed: '97a41293-2972-4f48-8c0e-05493ae82010'
${{ if eq(variables['System.TeamProject'], 'internal') }}:
nuGetFeedType: external
publishFeedCredentials: 'DevDiv - VS package feed'
condition: succeeded()

# Publish an artifact that the RoslynInsertionTool is able to find by its name.
Expand Down Expand Up @@ -272,8 +280,12 @@ stages:
publishUsingPipelines: true
dependsOn:
- OfficialBuild
queue:
name: Hosted VS2017
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
queue:
name: Hosted VS2017
${{ if eq(variables['System.TeamProject'], 'internal') }}:
pool:
vmImage: vs2017-win2016

# We need to skip post-build stages for PR validation build, but it can only be identified by
# the runtime variable 'PRNumber', thus this dummy stage. Also the dummy job is required
Expand Down
2 changes: 1 addition & 1 deletion eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ function TestUsingOptimizedRunner() {
$args += " --logs `"$LogDir`""
$args += " --secondaryLogs `"$secondaryLogDir`""
$args += " --tfm net472"
$args += " --html"

if ($testDesktop -or $testIOperation) {
if ($test32) {
Expand All @@ -371,6 +370,7 @@ function TestUsingOptimizedRunner() {
# integration tests in CI.
if ($ci) {
$dlls += @(Get-Item (GetProjectOutputBinary "Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests.dll"))
$args += " --retry"
}

$dlls += @(Get-ChildItem -Recurse -Include "*.IntegrationTests.dll" $binDir)
Expand Down
52 changes: 45 additions & 7 deletions src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.InlineHints;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
Expand Down Expand Up @@ -82,7 +83,7 @@ public static InlineHintsTag Create(
bool classify)
{
return new InlineHintsTag(
CreateElement(hint.DisplayParts, textView, span, format, formatMap, taggerProvider.TypeMap, classify),
CreateElement(hint.DisplayParts, textView, format, formatMap, taggerProvider.TypeMap, classify),
textView, span, hint, taggerProvider);
}

Expand All @@ -105,7 +106,6 @@ public async Task<IReadOnlyCollection<object>> CreateDescriptionAsync(Cancellati
private static FrameworkElement CreateElement(
ImmutableArray<TaggedText> taggedTexts,
IWpfTextView textView,
SnapshotSpan span,
TextFormattingRunProperties format,
IClassificationFormatMap formatMap,
ClassificationTypeMap typeMap,
Expand All @@ -126,7 +126,9 @@ private static FrameworkElement CreateElement(
VerticalAlignment = VerticalAlignment.Center,
};

foreach (var taggedText in taggedTexts)
var (trimmedTexts, leftPadding, rightPadding) = Trim(taggedTexts);

foreach (var taggedText in trimmedTexts)
{
var run = new Run(taggedText.ToVisibleDisplayString(includeLeftToRightMarker: true));

Expand All @@ -144,9 +146,10 @@ private static FrameworkElement CreateElement(
// height. Gets foreground/background colors from the options menu. The margin is the distance from the
// adornment to the text and pushing the adornment upwards to create a separation when on a specific line

// If the tag is followed by a space, just create a normal border (as there will already be a buffer to the right).
// If not, then pad the right a little so the tag doesn't feel too cramped with the following text.
var right = span.End < span.Snapshot.Length && char.IsWhiteSpace(span.End.GetChar()) ? 0 : 5;
// If the tag is started or followed by a space, we trim that off but represent the space as buffer on hte
// left or right side.
var left = leftPadding * 5;
var right = rightPadding * 5;

var border = new Border
{
Expand All @@ -155,7 +158,7 @@ private static FrameworkElement CreateElement(
CornerRadius = new CornerRadius(2),
Height = textView.LineHeight - (0.25 * textView.LineHeight),
HorizontalAlignment = HorizontalAlignment.Center,
Margin = new Thickness(left: 0, top: -0.20 * textView.LineHeight, right, bottom: 0),
Margin = new Thickness(left, top: -0.20 * textView.LineHeight, right, bottom: 0),
Padding = new Thickness(1),

// Need to set SnapsToDevicePixels and UseLayoutRounding to avoid unnecessary reformatting
Expand All @@ -174,6 +177,41 @@ private static FrameworkElement CreateElement(
return border;
}

private static (ImmutableArray<TaggedText> texts, int leftPadding, int rightPadding) Trim(ImmutableArray<TaggedText> taggedTexts)
{
using var _ = ArrayBuilder<TaggedText>.GetInstance(out var result);
var leftPadding = 0;
var rightPadding = 0;

if (taggedTexts.Length == 1)
{
var first = taggedTexts.First();

var trimStart = first.Text.TrimStart();
var trimBoth = trimStart.TrimEnd();
result.Add(new TaggedText(first.Tag, trimBoth));
leftPadding = first.Text.Length - trimStart.Length;
rightPadding = trimStart.Length - trimBoth.Length;
}
else if (taggedTexts.Length >= 2)
{
var first = taggedTexts.First();
var trimStart = first.Text.TrimStart();
result.Add(new TaggedText(first.Tag, trimStart));
leftPadding = first.Text.Length - trimStart.Length;

for (var i = 1; i < taggedTexts.Length - 1; i++)
result.Add(taggedTexts[i]);

var last = taggedTexts.Last();
var trimEnd = last.Text.TrimEnd();
result.Add(new TaggedText(last.Tag, trimEnd));
rightPadding = last.Text.Length - trimEnd.Length;
}

return (result.ToImmutable(), leftPadding, rightPadding);
}

/// <summary>
/// Determines if the border is being moused over and shows the info accordingly
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.LanguageServices;
Expand Down Expand Up @@ -65,6 +66,13 @@ private async Task<Model> ComputeModelInBackgroundAsync(
return currentModel;
}

// Let LSP handle signature help in the cloud scenario
var workspaceContextService = document.Project.Solution.Workspace.Services.GetRequiredService<IWorkspaceContextService>();
if (workspaceContextService.IsCloudEnvironmentClient())
{
return null;
}

if (triggerInfo.TriggerReason == SignatureHelpTriggerReason.RetriggerCommand)
{
if (currentModel == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Tagging;
Expand Down Expand Up @@ -36,6 +37,14 @@ internal class InlineHintsDataTaggerProvider : AsynchronousViewTaggerProvider<In

protected override SpanTrackingMode SpanTrackingMode => SpanTrackingMode.EdgeInclusive;

/// <summary>
/// We want to make sure that if the user edits the space that the tag exists in that it goes away and they
/// don't see stale tags sticking around in random locations until the next update. A good example of when this
/// is desirable is 'cut line'. If the tags aren't removed, then the line will be gone but the tags will remain
/// at whatever points the tracking spans moved them to.
/// </summary>
protected override TaggerTextChangeBehavior TextChangeBehavior => TaggerTextChangeBehavior.RemoveTagsThatIntersectEdits;

[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
[ImportingConstructor]
public InlineHintsDataTaggerProvider(
Expand Down Expand Up @@ -92,6 +101,10 @@ protected override async Task ProduceTagsAsync(TaggerContext<InlineHintDataTag>
var hints = await service.GetInlineHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false);
foreach (var hint in hints)
{
// If we don't have any text to actually show the user, then don't make a tag.
if (hint.DisplayParts.Sum(p => p.ToString().Length) == 0)
continue;

context.AddTag(new TagSpan<InlineHintDataTag>(
hint.Span.ToSnapshotSpan(snapshotSpan.Snapshot),
new InlineHintDataTag(hint)));
Expand Down
2 changes: 0 additions & 2 deletions src/EditorFeatures/Core/Shared/Utilities/IThreadingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down
2 changes: 0 additions & 2 deletions src/EditorFeatures/Core/Shared/Utilities/ThreadingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Composition;
using System.Threading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Collections.Generic;
using System.Composition;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Threading;
using Roslyn.Utilities;

namespace Microsoft.VisualStudio.LanguageServices.Implementation
namespace Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
[ExportWorkspaceService(typeof(ITaskSchedulerProvider), ServiceLayer.Host), Shared]
internal sealed class VisualStudioTaskSchedulerProvider : ITaskSchedulerProvider
[ExportWorkspaceService(typeof(ITaskSchedulerProvider), ServiceLayer.Editor), Shared]
internal sealed class ThreadingContextTaskSchedulerProvider : ITaskSchedulerProvider
{
public TaskScheduler CurrentContextScheduler { get; }

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public VisualStudioTaskSchedulerProvider(IThreadingContext threadingContext)
=> CurrentContextScheduler = new JoinableTaskFactoryTaskScheduler(threadingContext.JoinableTaskFactory);
public ThreadingContextTaskSchedulerProvider(IThreadingContext threadingContext)
{
CurrentContextScheduler = threadingContext.HasMainThread
? new JoinableTaskFactoryTaskScheduler(threadingContext.JoinableTaskFactory)
: TaskScheduler.Default;
}

private sealed class JoinableTaskFactoryTaskScheduler : TaskScheduler
{
Expand All @@ -34,7 +36,8 @@ public JoinableTaskFactoryTaskScheduler(JoinableTaskFactory joinableTaskFactory)

public override int MaximumConcurrencyLevel => 1;

protected override IEnumerable<Task> GetScheduledTasks() => null;
protected override IEnumerable<Task> GetScheduledTasks()
=> SpecializedCollections.EmptyEnumerable<Task>();

protected override void QueueTask(Task task)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints
Dim inlineHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken())

Dim producedTags = From hint In inlineHints
Select hint.DisplayParts.GetFullText() + hint.Span.ToString
Select hint.DisplayParts.GetFullText().TrimEnd() + hint.Span.ToString

ValidateSpans(hostDocument, producedTags)
End Using
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class A
{
void Main()
{
var {|int:|}i = 0;
var {|int :|}i = 0;
}
}
</Document>
Expand Down Expand Up @@ -76,7 +76,7 @@ class A
{
void Main()
{
var ({|int:|}i, {|string:|}j) = (0, "");
var ({|int :|}i, {|string :|}j) = (0, "");
}
}
</Document>
Expand All @@ -96,7 +96,7 @@ class A
{
void Main(string[] args)
{
foreach (var {|string:|}j in args) {}
foreach (var {|string :|}j in args) {}
}
}
</Document>
Expand Down Expand Up @@ -156,7 +156,7 @@ class A
{
void Main(string[] args)
{
if (args is { Length: var {|int:|}goo }) { }
if (args is { Length: var {|int :|}goo }) { }
}
}
</Document>
Expand Down Expand Up @@ -217,7 +217,7 @@ class A
{
void Main(string[] args)
{
args.Where({|string:|}a => a.Length > 0);
args.Where({|string :|}a => a.Length > 0);
}
}
</Document>
Expand All @@ -238,7 +238,7 @@ class A
{
void Main(string[] args)
{
args.Where(({|string:|}a) => a.Length > 0);
args.Where(({|string :|}a) => a.Length > 0);
}
}
</Document>
Expand Down Expand Up @@ -279,7 +279,7 @@ class A
{
void Main(string[] args)
{
if (int.TryParse("", out var {|int:|}x))
if (int.TryParse("", out var {|int :|}x))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ public void Dispose()

public async Task WaitForTags()
{
await _listenerProvider.GetWaiter(FeatureAttribute.Workspace).ExpeditedWaitAsync();
await _listenerProvider.GetWaiter(FeatureAttribute.SolutionCrawler).ExpeditedWaitAsync();
await _listenerProvider.GetWaiter(FeatureAttribute.DiagnosticService).ExpeditedWaitAsync();
await _listenerProvider.GetWaiter(FeatureAttribute.ErrorSquiggles).ExpeditedWaitAsync();
await _listenerProvider.GetWaiter(FeatureAttribute.Classification).ExpeditedWaitAsync();
await _listenerProvider.WaitAllDispatcherOperationAndTasksAsync(
_workspace,
FeatureAttribute.Workspace,
FeatureAttribute.SolutionCrawler,
FeatureAttribute.DiagnosticService,
FeatureAttribute.ErrorSquiggles,
FeatureAttribute.Classification);
}
}
}
Loading