Skip to content
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 @@ -15,11 +15,14 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
{
[UseExportProvider]
public abstract class RecommenderTests : TestBase
{
protected static readonly CSharpParseOptions CSharp9ParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp9);
Expand Down Expand Up @@ -55,6 +58,11 @@ private Task VerifyInFrontOfCommentAsync(

private Task CheckResultAsync(string text, int position, bool absent, CSharpParseOptions options, int? matchPriority)
{
using var workspace = new TestWorkspace(composition: FeaturesTestCompositions.Features);
var solution = workspace.CurrentSolution;
var project = solution.AddProject("test", "test", LanguageNames.CSharp);
var document = project.AddDocument("test.cs", text);

var tree = SyntaxFactory.ParseSyntaxTree(text, options: options);
var compilation = CSharpCompilation.Create(
"test",
Expand All @@ -67,7 +75,7 @@ private Task CheckResultAsync(string text, int position, bool absent, CSharpPars
}

var semanticModel = compilation.GetSemanticModel(tree);
var context = CSharpSyntaxContext.CreateContext_Test(semanticModel, position, CancellationToken.None);
var context = CSharpSyntaxContext.CreateContext(document, semanticModel, position, CancellationToken.None);
return CheckResultAsync(absent, position, context, matchPriority);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ private VSCompletionItem Convert(
insertionText = roslynItem.DisplayText;
}

var supportedPlatforms = SymbolCompletionItem.GetSupportedPlatforms(roslynItem, document.Project.Solution.Workspace);
var supportedPlatforms = SymbolCompletionItem.GetSupportedPlatforms(roslynItem, document.Project.Solution);
var attributeImages = supportedPlatforms != null ? s_WarningImageAttributeImagesArray : ImmutableArray<ImageElement>.Empty;

itemData = new VSCompletionItemData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.ArrayStatements
Public Class EraseKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub EraseInMethodBodyTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.ArrayStatements
Public Class PreserveKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub PreserveNotInMethodBodyTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.ArrayStatements
Public Class ReDimKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ReDimInMethodBodyTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class AliasKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AliasAfterLibNameInSubTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
' See the LICENSE file in the project root for more information.

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
<[UseExportProvider]>
Public Class AsKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AsInAggregateClause1Test()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class AsyncKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub KeywordsAfterAsyncTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class AttributeScopeKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AttributeScopesInFileTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class CharsetModifierKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AutoAfterDeclareTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class ClassKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ClassInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class ConstKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ConstInMethodBodyTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class CovarianceModifierKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub InAfterOfInInterfaceTypeParamTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class CustomEventKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub CustomEventInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class DeclareKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub DeclareInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class DelegateKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub DelegateInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class DelegateSubFunctionKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub SubAndFunctionAfterDelegateTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class DimKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub DimInMethodDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class EndBlockKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub EndSubInBrokenMethodBodyTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class EnumKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub EnumInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class EventKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub EventInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class ExternalSubFunctionKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub SubAfterDeclareTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class FunctionKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub FunctionInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class GenericConstraintsKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AllAfterAsInSingleConstraintTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class GetSetKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub GetAndSetAfterAutoPropTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class HandlesKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub HandlesAfterMethodInClassTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class ImplementsKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ImplementsAfterClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.ImportsKeywordRecommender
Public Class OptionKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ImportsInBlankFileTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class InKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub InInForEach1Test()
VerifyRecommendationsContain(<MethodBody>For Each x |</MethodBody>, "In")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class InheritsKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub InheritsAfterClassDeclarationTest()
VerifyRecommendationsContain(<File>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class InterfaceKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub InterfaceInClassDeclarationTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class IteratorKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub KeywordsAfterIteratorTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class LibKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub LibAfterNameInSubTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations.ModifierKeywordRecommenderTests
Public Class InsideClassDeclaration
Inherits RecommenderTests

#Region "Scope Keywords"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations.ModifierKeywordRecommenderTests
Public Class InsideInterfaceDeclaration
Inherits RecommenderTests

#Region "Scope Keywords"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations.ModifierKeywordRecommenderTests
Public Class InsideModuleDeclaration
Inherits RecommenderTests

<Fact>
<WorkItem(544630, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544630")>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations.ModifierKeywordRecommenderTests
Public Class InsideNamespaceDeclaration
Inherits RecommenderTests

''' <summary>
''' Declarations outside of any namespace in the file are considered to be in the project's root namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations.ModifierKeywordRecommenderTests
Public Class InsideStructureDeclaration
Inherits RecommenderTests

#Region "Scope Keywords"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class ModuleKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ModuleInFileTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class NamespaceKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub NamespaceInFileTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class OfKeywordRecommenderTests
Inherits RecommenderTests

<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub OfAfterPossibleMethodTypeParamTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class OperatorKeywordRecommenderTests
Inherits RecommenderTests

<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub OperatorInClassDeclarationTest()
Expand Down
Loading