From fd06e3474eda7138eb64e48889ba7aaf3a171eae Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 7 May 2020 10:54:53 -0700 Subject: [PATCH 1/8] Exclude performance tests from debug builds --- .../Test/Semantic/Semantics/OverloadResolutionPerfTests.cs | 3 ++- src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OverloadResolutionPerfTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OverloadResolutionPerfTests.cs index c59f9b8e44643..fbdcd51f605b6 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OverloadResolutionPerfTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OverloadResolutionPerfTests.cs @@ -232,7 +232,8 @@ public static void Method(Func> method) { } comp.VerifyDiagnostics(); } - [Fact, WorkItem(35949, "https://github.com/dotnet/roslyn/issues/35949")] + [WorkItem(35949, "https://github.com/dotnet/roslyn/issues/35949")] + [ConditionalFact(typeof(IsRelease))] public void NotNull_Complexity() { var source = @" diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs index b7998d7128f1c..cae66d5683a69 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs @@ -10,7 +10,8 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics { public class SlowTests : CSharpTestBase { - [Fact, WorkItem(35949, "https://github.com/dotnet/roslyn/issues/35949")] + [WorkItem(35949, "https://github.com/dotnet/roslyn/issues/35949")] + [ConditionalFact(typeof(IsRelease))] public void NotNull_Complexity() { var source = @" From 3c6b60ea3d8972342a536b27cddf7fb5161f38dd Mon Sep 17 00:00:00 2001 From: Allison Chou Date: Thu, 14 May 2020 13:27:18 -0700 Subject: [PATCH 2/8] Fix for assertion error --- .../AbstractFindUsagesService_FindReferences.cs | 14 +++++++++++++- .../CustomProtocol/FindUsagesLSPContext.cs | 1 - .../Handler/References/FindAllReferencesHandler.cs | 1 - 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs b/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs index 2247675080223..0eaa67a2a4a1a 100644 --- a/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs +++ b/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs @@ -20,7 +20,7 @@ namespace Microsoft.CodeAnalysis.Editor.FindUsages { internal abstract partial class AbstractFindUsagesService { - public async Task FindReferencesAsync( + async Task IFindUsagesService.FindReferencesAsync( Document document, int position, IFindUsagesContext context) { var definitionTrackingContext = new DefinitionTrackingContext(context); @@ -48,6 +48,18 @@ await FindLiteralOrSymbolReferencesAsync( } } + async Task IFindUsagesLSPService.FindReferencesAsync( + Document document, int position, IFindUsagesContext context) + { + // We don't need to get third party definitions when finding references in LSP. + // Currently, 3rd party definitions = XAML definitions, and XAML will provide + // references via LSP instead of hooking into Roslyn. + // This also means that we don't need to be on the UI thread. + var definitionTrackingContext = new DefinitionTrackingContext(context); + await FindLiteralOrSymbolReferencesAsync( + document, position, definitionTrackingContext).ConfigureAwait(false); + } + private async Task FindLiteralOrSymbolReferencesAsync( Document document, int position, IFindUsagesContext context) { diff --git a/src/Features/LanguageServer/Protocol/CustomProtocol/FindUsagesLSPContext.cs b/src/Features/LanguageServer/Protocol/CustomProtocol/FindUsagesLSPContext.cs index 4b46052e3344c..c2cbe9905a951 100644 --- a/src/Features/LanguageServer/Protocol/CustomProtocol/FindUsagesLSPContext.cs +++ b/src/Features/LanguageServer/Protocol/CustomProtocol/FindUsagesLSPContext.cs @@ -12,7 +12,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Classification; -using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.FindSymbols; using Microsoft.CodeAnalysis.FindSymbols.Finders; diff --git a/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs b/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs index 4d67cb49eea66..f534b6f13439a 100644 --- a/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs @@ -9,7 +9,6 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.Editor.FindUsages; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.CustomProtocol; From 45fc68b077c2263ab98aa8360273438e6052348a Mon Sep 17 00:00:00 2001 From: Allison Chou Date: Thu, 14 May 2020 23:23:58 -0700 Subject: [PATCH 3/8] Code review feedback --- .../FindUsages/AbstractFindUsagesService_FindReferences.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs b/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs index 0eaa67a2a4a1a..1a824ca2a655c 100644 --- a/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs +++ b/src/EditorFeatures/Core/FindUsages/AbstractFindUsagesService_FindReferences.cs @@ -48,16 +48,14 @@ await FindLiteralOrSymbolReferencesAsync( } } - async Task IFindUsagesLSPService.FindReferencesAsync( + Task IFindUsagesLSPService.FindReferencesAsync( Document document, int position, IFindUsagesContext context) { // We don't need to get third party definitions when finding references in LSP. // Currently, 3rd party definitions = XAML definitions, and XAML will provide // references via LSP instead of hooking into Roslyn. // This also means that we don't need to be on the UI thread. - var definitionTrackingContext = new DefinitionTrackingContext(context); - await FindLiteralOrSymbolReferencesAsync( - document, position, definitionTrackingContext).ConfigureAwait(false); + return FindLiteralOrSymbolReferencesAsync(document, position, new DefinitionTrackingContext(context)); } private async Task FindLiteralOrSymbolReferencesAsync( From b329cc6813defd29e0a1e373fb8f929aad6cf4b2 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 7 May 2020 14:49:28 -0700 Subject: [PATCH 4/8] Remove duplicate test --- .../Test/Semantic/Semantics/SlowTests.cs | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs deleted file mode 100644 index cae66d5683a69..0000000000000 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/SlowTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.CodeAnalysis.CSharp.Test.Utilities; -using Roslyn.Test.Utilities; -using Xunit; - -namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics -{ - public class SlowTests : CSharpTestBase - { - [WorkItem(35949, "https://github.com/dotnet/roslyn/issues/35949")] - [ConditionalFact(typeof(IsRelease))] - public void NotNull_Complexity() - { - var source = @" -#nullable enable - -using System; -using System.Diagnostics.CodeAnalysis; -class C -{ - C f = null!; - - void M(C c) - { - c.f = c; - c.NotNull( - x => x.f.NotNull( - y => y.f.NotNull( - z => z.f.NotNull( - q => q.f.NotNull( - w => w.f.NotNull( - e => e.f.NotNull( - r => r.f.NotNull( - _ => - { - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - """".NotNull(s => s); - - return """"; - })))))))); - } -} - -static class Ext -{ - public static V NotNull([NotNull] this T t, Func f) => throw null!; -} -"; - var comp = CreateCompilation(new[] { NotNullAttributeDefinition, source }); - comp.VerifyDiagnostics(); - } - } -} From 54ffb390d050978d2b41b1993a3f751a1a5a8fb4 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Wed, 13 May 2020 16:28:06 -0700 Subject: [PATCH 5/8] Add support for the textDocument/_ms_getProjectContexts method --- eng/Versions.props | 2 +- .../AbstractLanguageServerProtocolTests.cs | 2 +- .../Extensions/ProtocolConversions.cs | 5 + .../Handler/Initialize/InitializeHandler.cs | 3 +- .../GetTextDocumentWithContextHandler.cs | 81 +++++++++++++ .../Initialize/InitializeTests.cs | 4 +- .../GetTextDocumentWithContextHandlerTests.cs | 109 ++++++++++++++++++ .../LanguageClient/InProcLanguageServer.cs | 5 + 8 files changed, 206 insertions(+), 5 deletions(-) create mode 100644 src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs create mode 100644 src/Features/LanguageServer/ProtocolUnitTests/ProjectContext/GetTextDocumentWithContextHandlerTests.cs diff --git a/eng/Versions.props b/eng/Versions.props index a3a22df8224df..91111f73bca7d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -33,7 +33,7 @@ 3.7.0-1.20210.7 16.4.248 5.0.0-alpha1.19409.1 - 16.7.12-g74a1f6f85d + 16.7.29